From 6796afc2f8b441803a2c03f28271a1421935e536 Mon Sep 17 00:00:00 2001 From: chriseth Date: Sun, 29 Nov 2015 00:59:01 +0100 Subject: Bugfix for constructor unpacking with fixed-size arrays. --- test/libsolidity/SolidityEndToEndTest.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/libsolidity') diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 0b356145..5782e6c8 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -4671,6 +4671,23 @@ BOOST_AUTO_TEST_CASE(arrays_in_constructors) ); } +BOOST_AUTO_TEST_CASE(fixed_arrays_in_constructors) +{ + char const* sourceCode = R"( + contract Creator { + uint public r; + address public ch; + function Creator(address[3] s, uint x) { + r = x; + ch = s[2]; + } + } + )"; + compileAndRun(sourceCode, 0, "Creator", encodeArgs(u256(1), u256(2), u256(3), u256(4))); + BOOST_REQUIRE(callContractFunction("r()") == encodeArgs(u256(4))); + BOOST_REQUIRE(callContractFunction("ch()") == encodeArgs(u256(3))); +} + BOOST_AUTO_TEST_CASE(arrays_from_and_to_storage) { char const* sourceCode = R"( -- cgit