diff options
author | LianaHus <liana@ethdev.com> | 2015-09-17 21:15:36 +0800 |
---|---|---|
committer | LianaHus <liana@ethdev.com> | 2015-09-17 21:15:36 +0800 |
commit | e89b8d516b7e208bc67e273e174714f7f9b67b77 (patch) | |
tree | d5062550efb3a6713ea220b4107f49426fcf8596 /test | |
parent | 352c196eb37744b8054909a9801d55c672d0eb1c (diff) | |
download | dexon-solidity-e89b8d516b7e208bc67e273e174714f7f9b67b77.tar.gz dexon-solidity-e89b8d516b7e208bc67e273e174714f7f9b67b77.tar.zst dexon-solidity-e89b8d516b7e208bc67e273e174714f7f9b67b77.zip |
test
Conflicts:
test/libsolidity/SolidityEndToEndTest.cpp
Diffstat (limited to 'test')
-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() } |