Browse Source

Random Code: exceptions when filling rnd StateTest

cl-refactor
Dimitry 10 years ago
parent
commit
50d6e8cb31
  1. 21
      test/fuzzTesting/createRandomStateTest.cpp
  2. 2
      test/fuzzTesting/fuzzHelper.h

21
test/fuzzTesting/createRandomStateTest.cpp

@ -218,15 +218,19 @@ void doStateTests(json_spirit::mValue& _v)
assert(o.count("env") > 0); assert(o.count("env") > 0);
assert(o.count("pre") > 0); assert(o.count("pre") > 0);
assert(o.count("transaction") > 0); assert(o.count("transaction") > 0);
test::ImportTest importer(o, true);
eth::State theState = importer.m_statePre;
bytes output; bytes output;
eth::State theState;
try try
{ {
test::ImportTest importer(o, true);
eth::State theState = importer.m_statePre;
output = theState.execute(test::lastHashes(importer.m_environment.currentBlock.number), importer.m_transaction).output; output = theState.execute(test::lastHashes(importer.m_environment.currentBlock.number), importer.m_transaction).output;
#if ETH_FATDB
importer.exportTest(output, theState);
#else
cout << "You can not fill tests when FATDB is switched off";
#endif
} }
catch (Exception const& _e) catch (Exception const& _e)
{ {
@ -237,10 +241,9 @@ void doStateTests(json_spirit::mValue& _v)
{ {
cnote << "state execution did throw an exception: " << _e.what(); cnote << "state execution did throw an exception: " << _e.what();
} }
#if ETH_FATDB catch (...)
importer.exportTest(output, theState); {
#else cnote << "state execution did throw an exception!";
cout << "You can not fill tests when FATDB is switched off"; }
#endif
} }
} }

2
test/fuzzTesting/fuzzHelper.h

@ -94,7 +94,5 @@ private:
static boostIntGenerator randOpLengGen; ///< Generate random length from opLengDist static boostIntGenerator randOpLengGen; ///< Generate random length from opLengDist
}; };
} }
} }

Loading…
Cancel
Save