mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #1195 from CJentzsch/POC9tests
remove genesis state from state tests
This commit is contained in:
commit
ebd7ac43e0
@ -67,7 +67,7 @@ namespace test
|
|||||||
struct ValueTooLarge: virtual Exception {};
|
struct ValueTooLarge: virtual Exception {};
|
||||||
bigint const c_max256plus1 = bigint(1) << 256;
|
bigint const c_max256plus1 = bigint(1) << 256;
|
||||||
|
|
||||||
ImportTest::ImportTest(json_spirit::mObject& _o, bool isFiller): m_TestObject(_o)
|
ImportTest::ImportTest(json_spirit::mObject& _o, bool isFiller) : m_statePre(Address(_o["env"].get_obj()["currentCoinbase"].get_str()), OverlayDB(), eth::BaseState::Empty), m_statePost(Address(_o["env"].get_obj()["currentCoinbase"].get_str()), OverlayDB(), eth::BaseState::Empty), m_TestObject(_o)
|
||||||
{
|
{
|
||||||
importEnv(_o["env"].get_obj());
|
importEnv(_o["env"].get_obj());
|
||||||
importState(_o["pre"].get_obj(), m_statePre);
|
importState(_o["pre"].get_obj(), m_statePre);
|
||||||
@ -181,13 +181,8 @@ void ImportTest::exportTest(bytes _output, State& _statePost)
|
|||||||
// export post state
|
// export post state
|
||||||
json_spirit::mObject postState;
|
json_spirit::mObject postState;
|
||||||
|
|
||||||
std::map<Address, Account> genesis = genesisState();
|
|
||||||
|
|
||||||
for (auto const& a: _statePost.addresses())
|
for (auto const& a: _statePost.addresses())
|
||||||
{
|
{
|
||||||
if (genesis.count(a.first))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
json_spirit::mObject o;
|
json_spirit::mObject o;
|
||||||
o["balance"] = toString(_statePost.balance(a.first));
|
o["balance"] = toString(_statePost.balance(a.first));
|
||||||
o["nonce"] = toString(_statePost.transactionsFrom(a.first));
|
o["nonce"] = toString(_statePost.transactionsFrom(a.first));
|
||||||
@ -210,9 +205,6 @@ void ImportTest::exportTest(bytes _output, State& _statePost)
|
|||||||
|
|
||||||
for (auto const& a: m_statePre.addresses())
|
for (auto const& a: m_statePre.addresses())
|
||||||
{
|
{
|
||||||
if (genesis.count(a.first))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
json_spirit::mObject o;
|
json_spirit::mObject o;
|
||||||
o["balance"] = toString(m_statePre.balance(a.first));
|
o["balance"] = toString(m_statePre.balance(a.first));
|
||||||
o["nonce"] = toString(m_statePre.transactionsFrom(a.first));
|
o["nonce"] = toString(m_statePre.transactionsFrom(a.first));
|
||||||
|
@ -45,9 +45,8 @@ namespace test
|
|||||||
class ImportTest
|
class ImportTest
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ImportTest(json_spirit::mObject& _o) : m_TestObject(_o) {}
|
ImportTest(json_spirit::mObject& _o) : m_statePre(Address(), OverlayDB(), eth::BaseState::Empty), m_statePost(Address(), OverlayDB(), eth::BaseState::Empty), m_TestObject(_o) {}
|
||||||
ImportTest(json_spirit::mObject& _o, bool isFiller);
|
ImportTest(json_spirit::mObject& _o, bool isFiller);
|
||||||
|
|
||||||
// imports
|
// imports
|
||||||
void importEnv(json_spirit::mObject& _o);
|
void importEnv(json_spirit::mObject& _o);
|
||||||
void importState(json_spirit::mObject& _o, eth::State& _state);
|
void importState(json_spirit::mObject& _o, eth::State& _state);
|
||||||
|
64
state.cpp
64
state.cpp
@ -64,6 +64,7 @@ void doStateTests(json_spirit::mValue& v, bool _fillin)
|
|||||||
catch (Exception const& _e)
|
catch (Exception const& _e)
|
||||||
{
|
{
|
||||||
cnote << "state execution did throw an exception: " << diagnostic_information(_e);
|
cnote << "state execution did throw an exception: " << diagnostic_information(_e);
|
||||||
|
theState.commit();
|
||||||
}
|
}
|
||||||
catch (std::exception const& _e)
|
catch (std::exception const& _e)
|
||||||
{
|
{
|
||||||
@ -168,39 +169,52 @@ BOOST_AUTO_TEST_CASE(stBlockHashTest)
|
|||||||
dev::test::executeTests("stBlockHashTest", "/StateTests", dev::test::doStateTests);
|
dev::test::executeTests("stBlockHashTest", "/StateTests", dev::test::doStateTests);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//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";
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(stMemoryStressTest)
|
BOOST_AUTO_TEST_CASE(stMemoryStressTest)
|
||||||
{
|
{
|
||||||
for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i)
|
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];
|
string arg = boost::unit_test::framework::master_test_suite().argv[i];
|
||||||
if (arg == "--quadratic" || arg == "--all")
|
if (arg == "--memory" || arg == "--all")
|
||||||
{
|
{
|
||||||
auto start = chrono::steady_clock::now();
|
auto start = chrono::steady_clock::now();
|
||||||
dev::test::executeTests("stQuadraticComplexityTest", "/StateTests", dev::test::doStateTests);
|
|
||||||
auto end = chrono::steady_clock::now();
|
dev::test::executeTests("stMemoryStressTest", "/StateTests", dev::test::doStateTests);
|
||||||
auto duration(chrono::duration_cast<chrono::milliseconds>(end - start));
|
|
||||||
cnote << "test duration: " << duration.count() << " milliseconds.\n";
|
auto end = chrono::steady_clock::now();
|
||||||
}
|
auto duration(chrono::duration_cast<chrono::milliseconds>(end - start));
|
||||||
else if (arg == "--memory" || arg == "--all")
|
cnote << "test duration: " << duration.count() << " milliseconds.\n";
|
||||||
{
|
}
|
||||||
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(stMemoryTest)
|
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(stSolidityTest)
|
|
||||||
{
|
|
||||||
dev::test::executeTests("stSolidityTest", "/StateTests", dev::test::doStateTests);
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(stCreateTest)
|
BOOST_AUTO_TEST_CASE(stCreateTest)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user