diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-08-16 02:13:05 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-08-24 20:46:18 +0800 |
commit | e9a9a07d94d35fd9b84b16b7bd4bf8ab0b396d22 (patch) | |
tree | d48855e64eaf52aeead353677752f3e17fd0ebe7 /test/libsolidity | |
parent | 5668377c721c48f03518a02d0b3e45b5b61a52f6 (diff) | |
download | dexon-solidity-e9a9a07d94d35fd9b84b16b7bd4bf8ab0b396d22.tar dexon-solidity-e9a9a07d94d35fd9b84b16b7bd4bf8ab0b396d22.tar.gz dexon-solidity-e9a9a07d94d35fd9b84b16b7bd4bf8ab0b396d22.tar.bz2 dexon-solidity-e9a9a07d94d35fd9b84b16b7bd4bf8ab0b396d22.tar.lz dexon-solidity-e9a9a07d94d35fd9b84b16b7bd4bf8ab0b396d22.tar.xz dexon-solidity-e9a9a07d94d35fd9b84b16b7bd4bf8ab0b396d22.tar.zst dexon-solidity-e9a9a07d94d35fd9b84b16b7bd4bf8ab0b396d22.zip |
Add ABI test for pure function
Diffstat (limited to 'test/libsolidity')
-rw-r--r-- | test/libsolidity/SolidityABIJSON.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityABIJSON.cpp b/test/libsolidity/SolidityABIJSON.cpp index 12fb1f9c..dd51d926 100644 --- a/test/libsolidity/SolidityABIJSON.cpp +++ b/test/libsolidity/SolidityABIJSON.cpp @@ -361,6 +361,61 @@ BOOST_AUTO_TEST_CASE(constant_function) checkInterface(sourceCode, interface); } +BOOST_AUTO_TEST_CASE(pure_function) +{ + char const* sourceCode = R"( + contract test { + function foo(uint a, uint b) returns(uint d) { return a + b; } + function boo(uint32 a) pure returns(uint b) { return a * 4; } + } + )"; + + char const* interface = R"([ + { + "name": "foo", + "constant": false, + "payable" : false, + "statemutability": "nonpayable", + "type": "function", + "inputs": [ + { + "name": "a", + "type": "uint256" + }, + { + "name": "b", + "type": "uint256" + } + ], + "outputs": [ + { + "name": "d", + "type": "uint256" + } + ] + }, + { + "name": "boo", + "constant": true, + "payable" : false, + "statemutability": "pure", + "type": "function", + "inputs": [{ + "name": "a", + "type": "uint32" + }], + "outputs": [ + { + "name": "b", + "type": "uint256" + } + ] + } + ])"; + + checkInterface(sourceCode, interface); +} + BOOST_AUTO_TEST_CASE(events) { char const* sourceCode = R"( |