diff options
author | CJentzsch <jentzsch.software@gmail.com> | 2015-02-06 05:41:40 +0800 |
---|---|---|
committer | CJentzsch <jentzsch.software@gmail.com> | 2015-02-06 05:41:40 +0800 |
commit | f168904410528731d6d074a7c6502f7596151c09 (patch) | |
tree | 34d03752af598c29659adf356e7f07e1674c4399 /TestHelper.cpp | |
parent | ed2b4cff41a23e81e706c47b0187a18f5c7ea8d2 (diff) | |
parent | 969366f46b83c57461fc5399fff76bd07738b6f2 (diff) | |
download | dexon-solidity-f168904410528731d6d074a7c6502f7596151c09.tar dexon-solidity-f168904410528731d6d074a7c6502f7596151c09.tar.gz dexon-solidity-f168904410528731d6d074a7c6502f7596151c09.tar.bz2 dexon-solidity-f168904410528731d6d074a7c6502f7596151c09.tar.lz dexon-solidity-f168904410528731d6d074a7c6502f7596151c09.tar.xz dexon-solidity-f168904410528731d6d074a7c6502f7596151c09.tar.zst dexon-solidity-f168904410528731d6d074a7c6502f7596151c09.zip |
Merge remote-tracking branch 'upstream/develop' into addTests
Diffstat (limited to 'TestHelper.cpp')
-rw-r--r-- | TestHelper.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/TestHelper.cpp b/TestHelper.cpp index 355a5080..5a579702 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -115,7 +115,7 @@ void ImportTest::importState(json_spirit::mObject& _o, State& _state) if (code.size()) { _state.m_cache[address] = Account(toInt(o["balance"]), Account::ContractConception); - _state.m_cache[address].setCode(bytesConstRef(&code)); + _state.m_cache[address].setCode(code); } else _state.m_cache[address] = Account(toInt(o["balance"]), Account::NormalCreation); @@ -228,18 +228,19 @@ byte toByte(json_spirit::mValue const& _v) return 0; } +bytes importByteArray(std::string const& _str) +{ + return fromHex(_str.substr(0, 2) == "0x" ? _str.substr(2) : _str); +} + bytes importData(json_spirit::mObject& _o) { bytes data; if (_o["data"].type() == json_spirit::str_type) - if (_o["data"].get_str().find_first_of("0x") == 0) - data = fromHex(_o["data"].get_str().substr(2)); - else - data = fromHex(_o["data"].get_str()); + data = importByteArray(_o["data"].get_str()); else for (auto const& j: _o["data"].get_array()) data.push_back(toByte(j)); - return data; } |