diff options
author | Liana Husikyan <liana@ethdev.com> | 2015-03-31 17:07:10 +0800 |
---|---|---|
committer | Liana Husikyan <liana@ethdev.com> | 2015-04-08 21:56:35 +0800 |
commit | a33564fbccf2829cb591bbf8b8df42a456566e16 (patch) | |
tree | cc19396092af1e87653dfd65894a7fdf753835a0 /SolidityEndToEndTest.cpp | |
parent | 32ae2ea75c2eaf6a4bfa1d28f5e8c7c8c9ca5746 (diff) | |
download | dexon-solidity-a33564fbccf2829cb591bbf8b8df42a456566e16.tar.gz dexon-solidity-a33564fbccf2829cb591bbf8b8df42a456566e16.tar.zst dexon-solidity-a33564fbccf2829cb591bbf8b8df42a456566e16.zip |
some more tests
Diffstat (limited to 'SolidityEndToEndTest.cpp')
-rw-r--r-- | SolidityEndToEndTest.cpp | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp index 3c4c2bc0..1b7f4129 100644 --- a/SolidityEndToEndTest.cpp +++ b/SolidityEndToEndTest.cpp @@ -969,14 +969,41 @@ BOOST_AUTO_TEST_CASE(simple_accessor) BOOST_AUTO_TEST_CASE(array_accessor) { char const* sourceCode = R"( + contract test { + uint[8] data; + uint[] dynamicData; + function test() { + data[2] = 8; + dynamicData.length = 3; + dynamicData[2] = 8; + } + } + )"; + compileAndRun(sourceCode); + BOOST_CHECK(callContractFunction("data(uint256)", 2) == encodeArgs(8)); + BOOST_CHECK(callContractFunction("data(uint256)", 8) == encodeArgs()); + BOOST_CHECK(callContractFunction("dynamicData(uint256)", 2) == encodeArgs(8)); + BOOST_CHECK(callContractFunction("dynamicData(uint256)", 8) == encodeArgs()); +} + +BOOST_AUTO_TEST_CASE(accessors_mapping_for_array) +{ + char const* sourceCode = R"( contract test { - uint[8] datas; - function test() { - datas[2] = 8; - } - })"; + mapping(uint => uint[8]) data; + mapping(uint => uint[]) dynamicData; + function test() { + data[2][2] = 8; + dynamicData[2].length = 3; + dynamicData[2][2] = 8; + } + } + )"; compileAndRun(sourceCode); - BOOST_CHECK(callContractFunction("data(2)") == encodeArgs(8)); + BOOST_CHECK(callContractFunction("data(uint256,uint256)", 2, 2) == encodeArgs(8)); + BOOST_CHECK(callContractFunction("data(uint256, 256)", 2, 8) == encodeArgs()); + BOOST_CHECK(callContractFunction("dynamicData(uint256,uint256)", 2, 2) == encodeArgs(8)); + BOOST_CHECK(callContractFunction("dynamicData(uint256,uint256)", 2, 8) == encodeArgs()); } BOOST_AUTO_TEST_CASE(multiple_elementary_accessors) |