diff options
author | chriseth <c@ethdev.com> | 2015-06-24 23:25:36 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-06-25 01:34:43 +0800 |
commit | 5664f62613d2bf63ba6b5d8928972d7cc6e5b255 (patch) | |
tree | bc9d5c54ef2655d7d697e4be3bb05141d146029e /libsolidity/SolidityEndToEndTest.cpp | |
parent | eede8cf2d683608dcd4e42a7a503d8a0dc5c0e3d (diff) | |
download | dexon-solidity-5664f62613d2bf63ba6b5d8928972d7cc6e5b255.tar.gz dexon-solidity-5664f62613d2bf63ba6b5d8928972d7cc6e5b255.tar.zst dexon-solidity-5664f62613d2bf63ba6b5d8928972d7cc6e5b255.zip |
Initialisation of memory types.
Diffstat (limited to 'libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r-- | libsolidity/SolidityEndToEndTest.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp index 1a32bdd6..75793abf 100644 --- a/libsolidity/SolidityEndToEndTest.cpp +++ b/libsolidity/SolidityEndToEndTest.cpp @@ -4669,6 +4669,28 @@ BOOST_AUTO_TEST_CASE(storage_array_ref) BOOST_CHECK(callContractFunction("find(uint256)", u256(400)) == encodeArgs(u256(-1))); } +BOOST_AUTO_TEST_CASE(memory_types_initialisation) +{ + char const* sourceCode = R"( + contract Test { + mapping(uint=>uint) data; + function stat() returns (uint[5]) + { + data[2] = 3; // make sure to use some memory + } + function dyn() returns (uint[]) { stat(); } + function nested() returns (uint[3][]) { stat(); } + function nestedStat() returns (uint[3][7]) { stat(); } + } + )"; + compileAndRun(sourceCode, 0, "Test"); + + BOOST_CHECK(callContractFunction("stat()") == encodeArgs(vector<u256>(5))); + BOOST_CHECK(callContractFunction("dyn()") == encodeArgs(u256(0x20), u256(0))); + BOOST_CHECK(callContractFunction("nested()") == encodeArgs(u256(0x20), u256(0))); + BOOST_CHECK(callContractFunction("nestedStat()") == encodeArgs(vector<u256>(3 * 7))); +} + BOOST_AUTO_TEST_SUITE_END() } |