diff options
author | CJentzsch <jentzsch.software@gmail.com> | 2015-04-18 00:41:27 +0800 |
---|---|---|
committer | CJentzsch <jentzsch.software@gmail.com> | 2015-04-18 00:41:27 +0800 |
commit | 22d16c048bde69eb66d315990f2d407f7384cf4f (patch) | |
tree | d40404fa4d42f67a8e5f32726e9690d2d849d63d /TestHelper.cpp | |
parent | 7571971ca05fd12e3603531044e094ffc0000fb2 (diff) | |
download | dexon-solidity-22d16c048bde69eb66d315990f2d407f7384cf4f.tar.gz dexon-solidity-22d16c048bde69eb66d315990f2d407f7384cf4f.tar.zst dexon-solidity-22d16c048bde69eb66d315990f2d407f7384cf4f.zip |
0x -> 0x0 for numbers
Diffstat (limited to 'TestHelper.cpp')
-rw-r--r-- | TestHelper.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/TestHelper.cpp b/TestHelper.cpp index 92a8258a..49c6bb02 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -123,7 +123,7 @@ json_spirit::mObject& ImportTest::makeAllFieldsHex(json_spirit::mObject& _o) { static const set<string> hashes {"bloom" , "coinbase", "hash", "mixHash", "parentHash", "receiptTrie", "stateRoot", "transactionsTrie", "uncleHash", "currentCoinbase", - "previousHash", "to", "address", "caller", "origin", "secretKey"}; + "previousHash", "to", "address", "caller", "origin", "secretKey", "data"}; for (auto& i: _o) { @@ -140,7 +140,7 @@ json_spirit::mObject& ImportTest::makeAllFieldsHex(json_spirit::mObject& _o) str = value.get_str(); else continue; - _o[key] = (str.substr(0, 2) == "0x") ? str : "0x" + toHex(toCompactBigEndian(toInt(str))); + _o[key] = (str.substr(0, 2) == "0x") ? str : "0x" + (toHex(toCompactBigEndian(toInt(str))).empty() ? "0" : toHex(toCompactBigEndian(toInt(str)))); } return _o; } @@ -363,8 +363,8 @@ json_spirit::mObject fillJsonWithState(State _state) for (auto const& a: _state.addresses()) { json_spirit::mObject o; - o["balance"] = "0x" + toHex(toCompactBigEndian(_state.balance(a.first))); - o["nonce"] = "0x" + toHex(toCompactBigEndian(_state.transactionsFrom(a.first))); + o["balance"] = "0x" + (toHex(toCompactBigEndian(_state.balance(a.first))).empty() ? "0" : toHex(toCompactBigEndian(_state.balance(a.first)))); + o["nonce"] = "0x" + (toHex(toCompactBigEndian(_state.transactionsFrom(a.first))).empty() ? "0" : toHex(toCompactBigEndian(_state.transactionsFrom(a.first)))); { json_spirit::mObject store; for (auto const& s: _state.storage(a.first)) |