mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #383 from imapp-pl/pr-fixes
Prepare VM test engine for running JIT-ed tests (+ a bugfix)
This commit is contained in:
commit
693fe08bc9
2
rlp.cpp
2
rlp.cpp
@ -79,7 +79,7 @@ namespace dev
|
||||
if ( v.type() == js::str_type )
|
||||
{
|
||||
const std::string& expectedText = v.get_str();
|
||||
if ( expectedText.front() == '#' )
|
||||
if ( !expectedText.empty() && expectedText.front() == '#' )
|
||||
{
|
||||
// Deal with bigint instead of a raw string
|
||||
std::string bigIntStr = expectedText.substr(1,expectedText.length()-1);
|
||||
|
11
vm.cpp
11
vm.cpp
@ -493,7 +493,6 @@ void doTests(json_spirit::mValue& v, bool _fillin)
|
||||
BOOST_REQUIRE(o.count("pre") > 0);
|
||||
BOOST_REQUIRE(o.count("exec") > 0);
|
||||
|
||||
VM vm;
|
||||
dev::test::FakeExtVM fev;
|
||||
fev.importEnv(o["env"].get_obj());
|
||||
fev.importState(o["pre"].get_obj());
|
||||
@ -508,11 +507,13 @@ void doTests(json_spirit::mValue& v, bool _fillin)
|
||||
fev.code = &fev.thisTxCode;
|
||||
}
|
||||
|
||||
vm.reset(fev.gas);
|
||||
bytes output;
|
||||
u256 gas;
|
||||
try
|
||||
{
|
||||
output = vm.go(fev).toBytes();
|
||||
VM vm(fev.gas);
|
||||
output = vm.go(fev).toVector();
|
||||
gas = vm.gas(); // Get the remaining gas
|
||||
}
|
||||
catch (Exception const& _e)
|
||||
{
|
||||
@ -549,7 +550,7 @@ void doTests(json_spirit::mValue& v, bool _fillin)
|
||||
o["post"] = mValue(fev.exportState());
|
||||
o["callcreates"] = fev.exportCallCreates();
|
||||
o["out"] = "0x" + toHex(output);
|
||||
fev.push(o, "gas", vm.gas());
|
||||
fev.push(o, "gas", gas);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -573,7 +574,7 @@ void doTests(json_spirit::mValue& v, bool _fillin)
|
||||
else
|
||||
BOOST_CHECK(output == fromHex(o["out"].get_str()));
|
||||
|
||||
BOOST_CHECK(test.toInt(o["gas"]) == vm.gas());
|
||||
BOOST_CHECK(test.toInt(o["gas"]) == gas);
|
||||
BOOST_CHECK(test.addresses == fev.addresses);
|
||||
BOOST_CHECK(test.callcreates == fev.callcreates);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user