Check for state changes in revert() tests

This commit is contained in:
Alex Beregszaszi 2017-02-10 13:37:06 +00:00
parent f26fe5bc1c
commit 30cfad3548

View File

@ -9100,10 +9100,13 @@ BOOST_AUTO_TEST_CASE(revert)
{ {
char const* sourceCode = R"( char const* sourceCode = R"(
contract C { contract C {
uint public a = 42;
function f() { function f() {
a = 1;
revert(); revert();
} }
function g() { function g() {
a = 1;
assembly { assembly {
revert(0, 0) revert(0, 0)
} }
@ -9112,7 +9115,9 @@ BOOST_AUTO_TEST_CASE(revert)
)"; )";
compileAndRun(sourceCode, 0, "C"); compileAndRun(sourceCode, 0, "C");
BOOST_CHECK(callContractFunction("f()") == encodeArgs()); BOOST_CHECK(callContractFunction("f()") == encodeArgs());
BOOST_CHECK(callContractFunction("a()") == encodeArgs(u256(42)));
BOOST_CHECK(callContractFunction("g()") == encodeArgs()); BOOST_CHECK(callContractFunction("g()") == encodeArgs());
BOOST_CHECK(callContractFunction("a()") == encodeArgs(u256(42)));
} }
BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()