diff options
author | Lefteris Karapetsas <lefteris@refu.co> | 2015-02-01 09:41:14 +0800 |
---|---|---|
committer | Lefteris Karapetsas <lefteris@refu.co> | 2015-02-01 09:41:14 +0800 |
commit | 33f86b8af3add9c8988ad9ec1ae874cf937e2e35 (patch) | |
tree | de4d019fb59e4fc3b1e5e296260e6dad552653a3 | |
parent | c742c09ae6d0dad39f5cbbc33e54aa7d182c85f5 (diff) | |
download | dexon-solidity-33f86b8af3add9c8988ad9ec1ae874cf937e2e35.tar dexon-solidity-33f86b8af3add9c8988ad9ec1ae874cf937e2e35.tar.gz dexon-solidity-33f86b8af3add9c8988ad9ec1ae874cf937e2e35.tar.bz2 dexon-solidity-33f86b8af3add9c8988ad9ec1ae874cf937e2e35.tar.lz dexon-solidity-33f86b8af3add9c8988ad9ec1ae874cf937e2e35.tar.xz dexon-solidity-33f86b8af3add9c8988ad9ec1ae874cf937e2e35.tar.zst dexon-solidity-33f86b8af3add9c8988ad9ec1ae874cf937e2e35.zip |
Code generation for mapping state variable accessor
- Work in progress
-rw-r--r-- | SolidityEndToEndTest.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp index 7edc250c..63a8ebcd 100644 --- a/SolidityEndToEndTest.cpp +++ b/SolidityEndToEndTest.cpp @@ -919,6 +919,24 @@ BOOST_AUTO_TEST_CASE(multiple_elementary_accessors) BOOST_CHECK(callContractFunction("super_secret_data()") == bytes()); } +BOOST_AUTO_TEST_CASE(complex_accessors) +{ + char const* sourceCode = "contract test {\n" + " mapping(uint256 => string4) to_string_map;\n" + " mapping(uint256 => bool) to_bool_map;\n" + " mapping(uint256 => uint256) to_uint_map;\n" + " function test() {\n" + " to_string_map[42] = \"24\";\n" + " to_bool_map[42] = false;\n" + " to_uint_map[42] = 12;\n" + " }\n" + "}\n"; + compileAndRun(sourceCode); + BOOST_CHECK(callContractFunction("to_string_map(uint256)", 42) == encodeArgs("24")); + BOOST_CHECK(callContractFunction("to_bool_map(uint256)", 42) == encodeArgs(false)); + BOOST_CHECK(callContractFunction("to_uint_map(uint256)", 42) == encodeArgs(12)); +} + BOOST_AUTO_TEST_CASE(balance) { char const* sourceCode = "contract test {\n" |