diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-03-18 00:55:13 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2017-03-18 01:06:53 +0800 |
commit | 5a71e4f1a7e856960d326be1743736cc04d3c238 (patch) | |
tree | 58b83b882dc06af3339d0dc9fdc3168e8cb5e794 /test/libsolidity/SolidityEndToEndTest.cpp | |
parent | d5102c1db7cd2334e127ff684a6ecdd6aff156c6 (diff) | |
download | dexon-solidity-5a71e4f1a7e856960d326be1743736cc04d3c238.tar.gz dexon-solidity-5a71e4f1a7e856960d326be1743736cc04d3c238.tar.zst dexon-solidity-5a71e4f1a7e856960d326be1743736cc04d3c238.zip |
Add more complex tests for interfaces
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 7ef34383..8dd5042a 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -9266,6 +9266,41 @@ BOOST_AUTO_TEST_CASE(scientific_notation) BOOST_CHECK(callContractFunction("k()") == encodeArgs(u256(-25))); } +BOOST_AUTO_TEST_CASE(interface) +{ + char const* sourceCode = R"( + interface I { + event A(); + function f() returns (bool); + function() payable; + } + + contract A is I { + function f() returns (bool) { + return g(); + } + + function g() returns (bool) { + return true; + } + + function() payable { + } + } + + contract C { + function f(address _interfaceAddress) returns (bool) { + I i = I(_interfaceAddress); + return i.f(); + } + } + )"; + compileAndRun(sourceCode, 0, "A"); + u160 const recipient = m_contractAddress; + compileAndRun(sourceCode, 0, "C"); + BOOST_CHECK(callContractFunction("f(address)", recipient) == encodeArgs(true)); +} + BOOST_AUTO_TEST_SUITE_END() } |