aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorPaweł Bylica <chfast@gmail.com>2015-06-02 17:57:13 +0800
committerPaweł Bylica <chfast@gmail.com>2015-06-02 17:57:13 +0800
commit6a64d187803ef355dd0be22903a0e16c447b1348 (patch)
treef555ba9e1463cddf1d0750f8250968b946a51895 /libsolidity/SolidityEndToEndTest.cpp
parentbef2f9ea2cd1b09f80dcec032a2c31a4bb0f1acd (diff)
parent8f3e1cd127a75a2f877b8ef1e727d07a76f0cfa9 (diff)
downloaddexon-solidity-6a64d187803ef355dd0be22903a0e16c447b1348.tar
dexon-solidity-6a64d187803ef355dd0be22903a0e16c447b1348.tar.gz
dexon-solidity-6a64d187803ef355dd0be22903a0e16c447b1348.tar.bz2
dexon-solidity-6a64d187803ef355dd0be22903a0e16c447b1348.tar.lz
dexon-solidity-6a64d187803ef355dd0be22903a0e16c447b1348.tar.xz
dexon-solidity-6a64d187803ef355dd0be22903a0e16c447b1348.tar.zst
dexon-solidity-6a64d187803ef355dd0be22903a0e16c447b1348.zip
Merge remote-tracking branch 'upstream/develop' into feature/vm_gas_counter_refactor
Conflicts: libethereum/Executive.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()
}