diff options
author | chriseth <c@ethdev.com> | 2017-01-24 19:44:49 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-09-16 19:12:43 +0800 |
commit | 2e72bd163a149183c119ca9664b98b0c5473da41 (patch) | |
tree | c21a611b03f2ba123b9b86604ee31558d9454df7 /test/libsolidity/SolidityEndToEndTest.cpp | |
parent | a0d171722a211720773aae0ded8a80991d44ba9d (diff) | |
download | dexon-solidity-2e72bd163a149183c119ca9664b98b0c5473da41.tar.gz dexon-solidity-2e72bd163a149183c119ca9664b98b0c5473da41.tar.zst dexon-solidity-2e72bd163a149183c119ca9664b98b0c5473da41.zip |
Allow structs as part of function interfaces.
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index ea924fcb..6ea02673 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -9682,6 +9682,47 @@ BOOST_AUTO_TEST_CASE(contracts_separated_with_comment) compileAndRun(sourceCode, 0, "C2"); } +BOOST_AUTO_TEST_CASE(return_structs) +{ + char const* sourceCode = R"( + contract C { + struct S { uint a; T[] sub; } + struct T { uint[2] x; } + function f() returns (uint x, S s) { + x = 7; + s.a = 8; + s.sub = new S[](3); + s.sub[0][0] = 9; + s.sub[1][0] = 10; + s.sub[2][1] = 11; + } + } + )"; + compileAndRun(sourceCode, 0, "C"); + +// Will calculate the exact encoding later. +// BOOST_CHECK(callContractFunction("f()") == encodeArgs( +// u256(7), u256(0x40), +// u256(8), u256(0x40), +// u256(3), +// // s.sub[0] +// u256(9), u256(0xc0), +// // s.sub[1] +// u256(10), u256(0xe0), +// // s.sub[2] +// u256(11), u256(0x100), +// // s.sub[0].sub +// u256(2) +// // s.sub[0].sub[0].a +// u256(8), +// u256() +// // s.sub[1].sub +// u256(0) +// // s.sub[2].sub +// u256(2) +// )); +} + BOOST_AUTO_TEST_CASE(include_creation_bytecode_only_once) { char const* sourceCode = R"( |