diff options
author | Christian <c@ethdev.com> | 2015-01-27 21:32:59 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2015-01-29 07:29:43 +0800 |
commit | c3cc5b737a94df8e5f2ecce17a1ca26a744c538d (patch) | |
tree | a532f70e6ca226b863235eb92187eb5357ba0e32 /SolidityEndToEndTest.cpp | |
parent | 4e67aa413e16a00c5056eb388bcf3bb011a7be57 (diff) | |
download | dexon-solidity-c3cc5b737a94df8e5f2ecce17a1ca26a744c538d.tar dexon-solidity-c3cc5b737a94df8e5f2ecce17a1ca26a744c538d.tar.gz dexon-solidity-c3cc5b737a94df8e5f2ecce17a1ca26a744c538d.tar.bz2 dexon-solidity-c3cc5b737a94df8e5f2ecce17a1ca26a744c538d.tar.lz dexon-solidity-c3cc5b737a94df8e5f2ecce17a1ca26a744c538d.tar.xz dexon-solidity-c3cc5b737a94df8e5f2ecce17a1ca26a744c538d.tar.zst dexon-solidity-c3cc5b737a94df8e5f2ecce17a1ca26a744c538d.zip |
Super keyword.
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 1ddb2273..1450095a 100644 --- a/SolidityEndToEndTest.cpp +++ b/SolidityEndToEndTest.cpp @@ -1930,6 +1930,30 @@ BOOST_AUTO_TEST_CASE(crazy_elementary_typenames_on_stack) BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(-7))); } +BOOST_AUTO_TEST_CASE(super) +{ + char const* sourceCode = R"( + contract A { function f() returns (uint r) { return 1; } } + contract B is A { function f() returns (uint r) { return super.f() | 2; } } + contract C is A { function f() returns (uint r) { return super.f() | 4; } } + contract D is B, C { function f() returns (uint r) { return super.f() | 8; } } + )"; + compileAndRun(sourceCode, 0, "D"); + BOOST_CHECK(callContractFunction("f()") == encodeArgs(1 | 2 | 4 | 8)); +} + +BOOST_AUTO_TEST_CASE(super_in_constructor) +{ + char const* sourceCode = R"( + contract A { function f() returns (uint r) { return 1; } } + contract B is A { function f() returns (uint r) { return super.f() | 2; } } + contract C is A { function f() returns (uint r) { return super.f() | 4; } } + contract D is B, C { uint data; function D() { data = super.f() | 8; } function f() returns (uint r) { return data; } } + )"; + compileAndRun(sourceCode, 0, "D"); + BOOST_CHECK(callContractFunction("f()") == encodeArgs(1 | 2 | 4 | 8)); +} + BOOST_AUTO_TEST_SUITE_END() } |