aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorPaweł Bylica <chfast@gmail.com>2015-06-03 23:16:33 +0800
committerPaweł Bylica <chfast@gmail.com>2015-06-03 23:16:33 +0800
commit3bacb6f3776ffcf9cf13c1dbc733f24a430337fd (patch)
treed8a89f6d510a5b2eb52e9b1760c7b0a0b375879c /libsolidity/SolidityEndToEndTest.cpp
parent77dd832403a7f4dc11c60b25f6eec786a80c6e08 (diff)
parent0e8ce9d069b92f98fc4e96a75da11c63276b8cf7 (diff)
downloaddexon-solidity-3bacb6f3776ffcf9cf13c1dbc733f24a430337fd.tar
dexon-solidity-3bacb6f3776ffcf9cf13c1dbc733f24a430337fd.tar.gz
dexon-solidity-3bacb6f3776ffcf9cf13c1dbc733f24a430337fd.tar.bz2
dexon-solidity-3bacb6f3776ffcf9cf13c1dbc733f24a430337fd.tar.lz
dexon-solidity-3bacb6f3776ffcf9cf13c1dbc733f24a430337fd.tar.xz
dexon-solidity-3bacb6f3776ffcf9cf13c1dbc733f24a430337fd.tar.zst
dexon-solidity-3bacb6f3776ffcf9cf13c1dbc733f24a430337fd.zip
Merge remote-tracking branch 'upstream/develop' into refactor_executive
Conflicts: test/libsolidity/solidityExecutionFramework.h
Diffstat (limited to 'libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--libsolidity/SolidityEndToEndTest.cpp66
1 files changed, 64 insertions, 2 deletions
diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp
index 503615a5..9f6f27d7 100644
--- a/libsolidity/SolidityEndToEndTest.cpp
+++ b/libsolidity/SolidityEndToEndTest.cpp
@@ -4080,7 +4080,6 @@ BOOST_AUTO_TEST_CASE(struct_delete_member)
}
)";
compileAndRun(sourceCode, 0, "test");
- auto res = callContractFunction("deleteMember()");
BOOST_CHECK(callContractFunction("deleteMember()") == encodeArgs(0));
}
@@ -4106,10 +4105,73 @@ BOOST_AUTO_TEST_CASE(struct_delete_struct_in_mapping)
}
)";
compileAndRun(sourceCode, 0, "test");
- auto res = callContractFunction("deleteIt()");
BOOST_CHECK(callContractFunction("deleteIt()") == encodeArgs(0));
}
+BOOST_AUTO_TEST_CASE(evm_exceptions_out_of_band_access)
+{
+ 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_CASE(evm_exceptions_in_constructor_call_fail)
+{
+ char const* sourceCode = R"(
+ contract A {
+ function A()
+ {
+ this.call("123");
+ }
+ }
+ contract B {
+ uint public test = 1;
+ function testIt()
+ {
+ A a = new A();
+ ++test;
+ }
+ }
+ )";
+ compileAndRun(sourceCode, 0, "B");
+
+ BOOST_CHECK(callContractFunction("testIt()") == encodeArgs());
+ BOOST_CHECK(callContractFunction("test()") == encodeArgs(2));
+}
+
+BOOST_AUTO_TEST_CASE(evm_exceptions_in_constructor_out_of_baund)
+{
+ char const* sourceCode = R"(
+ contract A {
+ uint public test = 1;
+ uint[3] arr;
+ function A()
+ {
+ test = arr[5];
+ ++test;
+ }
+ }
+ )";
+ BOOST_CHECK(compileAndRunWthoutCheck(sourceCode, 0, "A").empty());
+}
+
BOOST_AUTO_TEST_SUITE_END()
}