mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
remove genesis state from state tests
Conflicts: test/state.cpp
This commit is contained in:
parent
3583184cda
commit
983514a42a
@ -69,7 +69,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);
|
||||||
@ -183,13 +183,8 @@ void ImportTest::exportTest(bytes const& _output, State const& _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));
|
||||||
@ -212,9 +207,6 @@ void ImportTest::exportTest(bytes const& _output, State const& _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));
|
||||||
|
@ -47,9 +47,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);
|
||||||
|
47
state.cpp
47
state.cpp
@ -65,6 +65,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)
|
||||||
{
|
{
|
||||||
@ -169,23 +170,23 @@ 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)
|
//BOOST_AUTO_TEST_CASE(stQuadraticComplexityTest)
|
||||||
{
|
//{
|
||||||
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 == "--quadratic" || arg == "--all")
|
||||||
{
|
// {
|
||||||
auto start = chrono::steady_clock::now();
|
// auto start = chrono::steady_clock::now();
|
||||||
|
|
||||||
dev::test::executeTests("stQuadraticComplexityTest", "/StateTests", dev::test::doStateTests);
|
// dev::test::executeTests("stQuadraticComplexityTest", "/StateTests", dev::test::doStateTests);
|
||||||
|
|
||||||
auto end = chrono::steady_clock::now();
|
// auto end = chrono::steady_clock::now();
|
||||||
auto duration(chrono::duration_cast<chrono::milliseconds>(end - start));
|
// auto duration(chrono::duration_cast<chrono::milliseconds>(end - start));
|
||||||
cnote << "test duration: " << duration.count() << " milliseconds.\n";
|
// cnote << "test duration: " << duration.count() << " milliseconds.\n";
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(stMemoryStressTest)
|
BOOST_AUTO_TEST_CASE(stMemoryStressTest)
|
||||||
{
|
{
|
||||||
@ -207,20 +208,7 @@ BOOST_AUTO_TEST_CASE(stMemoryStressTest)
|
|||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(stSolidityTest)
|
BOOST_AUTO_TEST_CASE(stSolidityTest)
|
||||||
{
|
{
|
||||||
for (int i = 1; i < boost::unit_test::framework::master_test_suite().argc; ++i)
|
dev::test::executeTests("stSolidityTest", "/StateTests", dev::test::doStateTests);
|
||||||
{
|
|
||||||
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(stMemoryTest)
|
BOOST_AUTO_TEST_CASE(stMemoryTest)
|
||||||
@ -228,6 +216,7 @@ 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)
|
BOOST_AUTO_TEST_CASE(stCreateTest)
|
||||||
{
|
{
|
||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user