fix trie test#

This commit is contained in:
CJentzsch 2014-12-11 23:36:23 +01:00
parent 98722ae8e8
commit 473e10e0dc

View File

@ -67,9 +67,14 @@ BOOST_AUTO_TEST_CASE(trie_tests)
cnote << i.first;
js::mObject& o = i.second.get_obj();
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"))
ss.back().first = asString(fromHex(ss.back().first.substr(2)));
if (!ss.back().second.find("0x"))
@ -88,7 +93,9 @@ BOOST_AUTO_TEST_CASE(trie_tests)
BOOST_REQUIRE(t.check(true));
}
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;
}
}
}