mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
fix trie test#
This commit is contained in:
parent
98722ae8e8
commit
473e10e0dc
13
trie.cpp
13
trie.cpp
@ -67,9 +67,14 @@ BOOST_AUTO_TEST_CASE(trie_tests)
|
|||||||
cnote << i.first;
|
cnote << i.first;
|
||||||
js::mObject& o = i.second.get_obj();
|
js::mObject& o = i.second.get_obj();
|
||||||
vector<pair<string, string>> ss;
|
vector<pair<string, string>> ss;
|
||||||
for (auto i: o["in"].get_obj())
|
for (auto i: o["in"].get_array())
|
||||||
{
|
{
|
||||||
ss.push_back(make_pair(i.first, i.second.get_str()));
|
vector<string> values;
|
||||||
|
for (auto s: i.get_array())
|
||||||
|
values.push_back(s.get_str());
|
||||||
|
|
||||||
|
assert(values.size() == 2);
|
||||||
|
ss.push_back(make_pair(values[0], values[1]));
|
||||||
if (!ss.back().first.find("0x"))
|
if (!ss.back().first.find("0x"))
|
||||||
ss.back().first = asString(fromHex(ss.back().first.substr(2)));
|
ss.back().first = asString(fromHex(ss.back().first.substr(2)));
|
||||||
if (!ss.back().second.find("0x"))
|
if (!ss.back().second.find("0x"))
|
||||||
@ -88,7 +93,9 @@ BOOST_AUTO_TEST_CASE(trie_tests)
|
|||||||
BOOST_REQUIRE(t.check(true));
|
BOOST_REQUIRE(t.check(true));
|
||||||
}
|
}
|
||||||
BOOST_REQUIRE(!o["root"].is_null());
|
BOOST_REQUIRE(!o["root"].is_null());
|
||||||
BOOST_CHECK_EQUAL(o["root"].get_str(), toHex(t.root().asArray()));
|
BOOST_CHECK_EQUAL(o["root"].get_str(), "0x" + toHex(t.root().asArray()));
|
||||||
|
if (o["root"].get_str() != "0x" + toHex(t.root().asArray()))
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user