Browse Source

Random Code: fulloutput option + test

cl-refactor
Dimitry 10 years ago
parent
commit
8ea48967f1
  1. 1
      test/TestHelper.cpp
  2. 8
      test/fuzzTesting/createRandomStateTest.cpp
  3. 19
      test/fuzzTesting/fuzzHelper.cpp

1
test/TestHelper.cpp

@ -771,7 +771,6 @@ Options const& Options::get()
return instance; return instance;
} }
LastHashes lastHashes(u256 _currentBlockNumber) LastHashes lastHashes(u256 _currentBlockNumber)
{ {
LastHashes ret; LastHashes ret;

8
test/fuzzTesting/createRandomStateTest.cpp

@ -96,6 +96,14 @@ string const c_testExample = R"(
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
for (auto i = 0; i < argc; ++i)
{
auto arg = std::string{argv[i]};
dev::test::Options& options = const_cast<dev::test::Options&>(dev::test::Options::get());
if (arg == "--fulloutput")
options.fulloutput = true;
}
//doChristophAlgo(); //doChristophAlgo();
doRandomCodeAlgo(); doRandomCodeAlgo();
return 0; return 0;

19
test/fuzzTesting/fuzzHelper.cpp

@ -114,5 +114,24 @@ void RandomCode::refreshSeed()
gen.seed(static_cast<unsigned int>(timeSinceEpoch)); gen.seed(static_cast<unsigned int>(timeSinceEpoch));
} }
BOOST_AUTO_TEST_SUITE(RandomCodeTests)
BOOST_AUTO_TEST_CASE(rndCode)
{
std::string code;
std::cerr << "Testing Random Code: ";
try
{
code = dev::test::RandomCode::generate(10);
}
catch(...)
{
BOOST_ERROR("Exception thrown when generating random code!");
}
std::cerr << code;
}
BOOST_AUTO_TEST_SUITE_END()
} }
} }

Loading…
Cancel
Save