From cb133837c4f27df8c9e86652358da16ecf53a924 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Thu, 11 Jun 2015 18:53:29 +0300 Subject: [PATCH] expectOut fill section to vmTests --- test/TestHelper.cpp | 2 ++ test/libevm/vm.cpp | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/test/TestHelper.cpp b/test/TestHelper.cpp index 873ea21e2..733ccb6d0 100644 --- a/test/TestHelper.cpp +++ b/test/TestHelper.cpp @@ -352,6 +352,8 @@ void ImportTest::exportTest(bytes const& _output, State const& _statePost) BOOST_CHECK_MESSAGE((m_TestObject["out"].get_str() == m_TestObject["expectOut"].get_str()), warning); else BOOST_WARN_MESSAGE((m_TestObject["out"].get_str() == m_TestObject["expectOut"].get_str()), warning); + + m_TestObject.erase(m_TestObject.find("expectOut")); } // export logs diff --git a/test/libevm/vm.cpp b/test/libevm/vm.cpp index ec66837e1..5bbab2e1c 100644 --- a/test/libevm/vm.cpp +++ b/test/libevm/vm.cpp @@ -388,6 +388,19 @@ void doVMTests(json_spirit::mValue& v, bool _fillin) o["callcreates"] = fev.exportCallCreates(); o["out"] = output.size() > 4096 ? "#" + toString(output.size()) : toHex(output, 2, HexPrefix::Add); + + // compare expected output with post output + if (o.count("expectOut") > 0) + { + std::string warning = "Check State: Error! Unexpected output: " + o["out"].get_str() + " Expected: " + o["expectOut"].get_str(); + if (Options::get().checkState) + BOOST_CHECK_MESSAGE((o["out"].get_str() == o["expectOut"].get_str()), warning); + else + BOOST_WARN_MESSAGE((o["out"].get_str() == o["expectOut"].get_str()), warning); + + o.erase(o.find("expectOut")); + } + o["gas"] = toCompactHex(fev.gas, HexPrefix::Add, 1); o["logs"] = exportLog(fev.sub.logs); }