diff options
author | chriseth <c@ethdev.com> | 2015-11-24 21:54:18 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-11-24 21:54:18 +0800 |
commit | 588e4232eb55d501aea5c7bff513843815b0fd52 (patch) | |
tree | 669ba7ce6db11f196160a7a0b9fc2cd835780b83 /test/libsolidity/SolidityEndToEndTest.cpp | |
parent | 2554d6104a491e586ecad9cf7fe31949dc46e968 (diff) | |
download | dexon-solidity-588e4232eb55d501aea5c7bff513843815b0fd52.tar.gz dexon-solidity-588e4232eb55d501aea5c7bff513843815b0fd52.tar.zst dexon-solidity-588e4232eb55d501aea5c7bff513843815b0fd52.zip |
Test for allocation bug.
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 20fef48d..93b42c51 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -5849,6 +5849,37 @@ BOOST_AUTO_TEST_CASE(addmod_mulmod) compileAndRun(sourceCode); BOOST_CHECK(callContractFunction("test()") == encodeArgs(u256(0))); } + +BOOST_AUTO_TEST_CASE(string_allocation_bug) +{ + char const* sourceCode = R"( + contract Sample + { + struct s { uint16 x; uint16 y; string a; string b;} + s[2] public p; + function Sample() { + s memory m; + m.x = 0xbbbb; + m.y = 0xcccc; + m.a = "hello"; + m.b = "world"; + p[0] = m; + } + } + )"; + compileAndRun(sourceCode); + BOOST_CHECK(callContractFunction("p(uint256)") == encodeArgs( + u256(0xbbbb), + u256(0xcccc), + u256(0x80), + u256(0xc0), + u256(5), + string("hello"), + u256(5), + string("world") + )); +} + BOOST_AUTO_TEST_SUITE_END() } |