failing tests for getting genesis block

This commit is contained in:
Marek Kotewicz 2015-03-30 14:02:27 +02:00
parent 735c02c468
commit 0f416747ad

View File

@ -34,34 +34,45 @@ BOOST_AUTO_TEST_CASE(blocks)
{ {
enumerateClients([](Json::Value const& _json, dev::eth::ClientBase& _client) -> void enumerateClients([](Json::Value const& _json, dev::eth::ClientBase& _client) -> void
{ {
for (string const& name: _json["postState"].getMemberNames()) auto compareState = [&_client](Json::Value const& _o, string const& _name, BlockNumber _blockNumber) -> void
{ {
Json::Value o = _json["postState"][name]; Address address(_name);
Address address(name);
// balanceAt // balanceAt
u256 expectedBalance = u256(o["balance"].asString()); u256 expectedBalance = u256(_o["balance"].asString());
u256 balance = _client.balanceAt(address); u256 balance = _client.balanceAt(address, _blockNumber);
ETH_CHECK_EQUAL(expectedBalance, balance); ETH_CHECK_EQUAL(expectedBalance, balance);
// countAt // countAt
u256 expectedCount = u256(o["nonce"].asString()); u256 expectedCount = u256(_o["nonce"].asString());
u256 count = _client.countAt(address); u256 count = _client.countAt(address, _blockNumber);
ETH_CHECK_EQUAL(expectedCount, count); ETH_CHECK_EQUAL(expectedCount, count);
// stateAt // stateAt
for (string const& pos: o["storage"].getMemberNames()) for (string const& pos: _o["storage"].getMemberNames())
{ {
u256 expectedState = u256(o["storage"][pos].asString()); u256 expectedState = u256(_o["storage"][pos].asString());
u256 state = _client.stateAt(address, u256(pos)); u256 state = _client.stateAt(address, u256(pos), _blockNumber);
ETH_CHECK_EQUAL(expectedState, state); ETH_CHECK_EQUAL(expectedState, state);
} }
// codeAt // codeAt
bytes expectedCode = fromHex(o["code"].asString()); bytes expectedCode = fromHex(_o["code"].asString());
bytes code = _client.codeAt(address); bytes code = _client.codeAt(address, _blockNumber);
ETH_CHECK_EQUAL_COLLECTIONS(expectedCode.begin(), expectedCode.end(), ETH_CHECK_EQUAL_COLLECTIONS(expectedCode.begin(), expectedCode.end(),
code.begin(), code.end()); code.begin(), code.end());
};
for (string const& name: _json["postState"].getMemberNames())
{
Json::Value o = _json["postState"][name];
compareState(o, name, PendingBlock);
}
for (string const& name: _json["pre"].getMemberNames())
{
Json::Value o = _json["pre"][name];
compareState(o, name, 0);
} }
// number // number