diff options
author | chriseth <c@ethdev.com> | 2015-10-05 17:09:33 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-10-05 17:09:33 +0800 |
commit | 0950aa99a058752fffc1d37402275ac2187adbb4 (patch) | |
tree | 30796eb1ac7e279e1d48e92d4e038a07ec67373a /test/libsolidity | |
parent | 795c894afc52033a9b5cd2d9fc223a1c4a09ac1b (diff) | |
download | dexon-solidity-0950aa99a058752fffc1d37402275ac2187adbb4.tar.gz dexon-solidity-0950aa99a058752fffc1d37402275ac2187adbb4.tar.zst dexon-solidity-0950aa99a058752fffc1d37402275ac2187adbb4.zip |
Test long constructor arguments.
Diffstat (limited to 'test/libsolidity')
-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 = "01234567890123gabddunaouhdaoneudapcgadi4567890789012oneudapcgadi4567890789012oneudapcgadi4567890789012oneudapcgadi4567890789012oneudapcgadi4567890789012oneudapcgadi4567890789012oneudapcgadi4567890789012oneudapcgadi45678907890123456789abcd123456787890123456789abcd90123456789012345678901234567890123456789aboneudapcgadi4567890789012oneudapcgadi4567890789012oneudapcgadi45678907890123456789abcd123456787890123456789abcd90123456789012345678901234567890123456789aboneudapcgadi4567890789012oneudapcgadi4567890789012oneudapcgadi45678907890123456789abcd123456787890123456789abcd90123456789012345678901234567890123456789aboneudapcgadi4567890789012cdef"; + string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UTAHIACIANOTUHAOCUHAOEUNAOEHUNTHDYDHPYDRCPYDRSTITOEUBXHUDGO>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"( |