MCPcopy Create free account
hub / github.com/LUX-Core/lux / doStateTests

Function doStateTests

src/cpp-ethereum/test/libethereum/StateTests.cpp:42–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40namespace dev { namespace test {
41
42void doStateTests(json_spirit::mValue& _v, bool _fillin)
43{
44 for (auto& i: _v.get_obj())
45 {
46 string testname = i.first;
47 json_spirit::mObject& o = i.second.get_obj();
48
49 if (!TestOutputHelper::passTest(o, testname))
50 continue;
51
52 //For 100% at the log output
53 if (_fillin == false && Options::get().fillchain)
54 continue;
55
56 BOOST_REQUIRE_MESSAGE(o.count("env") > 0, testname + "env not set!");
57 BOOST_REQUIRE_MESSAGE(o.count("pre") > 0, testname + "pre not set!");
58 BOOST_REQUIRE_MESSAGE(o.count("transaction") > 0, testname + "transaction not set!");
59
60 ImportTest importer(o, _fillin, testType::GeneralStateTest);
61 const State importedStatePost = importer.m_statePost;
62
63 Listener::ExecTimeGuard guard{i.first};
64 importer.executeTest();
65 if (Options::get().fillchain)
66 continue;
67
68 if (_fillin)
69 {
70#if ETH_FATDB
71 if (importer.exportTest(bytes()))
72 cerr << testname << endl;
73#else
74 BOOST_THROW_EXCEPTION(Exception() << errinfo_comment(testname + "You can not fill tests when FATDB is switched off"));
75#endif
76 }
77 else
78 {
79 BOOST_REQUIRE(o.count("post") > 0);
80
81 //check post hashes against cpp client on all networks
82 mObject post = o["post"].get_obj();
83 vector<size_t> wrongTransactionsIndexes;
84 for (mObject::const_iterator i = post.begin(); i != post.end(); ++i)
85 {
86 for (auto const& exp: i->second.get_array())
87 {
88 if (!Options::get().singleTestNet.empty() && i->first != Options::get().singleTestNet)
89 continue;
90 importer.checkGeneralTestSection(exp.get_obj(), wrongTransactionsIndexes, i->first);
91 }
92 }
93 }
94 }
95}
96} }// Namespace Close
97
98class generaltestfixture

Callers

nothing calls this directly

Calls 8

executeTestMethod · 0.80
exportTestMethod · 0.80
ExceptionClass · 0.50
countMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected