From 626a57826cd46c25f78cc5cf22e828b3a21b419c Mon Sep 17 00:00:00 2001 From: LianaHus Date: Tue, 25 Aug 2015 17:41:23 +0200 Subject: test --- test/libsolidity/SolidityEndToEndTest.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test') diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index c56845aa..43a5043d 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -5262,6 +5262,23 @@ BOOST_AUTO_TEST_CASE(library_stray_values) BOOST_CHECK(callContractFunction("f(uint256)", u256(33)) == encodeArgs(u256(42))); } +BOOST_AUTO_TEST_CASE(array_out_of_bound_access) +{ + char const* sourceCode = R"( + contract c { + uint[4] data; + function set(uint index) returns (bool) { + data[index] = 2; + return true; + } + } + )"; +// compileAndRun(sourceCode, 0, "Test"); +// BOOST_CHECK(callContractFunction("set()", u256(7)) == encodeArgs(false)); +// BOOST_CHECK(callContractFunction("set()", u256(3)) == encodeArgs(true)); + compileRequireThrow(sourceCode); +} + BOOST_AUTO_TEST_SUITE_END() } -- cgit