diff options
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 9c4d0c5b..803ff61a 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -5283,6 +5283,51 @@ BOOST_AUTO_TEST_CASE(simple_throw) BOOST_CHECK(callContractFunction("f(uint256)", u256(1)) == encodeArgs()); } +BOOST_AUTO_TEST_CASE(strings_in_struct) +{ + char const* sourceCode = R"( + contract buggystruct { + Buggy public bug; + + struct Buggy { + uint first; + uint second; + uint third; + string last; + } + + function buggystruct(){ + bug = Buggy(10, 20, 30, "a"); + } + function getFirst() returns (uint) + { + return bug.first; + } + function getSecond() returns (uint) + { + return bug.second; + } + function getThird() returns (uint) + { + return bug.third; + } + function getLast() returns (string) + { + return bug.last; + } + } + )"; + compileAndRun(sourceCode); + auto first = callContractFunction("getFirst()"); + BOOST_CHECK(callContractFunction("getFirst()") == encodeArgs(u256(10))); + auto second = callContractFunction("getSecond()"); + BOOST_CHECK(callContractFunction("getSecond()") == encodeArgs(u256(20))); + auto third = callContractFunction("getThird()"); + BOOST_CHECK(callContractFunction("getThird()") == encodeArgs(u256(30))); + auto last = callContractFunction("getLast()"); + BOOST_CHECK(callContractFunction("getLast()") == encodeArgs(string("a"))); +} + BOOST_AUTO_TEST_SUITE_END() } |