aboutsummaryrefslogtreecommitdiffstats
path: root/TestHelper.cpp
diff options
context:
space:
mode:
authorwinsvega <winsvega@mail.ru>2015-04-13 21:33:42 +0800
committerwinsvega <winsvega@mail.ru>2015-04-16 21:46:40 +0800
commit92269d4df7b6d3b454ca44a8dde2ab0a3e113749 (patch)
treedd9582a15d04c7b1f8c93c845aa4d9c901c4dc54 /TestHelper.cpp
parent10245ce4b3b3b5dcf50dac8a097b96cd1d5adaf9 (diff)
downloaddexon-solidity-92269d4df7b6d3b454ca44a8dde2ab0a3e113749.tar.gz
dexon-solidity-92269d4df7b6d3b454ca44a8dde2ab0a3e113749.tar.zst
dexon-solidity-92269d4df7b6d3b454ca44a8dde2ab0a3e113749.zip
All Fields Hex: block tests
Diffstat (limited to 'TestHelper.cpp')
-rw-r--r--TestHelper.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/TestHelper.cpp b/TestHelper.cpp
index 5b8e7fbc..c02e8b28 100644
--- a/TestHelper.cpp
+++ b/TestHelper.cpp
@@ -120,13 +120,17 @@ ImportTest::ImportTest(json_spirit::mObject& _o, bool isFiller):
json_spirit::mObject& ImportTest::makeAllFieldsHex(json_spirit::mObject& _o)
{
+ static const std::string hashes[] = {"bloom" , "coinbase", "hash", "mixHash", "parentHash", "receiptTrie",
+ "stateRoot", "transactionsTrie", "uncleHash", "currentCoinbase",
+ "previousHash", "to", "address", "caller", "origin"};
+
for (json_spirit::mObject::iterator it = _o.begin(); it != _o.end(); it++)
{
- string key = (*it).first;
- if (key == "to")
+ std::string key = (*it).first;
+ if (std::find(std::begin(hashes), std::end(hashes), key) != std::end(hashes))
continue;
- string str;
+ std::string str;
json_spirit::mValue value = (*it).second;
if (value.type() == json_spirit::int_type)
@@ -135,14 +139,7 @@ json_spirit::mObject& ImportTest::makeAllFieldsHex(json_spirit::mObject& _o)
str = value.get_str();
else continue;
- _o[key] = (str.substr(0, 2) == "0x" ||
- str.find("a") != string::npos ||
- str.find("b") != string::npos ||
- str.find("c") != string::npos ||
- str.find("d") != string::npos ||
- str.find("e") != string::npos ||
- str.find("f") != string::npos
- ) ? str : "0x" + toHex(toCompactBigEndian(toInt(str)));
+ _o[key] = (str.substr(0, 2) == "0x") ? str : "0x" + toHex(toCompactBigEndian(toInt(str)));
}
return _o;
}