diff options
author | Christian <c@ethdev.com> | 2015-02-07 02:57:08 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2015-02-07 03:04:02 +0800 |
commit | 99ff79159323d8c2129310731d79bac4aeee824e (patch) | |
tree | ec22b01e5e260c7e73b722930c030a3bb2bf0313 | |
parent | 5bedf7f81612767f2f60ea57a1c38c34973465ec (diff) | |
download | dexon-solidity-99ff79159323d8c2129310731d79bac4aeee824e.tar dexon-solidity-99ff79159323d8c2129310731d79bac4aeee824e.tar.gz dexon-solidity-99ff79159323d8c2129310731d79bac4aeee824e.tar.bz2 dexon-solidity-99ff79159323d8c2129310731d79bac4aeee824e.tar.lz dexon-solidity-99ff79159323d8c2129310731d79bac4aeee824e.tar.xz dexon-solidity-99ff79159323d8c2129310731d79bac4aeee824e.tar.zst dexon-solidity-99ff79159323d8c2129310731d79bac4aeee824e.zip |
Accessors for structs.
-rw-r--r-- | SolidityEndToEndTest.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp index f248a5a0..301cc06e 100644 --- a/SolidityEndToEndTest.cpp +++ b/SolidityEndToEndTest.cpp @@ -959,6 +959,24 @@ BOOST_AUTO_TEST_CASE(complex_accessors) BOOST_CHECK(callContractFunction("to_multiple_map(uint256,uint256)", 42, 23) == encodeArgs(31)); } +BOOST_AUTO_TEST_CASE(struct_accessor) +{ + char const* sourceCode = R"( + contract test { + struct Data { uint a; uint8 b; mapping(uint => uint) c; bool d; } + mapping(uint => Data) public data; + function test() { + data[7].a = 1; + data[7].b = 2; + data[7].c[0] = 3; + data[7].d = true; + } + } + )"; + compileAndRun(sourceCode); + BOOST_CHECK(callContractFunction("data(uint256)", 7) == encodeArgs(1, 2, true)); +} + BOOST_AUTO_TEST_CASE(balance) { char const* sourceCode = "contract test {\n" |