aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-09-24 07:12:51 +0800
committerchriseth <c@ethdev.com>2015-09-24 07:12:51 +0800
commit4a2114ba35eae0a9dae5be2526d107dd19d33baf (patch)
tree93c0d7c98daf8345bb2d2572fc0ce1cbdda856bb /test
parent09f1f1e5955fc358697b49542c6c8eb42496ef10 (diff)
parentc096c3c3490176c8fa61345a38b14078a399962f (diff)
downloaddexon-solidity-4a2114ba35eae0a9dae5be2526d107dd19d33baf.tar.gz
dexon-solidity-4a2114ba35eae0a9dae5be2526d107dd19d33baf.tar.zst
dexon-solidity-4a2114ba35eae0a9dae5be2526d107dd19d33baf.zip
Merge pull request #83 from LianaHus/sol_split_the_source_tree
fixed-sized arrays as return type for functions
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 8026f216..3124f9cf 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -5325,6 +5325,35 @@ BOOST_AUTO_TEST_CASE(strings_in_struct)
BOOST_CHECK(callContractFunction("getLast()") == encodeDyn(s));
}
+BOOST_AUTO_TEST_CASE(fixed_arrays_as_return_type)
+{
+ char const* sourceCode = R"(
+ contract A {
+ function f(uint16 input) constant returns (uint16[5] arr)
+ {
+ arr[0] = input;
+ arr[1] = ++input;
+ arr[2] = ++input;
+ arr[3] = ++input;
+ arr[4] = ++input;
+ }
+ }
+ contract B {
+ function f() returns (uint16[5] res, uint16[5] res2)
+ {
+ var a = new A();
+ res = a.f(2);
+ res2 = a.f(1000);
+ }
+ }
+ )";
+ compileAndRun(sourceCode, 0, "B");
+ BOOST_CHECK(callContractFunction("f()") == encodeArgs(
+ u256(2), u256(3), u256(4), u256(5), u256(6), // first return argument
+ u256(1000), u256(1001), u256(1002), u256(1003), u256(1004)) // second return argument
+ );
+}
+
BOOST_AUTO_TEST_SUITE_END()
}