diff options
author | chriseth <chris@ethereum.org> | 2017-09-27 23:55:04 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2017-09-27 23:55:04 +0800 |
commit | acd70557ccb6e86bcbfb14197f30a285d9992d6b (patch) | |
tree | f969429db8603429e1793e00be7c7393338fa246 /test | |
parent | 2940964044331a87cbc3573fdb80fda8f0b4e976 (diff) | |
download | dexon-solidity-acd70557ccb6e86bcbfb14197f30a285d9992d6b.tar dexon-solidity-acd70557ccb6e86bcbfb14197f30a285d9992d6b.tar.gz dexon-solidity-acd70557ccb6e86bcbfb14197f30a285d9992d6b.tar.bz2 dexon-solidity-acd70557ccb6e86bcbfb14197f30a285d9992d6b.tar.lz dexon-solidity-acd70557ccb6e86bcbfb14197f30a285d9992d6b.tar.xz dexon-solidity-acd70557ccb6e86bcbfb14197f30a285d9992d6b.tar.zst dexon-solidity-acd70557ccb6e86bcbfb14197f30a285d9992d6b.zip |
Test encoder for empty structs.
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/ABIEncoderTests.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/libsolidity/ABIEncoderTests.cpp b/test/libsolidity/ABIEncoderTests.cpp index 9836eb77..af51edcc 100644 --- a/test/libsolidity/ABIEncoderTests.cpp +++ b/test/libsolidity/ABIEncoderTests.cpp @@ -462,6 +462,28 @@ BOOST_AUTO_TEST_CASE(structs) ) } +BOOST_AUTO_TEST_CASE(empty_struct) +{ + string sourceCode = R"( + contract C { + struct S { } + S s; + event e(uint16, S, uint16); + function f() returns (uint, S, uint) { + e(7, s, 8); + return (7, s, 8); + } + } + )"; + + NEW_ENCODER( + compileAndRun(sourceCode, 0, "C"); + bytes encoded = encodeArgs(7, 8); + BOOST_CHECK(callContractFunction("f()") == encoded); + REQUIRE_LOG_DATA(encoded); + ) +} + BOOST_AUTO_TEST_CASE(structs2) { string sourceCode = R"( |