Update VM test engine to use VMFace interface

This commit is contained in:
Paweł Bylica 2014-10-22 16:52:47 +02:00
parent 44536d4327
commit d740145ecc

11
vm.cpp
View File

@ -517,16 +517,13 @@ void doTests(json_spirit::mValue& v, bool _fillin)
auto argv = boost::unit_test::framework::master_test_suite().argv; auto argv = boost::unit_test::framework::master_test_suite().argv;
auto useJit = argc >= 2 && std::string(argv[1]) == "--jit"; auto useJit = argc >= 2 && std::string(argv[1]) == "--jit";
jit::VM jit(fev.gas); auto vm = useJit ? std::unique_ptr<VMFace>(new jit::VM) : std::unique_ptr<VMFace>(new VM);
VM interpreter(fev.gas); vm->reset(fev.gas);
bytes output; bytes output;
auto outOfGas = false; auto outOfGas = false;
try try
{ {
if (useJit) output = vm->go(fev).toVector();
output = jit.go(fev).toVector();
else
output = interpreter.go(fev).toVector();
} }
catch (OutOfGas const&) catch (OutOfGas const&)
{ {
@ -540,7 +537,7 @@ void doTests(json_spirit::mValue& v, bool _fillin)
{ {
cnote << "VM did throw an exception: " << _e.what(); cnote << "VM did throw an exception: " << _e.what();
} }
auto gas = useJit ? jit.gas() : interpreter.gas(); auto gas = vm->gas();
// delete null entries in storage for the sake of comparison // delete null entries in storage for the sake of comparison