diff options
author | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-03-06 22:51:12 +0800 |
---|---|---|
committer | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-03-06 22:51:12 +0800 |
commit | 3726e267a825d82c7d576b733732b87cbb336a71 (patch) | |
tree | 9b1310b88969c5128112753ed01039838cac9324 /state.cpp | |
parent | dcbd78735bb14db5520cabb413fe802bf50d9ff7 (diff) | |
parent | 1308d62308c676a665147a2a9e1d045dcdbe7f31 (diff) | |
download | dexon-solidity-3726e267a825d82c7d576b733732b87cbb336a71.tar dexon-solidity-3726e267a825d82c7d576b733732b87cbb336a71.tar.gz dexon-solidity-3726e267a825d82c7d576b733732b87cbb336a71.tar.bz2 dexon-solidity-3726e267a825d82c7d576b733732b87cbb336a71.tar.lz dexon-solidity-3726e267a825d82c7d576b733732b87cbb336a71.tar.xz dexon-solidity-3726e267a825d82c7d576b733732b87cbb336a71.tar.zst dexon-solidity-3726e267a825d82c7d576b733732b87cbb336a71.zip |
Merge branch 'mac_fixes' into new_jsonrpc
Conflicts:
libethcore/CommonJS.h
libweb3jsonrpc/WebThreeStubServerBase.cpp
libweb3jsonrpc/WebThreeStubServerBase.h
libweb3jsonrpc/abstractwebthreestubserver.h
libweb3jsonrpc/spec.json
Diffstat (limited to 'state.cpp')
-rw-r--r-- | state.cpp | 77 |
1 files changed, 44 insertions, 33 deletions
@@ -65,6 +65,7 @@ void doStateTests(json_spirit::mValue& v, bool _fillin) catch (Exception const& _e) { cnote << "state execution did throw an exception: " << diagnostic_information(_e); + theState.commit(); } catch (std::exception const& _e) { @@ -72,7 +73,13 @@ void doStateTests(json_spirit::mValue& v, bool _fillin) } if (_fillin) + { +#if ETH_FATDB importer.exportTest(output, theState); +#else + BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("You can not fill tests when FATDB is switched off")); +#endif + } else { BOOST_REQUIRE(o.count("post") > 0); @@ -85,6 +92,7 @@ void doStateTests(json_spirit::mValue& v, bool _fillin) checkLog(theState.pending().size() ? theState.log(0) : LogEntries(), importer.m_environment.sub.logs); // check addresses +#if ETH_FATDB auto expectedAddrs = importer.m_statePost.addresses(); auto resultAddrs = theState.addresses(); for (auto& expectedPair : expectedAddrs) @@ -103,6 +111,8 @@ void doStateTests(json_spirit::mValue& v, bool _fillin) } } checkAddresses<map<Address, u256> >(expectedAddrs, resultAddrs); +#endif + BOOST_CHECK_MESSAGE(theState.rootHash() == h256(o["postStateRoot"].get_str()), "wrong post state root"); } } } @@ -162,50 +172,51 @@ BOOST_AUTO_TEST_CASE(stBlockHashTest) BOOST_AUTO_TEST_CASE(stQuadraticComplexityTest) { - for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i) - { - string arg = boost::unit_test::framework::master_test_suite().argv[i]; - if (arg == "--quadratic" || arg == "--all") - { - auto start = chrono::steady_clock::now(); - - dev::test::executeTests("stQuadraticComplexityTest", "/StateTests", dev::test::doStateTests); - - auto end = chrono::steady_clock::now(); - auto duration(chrono::duration_cast<chrono::milliseconds>(end - start)); - cnote << "test duration: " << duration.count() << " milliseconds.\n"; - } - } + for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i) + { + string arg = boost::unit_test::framework::master_test_suite().argv[i]; + if (arg == "--quadratic" || arg == "--all") + { + auto start = chrono::steady_clock::now(); + + dev::test::executeTests("stQuadraticComplexityTest", "/StateTests", dev::test::doStateTests); + + auto end = chrono::steady_clock::now(); + auto duration(chrono::duration_cast<chrono::milliseconds>(end - start)); + cnote << "test duration: " << duration.count() << " milliseconds.\n"; + } + } } BOOST_AUTO_TEST_CASE(stMemoryStressTest) { - for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i) - { - string arg = boost::unit_test::framework::master_test_suite().argv[i]; - if (arg == "--memory" || arg == "--all") - { - auto start = chrono::steady_clock::now(); - - dev::test::executeTests("stMemoryStressTest", "/StateTests", dev::test::doStateTests); - - auto end = chrono::steady_clock::now(); - auto duration(chrono::duration_cast<chrono::milliseconds>(end - start)); - cnote << "test duration: " << duration.count() << " milliseconds.\n"; - } - } + for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i) + { + string arg = boost::unit_test::framework::master_test_suite().argv[i]; + if (arg == "--memory" || arg == "--all") + { + auto start = chrono::steady_clock::now(); + + dev::test::executeTests("stMemoryStressTest", "/StateTests", dev::test::doStateTests); + + auto end = chrono::steady_clock::now(); + auto duration(chrono::duration_cast<chrono::milliseconds>(end - start)); + cnote << "test duration: " << duration.count() << " milliseconds.\n"; + } + } } -BOOST_AUTO_TEST_CASE(stSolidityTest) -{ - dev::test::executeTests("stSolidityTest", "/StateTests", dev::test::doStateTests); -} + BOOST_AUTO_TEST_CASE(stSolidityTest) + { + dev::test::executeTests("stSolidityTest", "/StateTests", dev::test::doStateTests); + } BOOST_AUTO_TEST_CASE(stMemoryTest) { - dev::test::executeTests("stMemoryTest", "/StateTests", dev::test::doStateTests); + dev::test::executeTests("stMemoryTest", "/StateTests", dev::test::doStateTests); } + BOOST_AUTO_TEST_CASE(stCreateTest) { for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i) |