Browse Source

handle output larger than 4069 bytes in test

cl-refactor
CJentzsch 10 years ago
parent
commit
bb7ca7a6b4
  1. 9
      test/TestHelper.cpp
  2. 6
      test/libethereum/StateTestsFiller/stMemoryStressTestFiller.json
  3. 2
      test/libevm/vm.cpp

9
test/TestHelper.cpp

@ -327,7 +327,8 @@ void ImportTest::checkExpectedState(State const& _stateExpect, State const& _sta
void ImportTest::exportTest(bytes const& _output, State const& _statePost)
{
// export output
m_TestObject["out"] = toHex(_output, 2, HexPrefix::Add);
m_TestObject["out"] = _output.size() > 4096 ? "#" + toString(_output.size()) : toHex(_output, 2, HexPrefix::Add);
// export logs
m_TestObject["logs"] = exportLog(_statePost.pending().size() ? _statePost.log(0) : LogEntries());
@ -489,7 +490,11 @@ LogEntries importLog(json_spirit::mArray& _a)
void checkOutput(bytes const& _output, json_spirit::mObject& _o)
{
int j = 0;
if (_o["out"].type() == json_spirit::array_type)
if (_o["out"].get_str().find("#") == 0)
BOOST_CHECK((u256)_output.size() == toInt(_o["out"].get_str().substr(1)));
else if (_o["out"].type() == json_spirit::array_type)
for (auto const& d: _o["out"].get_array())
{
BOOST_CHECK_MESSAGE(_output[j] == toInt(d), "Output byte [" << j << "] different!");

6
test/libethereum/StateTestsFiller/stMemoryStressTestFiller.json

@ -58,7 +58,7 @@
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"nonce" : "0",
"code" : "{ (RETURN 0 4294967297) } ",
"code" : "{ (RETURN 0 4294967295) } ",
"storage": {}
},
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {
@ -77,7 +77,7 @@
"secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8",
"data" : ""
}
},
},
"mload32bitBound_return2": {
"env" : {
@ -98,7 +98,7 @@
"0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : {
"balance" : "1000000000000000000",
"nonce" : "0",
"code" : "{[ 0 ] 1 (RETURN 0 4294967296) } ",
"code" : "{[ 0 ] 1 (RETURN 0 4294967295) } ",
"storage": {}
},
"a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : {

2
test/libevm/vm.cpp

@ -393,7 +393,7 @@ void doVMTests(json_spirit::mValue& v, bool _fillin)
}
o["callcreates"] = fev.exportCallCreates();
o["out"] = toHex(output, 2, HexPrefix::Add);
o["out"] = output.size() > 4096 ? "#" + toString(output.size()) : toHex(output, 2, HexPrefix::Add);
o["gas"] = toCompactHex(gas, HexPrefix::Add, 1);
o["logs"] = exportLog(fev.sub.logs);
}

Loading…
Cancel
Save