aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwinsvega <winsvega@mail.ru>2015-04-10 07:13:54 +0800
committerwinsvega <winsvega@mail.ru>2015-04-16 21:46:40 +0800
commit10245ce4b3b3b5dcf50dac8a097b96cd1d5adaf9 (patch)
tree79a064bc5daf8a0777f31a0730cd00a3536c7870
parentbfa1e9b7b9e1564482baeb09e3b7385ec6139fe8 (diff)
downloaddexon-solidity-10245ce4b3b3b5dcf50dac8a097b96cd1d5adaf9.tar.gz
dexon-solidity-10245ce4b3b3b5dcf50dac8a097b96cd1d5adaf9.tar.zst
dexon-solidity-10245ce4b3b3b5dcf50dac8a097b96cd1d5adaf9.zip
All Fields Hex: VMTests
-rw-r--r--TestHelper.cpp24
-rw-r--r--vm.cpp2
2 files changed, 17 insertions, 9 deletions
diff --git a/TestHelper.cpp b/TestHelper.cpp
index 127bff5a..5b8e7fbc 100644
--- a/TestHelper.cpp
+++ b/TestHelper.cpp
@@ -126,15 +126,23 @@ json_spirit::mObject& ImportTest::makeAllFieldsHex(json_spirit::mObject& _o)
if (key == "to")
continue;
- string str = (*it).second.get_str();
+ string str;
+ json_spirit::mValue value = (*it).second;
+
+ if (value.type() == json_spirit::int_type)
+ str = toString(value.get_int());
+ else if (value.type() == json_spirit::str_type)
+ 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)));
+ 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)));
}
return _o;
}
diff --git a/vm.cpp b/vm.cpp
index 4728b8a5..7064151d 100644
--- a/vm.cpp
+++ b/vm.cpp
@@ -85,7 +85,7 @@ void FakeExtVM::reset(u256 _myBalance, u256 _myNonce, map<u256, u256> const& _st
void FakeExtVM::push(mObject& o, string const& _n, u256 _v)
{
- o[_n] = toString(_v);
+ o[_n] = "0x" + toHex(toCompactBigEndian(_v));
}
void FakeExtVM::push(mArray& a, u256 _v)