From 74549bd60fff00dc0b01d4ba9e8ab7af43c7078b Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Tue, 19 May 2015 14:55:12 +0200 Subject: [PATCH] added test to check evm exception --- test/libsolidity/SolidityEndToEndTest.cpp | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index f8d20d70f..faa5dad4d 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -4111,6 +4111,30 @@ BOOST_AUTO_TEST_CASE(struct_delete_struct_in_mapping) BOOST_CHECK(callContractFunction("deleteIt()") == encodeArgs(0)); } +BOOST_AUTO_TEST_CASE(evm_exceptions) +{ + char const* sourceCode = R"( + contract A { + uint[3] arr; + bool public test = false; + function getElement(uint i) returns (uint) + { + return arr[i]; + } + function testIt() returns (bool) + { + uint i = this.getElement(5); + test = true; + return true; + } + } + )"; + compileAndRun(sourceCode, 0, "A"); + BOOST_CHECK(callContractFunction("test()") == encodeArgs(false)); + BOOST_CHECK(callContractFunction("testIt()") == encodeArgs()); + BOOST_CHECK(callContractFunction("test()") == encodeArgs(false)); +} + BOOST_AUTO_TEST_SUITE_END() }