diff options
author | chriseth <chris@ethereum.org> | 2017-11-24 02:14:35 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2017-11-30 00:08:44 +0800 |
commit | 9d8e3ff395006c0c6285f70c13bd470e9374bda3 (patch) | |
tree | 8d110928ee4acb9b5d4c44470470950aa685295b /test | |
parent | 5a3dbb0269b3ff6b443a3cb4ccfc4f00eaba26b4 (diff) | |
download | dexon-solidity-9d8e3ff395006c0c6285f70c13bd470e9374bda3.tar dexon-solidity-9d8e3ff395006c0c6285f70c13bd470e9374bda3.tar.gz dexon-solidity-9d8e3ff395006c0c6285f70c13bd470e9374bda3.tar.bz2 dexon-solidity-9d8e3ff395006c0c6285f70c13bd470e9374bda3.tar.lz dexon-solidity-9d8e3ff395006c0c6285f70c13bd470e9374bda3.tar.xz dexon-solidity-9d8e3ff395006c0c6285f70c13bd470e9374bda3.tar.zst dexon-solidity-9d8e3ff395006c0c6285f70c13bd470e9374bda3.zip |
Also test short input for old decoder.
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/ABIDecoderTests.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/test/libsolidity/ABIDecoderTests.cpp b/test/libsolidity/ABIDecoderTests.cpp index c0c017e4..15c04b37 100644 --- a/test/libsolidity/ABIDecoderTests.cpp +++ b/test/libsolidity/ABIDecoderTests.cpp @@ -449,11 +449,13 @@ BOOST_AUTO_TEST_CASE(short_input_value_type) function f(uint a, uint b) public pure returns (uint) { return a; } } )"; - NEW_ENCODER( + bool newDecoder = false; + BOTH_ENCODERS( compileAndRun(sourceCode); ABI_CHECK(callContractFunction("f(uint256,uint256)", 1, 2), encodeArgs(1)); ABI_CHECK(callContractFunctionNoEncoding("f(uint256,uint256)", bytes(64, 0)), encodeArgs(0)); - ABI_CHECK(callContractFunctionNoEncoding("f(uint256,uint256)", bytes(63, 0)), encodeArgs()); + ABI_CHECK(callContractFunctionNoEncoding("f(uint256,uint256)", bytes(63, 0)), newDecoder ? encodeArgs() : encodeArgs(0)); + newDecoder = true; ) } @@ -464,13 +466,15 @@ BOOST_AUTO_TEST_CASE(short_input_array) function f(uint[] a) public pure returns (uint) { return 7; } } )"; - NEW_ENCODER( + bool newDecoder = false; + BOTH_ENCODERS( compileAndRun(sourceCode); ABI_CHECK(callContractFunctionNoEncoding("f(uint256[])", encodeArgs(0x20, 0)), encodeArgs(7)); - ABI_CHECK(callContractFunctionNoEncoding("f(uint256[])", encodeArgs(0x20, 1)), encodeArgs()); - ABI_CHECK(callContractFunctionNoEncoding("f(uint256[])", encodeArgs(0x20, 1) + bytes(31, 0)), encodeArgs()); + ABI_CHECK(callContractFunctionNoEncoding("f(uint256[])", encodeArgs(0x20, 1)), newDecoder ? encodeArgs() : encodeArgs(7)); + ABI_CHECK(callContractFunctionNoEncoding("f(uint256[])", encodeArgs(0x20, 1) + bytes(31, 0)), newDecoder ? encodeArgs() : encodeArgs(7)); ABI_CHECK(callContractFunctionNoEncoding("f(uint256[])", encodeArgs(0x20, 1) + bytes(32, 0)), encodeArgs(7)); ABI_CHECK(callContractFunctionNoEncoding("f(uint256[])", encodeArgs(0x20, 2, 5, 6)), encodeArgs(7)); + newDecoder = true; ) } |