diff options
author | Liana Husikyan <liana@ethdev.com> | 2015-05-08 23:50:44 +0800 |
---|---|---|
committer | Liana Husikyan <liana@ethdev.com> | 2015-05-08 23:52:09 +0800 |
commit | 37fbf06c98c263052082a8a843e26b4cae69531c (patch) | |
tree | 37be998fc42dc8a23246574d522f3d73767cd1d5 /libsolidity/SolidityEndToEndTest.cpp | |
parent | 960033de6bea1e436656ccc71b5152efd4314036 (diff) | |
download | dexon-solidity-37fbf06c98c263052082a8a843e26b4cae69531c.tar dexon-solidity-37fbf06c98c263052082a8a843e26b4cae69531c.tar.gz dexon-solidity-37fbf06c98c263052082a8a843e26b4cae69531c.tar.bz2 dexon-solidity-37fbf06c98c263052082a8a843e26b4cae69531c.tar.lz dexon-solidity-37fbf06c98c263052082a8a843e26b4cae69531c.tar.xz dexon-solidity-37fbf06c98c263052082a8a843e26b4cae69531c.tar.zst dexon-solidity-37fbf06c98c263052082a8a843e26b4cae69531c.zip |
added one more test
Diffstat (limited to 'libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r-- | libsolidity/SolidityEndToEndTest.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp index 2fd1e2ec..f32439a2 100644 --- a/libsolidity/SolidityEndToEndTest.cpp +++ b/libsolidity/SolidityEndToEndTest.cpp @@ -3939,6 +3939,61 @@ BOOST_AUTO_TEST_CASE(proper_order_of_overwriting_of_attributes) BOOST_CHECK(callContractFunction("ok()") == encodeArgs(false)); } +BOOST_AUTO_TEST_CASE(proper_overwriting_accessor_by_function) +{ + // bug #1798 + char const* sourceCode = R"( + contract attribute { + bool ok = false; + } + contract func { + function ok() returns (bool) { return true; } + } + + contract attr_func is attribute, func { + function checkOk() returns (bool) { return ok(); } + } + contract func_attr is func, attribute { + function checkOk() returns (bool) { return ok; } + } + )"; + compileAndRun(sourceCode, 0, "attr_func"); + BOOST_CHECK(callContractFunction("ok()") == encodeArgs(true)); + compileAndRun(sourceCode, 0, "func_attr"); + BOOST_CHECK(callContractFunction("checkOk()") == encodeArgs(false)); +} + + +BOOST_AUTO_TEST_CASE(overwriting_inheritance) +{ + // bug #1798 + char const* sourceCode = R"( + contract A { + function ok() returns (uint) { return 1; } + } + contract B { + function ok() returns (uint) { return 2; } + } + contract C { + uint ok = 6; + } + contract AB is A, B { + function ok() returns (uint) { return 4; } + } + contract reversedE is C, AB { + function checkOk() returns (uint) { return ok(); } + } + contract E is AB, C { + function checkOk() returns (uint) { return ok; } + } + )"; + compileAndRun(sourceCode, 0, "reversedE"); + BOOST_CHECK(callContractFunction("checkOk()") == encodeArgs(4)); + compileAndRun(sourceCode, 0, "E"); + BOOST_CHECK(callContractFunction("checkOk()") == encodeArgs(6)); +} + + BOOST_AUTO_TEST_SUITE_END() } |