diff options
author | chriseth <c@ethdev.com> | 2016-04-16 00:41:40 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-04-16 00:42:44 +0800 |
commit | c126ec84a386da2d4412d5d5993a773cb144573e (patch) | |
tree | 6c33667897fdaf2f5f93811280058daa7b35c40b /test | |
parent | 5c3b41afb019a25a8e2784dbfa176a536d3eb03d (diff) | |
download | dexon-solidity-c126ec84a386da2d4412d5d5993a773cb144573e.tar.gz dexon-solidity-c126ec84a386da2d4412d5d5993a773cb144573e.tar.zst dexon-solidity-c126ec84a386da2d4412d5d5993a773cb144573e.zip |
Test for bug in static array constructor argument decoder.
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index a26570d3..f9d2ab2b 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -2000,6 +2000,26 @@ BOOST_AUTO_TEST_CASE(constructor_with_long_arguments) BOOST_CHECK(callContractFunction("b()") == encodeDyn(b)); } +BOOST_AUTO_TEST_CASE(constructor_static_array_argument) +{ + char const* sourceCode = R"( + contract C { + uint public a; + uint[3] public b; + + function C(uint _a, uint[3] _b) { + a = _a; + b = _b; + } + } + )"; + compileAndRun(sourceCode, 0, "C", encodeArgs(u256(1), u256(2), u256(3), u256(4))); + BOOST_CHECK(callContractFunction("a()") == encodeArgs(u256(1))); + BOOST_CHECK(callContractFunction("b(uint256)", u256(0)) == encodeArgs(u256(2))); + BOOST_CHECK(callContractFunction("b(uint256)", u256(1)) == encodeArgs(u256(3))); + BOOST_CHECK(callContractFunction("b(uint256)", u256(2)) == encodeArgs(u256(4))); +} + BOOST_AUTO_TEST_CASE(functions_called_by_constructor) { char const* sourceCode = R"( |