diff options
author | chriseth <c@ethdev.com> | 2015-10-06 21:40:52 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-10-06 21:40:52 +0800 |
commit | c6e637677b724558f192eea19d10583da225b083 (patch) | |
tree | d3a27696821fd4deff40013cd03d022bc4a0f416 | |
parent | a33d173ad9cb36660400765e4e55d3ec86b558da (diff) | |
parent | 0950aa99a058752fffc1d37402275ac2187adbb4 (diff) | |
download | dexon-solidity-c6e637677b724558f192eea19d10583da225b083.tar.gz dexon-solidity-c6e637677b724558f192eea19d10583da225b083.tar.zst dexon-solidity-c6e637677b724558f192eea19d10583da225b083.zip |
Merge pull request #115 from chriseth/testLongConstructorArguments
Test long constructor arguments.
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 86caacb6..c24701d5 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -1782,6 +1782,34 @@ BOOST_AUTO_TEST_CASE(constructor_arguments_external) BOOST_CHECK(callContractFunction("getName()") == encodeArgs("abc")); } +BOOST_AUTO_TEST_CASE(constructor_with_long_arguments) +{ + char const* sourceCode = R"( + contract Main { + string public a; + string public b; + + function Main(string _a, string _b) { + a = _a; + b = _b; + } + } + )"; + string a = "01234567890123gabddunaouhdaoneudapcgadi4567890789012oneudapcgadi4567890789012oneudapcgadi4567890789012oneudapcgadi4567890789012oneudapcgadi4567890789012oneudapcgadi4567890789012oneudapcgadi4567890789012oneudapcgadi45678907890123456789abcd123456787890123456789abcd90123456789012345678901234567890123456789aboneudapcgadi4567890789012oneudapcgadi4567890789012oneudapcgadi45678907890123456789abcd123456787890123456789abcd90123456789012345678901234567890123456789aboneudapcgadi4567890789012oneudapcgadi4567890789012oneudapcgadi45678907890123456789abcd123456787890123456789abcd90123456789012345678901234567890123456789aboneudapcgadi4567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XHUDGO>PYAUTAHIACIANOTUHAOCUHAOEUNAOEHUNTHDYDHPYDRCPYDRSTITOEUBXHUDGO>PY"; + + compileAndRun(sourceCode, 0, "Main", encodeArgs( + u256(0x40), + u256(0x40 + 0x20 + ((a.length() + 31) / 32) * 32), + u256(a.length()), + a, + u256(b.length()), + b + )); + BOOST_CHECK(callContractFunction("a()") == encodeDyn(a)); + BOOST_CHECK(callContractFunction("b()") == encodeDyn(b)); +} + BOOST_AUTO_TEST_CASE(functions_called_by_constructor) { char const* sourceCode = R"( |