aboutsummaryrefslogtreecommitdiffstats
path: root/vm.cpp
diff options
context:
space:
mode:
authorPaweł Bylica <pawel.bylica@imapp.pl>2014-10-17 00:20:49 +0800
committerPaweł Bylica <pawel.bylica@imapp.pl>2014-10-17 00:20:49 +0800
commit09a50c84a5f071915e67c5a91313e33b85b17812 (patch)
tree84e344129a975fa8c4da8e331bba0399b92da689 /vm.cpp
parent0074309337e0ebbcf58dfeefc8968158dd77d63d (diff)
downloaddexon-solidity-09a50c84a5f071915e67c5a91313e33b85b17812.tar.gz
dexon-solidity-09a50c84a5f071915e67c5a91313e33b85b17812.tar.zst
dexon-solidity-09a50c84a5f071915e67c5a91313e33b85b17812.zip
Prepare VM test engine for running JIT-ed tests
Diffstat (limited to 'vm.cpp')
-rw-r--r--vm.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/vm.cpp b/vm.cpp
index cc87866d..d7790673 100644
--- a/vm.cpp
+++ b/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);
}