diff options
author | Lu Guanqun <guanqun.lu@gmail.com> | 2015-02-28 16:29:32 +0800 |
---|---|---|
committer | Lu Guanqun <guanqun.lu@gmail.com> | 2015-03-08 22:48:53 +0800 |
commit | b87c5547a5b9f307c2a0871e537a37508bc4da75 (patch) | |
tree | 118c477f7d04a343d8325b1637080e2c798a5f9f /SolidityEndToEndTest.cpp | |
parent | 7d7f9ec67f69d66fa6872072e63272a53ff30dcd (diff) | |
download | dexon-solidity-b87c5547a5b9f307c2a0871e537a37508bc4da75.tar dexon-solidity-b87c5547a5b9f307c2a0871e537a37508bc4da75.tar.gz dexon-solidity-b87c5547a5b9f307c2a0871e537a37508bc4da75.tar.bz2 dexon-solidity-b87c5547a5b9f307c2a0871e537a37508bc4da75.tar.lz dexon-solidity-b87c5547a5b9f307c2a0871e537a37508bc4da75.tar.xz dexon-solidity-b87c5547a5b9f307c2a0871e537a37508bc4da75.tar.zst dexon-solidity-b87c5547a5b9f307c2a0871e537a37508bc4da75.zip |
add test cases for functions in derived overload functions in base
Diffstat (limited to 'SolidityEndToEndTest.cpp')
-rw-r--r-- | SolidityEndToEndTest.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp index da5b29ad..fcd59e5d 100644 --- a/SolidityEndToEndTest.cpp +++ b/SolidityEndToEndTest.cpp @@ -3214,6 +3214,30 @@ BOOST_AUTO_TEST_CASE(overloaded_function_call_with_if_else) BOOST_CHECK(callContractFunction("g(bool)", false) == encodeArgs(10)); } +BOOST_AUTO_TEST_CASE(derived_overload_base_function_direct) +{ + char const* sourceCode = R"( + contract B { function f() returns(uint) { return 10; } } + contract C is B { function f(uint i) returns(uint) { return 2 * i; } } + )"; + compileAndRun(sourceCode, "C"); + BOOST_CHECK(callContractFunction("f(uint)", 1) == encodeArgs(2)); +} + +BOOST_AUTO_TEST_CASE(derived_overload_base_function_indirect) +{ + char const* sourceCode = R"( + contract A { function f(uint a) returns(uint) { return 2 * a; } } + contract B { function f() returns(uint) { return 10; } } + contract C is A, B { } + )"; + compileAndRun(sourceCode, "C"); + BOOST_CHECK(callContractFunction("f(uint)", 1) == encodeArgs(2)); + BOOST_CHECK(callContractFunction("f()") == encodeArgs(10)); +} + +BOOST_AUTO_TEST_SUITE_END() + } } } // end namespaces |