diff options
author | Liana Husikyan <liana@ethdev.com> | 2015-02-28 00:41:22 +0800 |
---|---|---|
committer | Liana Husikyan <liana@ethdev.com> | 2015-03-02 21:28:08 +0800 |
commit | 88ecc27c2b4fd88edbf3bfb283219052cf9b66da (patch) | |
tree | 029e8e5c28d848c1dbae7288a9d7b134fd1b0e9d | |
parent | d0e535d0140127baa63112f39d13c4cdd3bf1d88 (diff) | |
download | dexon-solidity-88ecc27c2b4fd88edbf3bfb283219052cf9b66da.tar dexon-solidity-88ecc27c2b4fd88edbf3bfb283219052cf9b66da.tar.gz dexon-solidity-88ecc27c2b4fd88edbf3bfb283219052cf9b66da.tar.bz2 dexon-solidity-88ecc27c2b4fd88edbf3bfb283219052cf9b66da.tar.lz dexon-solidity-88ecc27c2b4fd88edbf3bfb283219052cf9b66da.tar.xz dexon-solidity-88ecc27c2b4fd88edbf3bfb283219052cf9b66da.tar.zst dexon-solidity-88ecc27c2b4fd88edbf3bfb283219052cf9b66da.zip |
Implemented passing arguments to the base constructor.
-rw-r--r-- | SolidityEndToEndTest.cpp | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp index f305e81e..87a8eb79 100644 --- a/SolidityEndToEndTest.cpp +++ b/SolidityEndToEndTest.cpp @@ -2946,6 +2946,70 @@ BOOST_AUTO_TEST_CASE(array_copy_storage_storage_struct) BOOST_CHECK(m_state.storage(m_contractAddress).empty()); } +BOOST_AUTO_TEST_CASE(pass_dynamic_arguments_to_the_base) +{ + char const* sourceCode = R"( + contract Base { + function Base(uint i) + { + m_i = i; + } + uint public m_i; + } + contract Derived is Base(2) { + function Derived(uint i) Base(i) + {} + } + contract Final is Derived(4) { + })"; + compileAndRun(sourceCode); + BOOST_CHECK(callContractFunction("m_i()") == encodeArgs(4)); +} + +BOOST_AUTO_TEST_CASE(pass_dynamic_arguments_to_the_base_base) +{ + char const* sourceCode = R"( + contract Base { + function Base(uint j) + { + m_i = j; + } + uint public m_i; + } + contract Base1 is Base(3) { + function Base1(uint k) Base(k*k) {} + } + contract Derived is Base(3), Base1(2) { + function Derived(uint i) Base(i) Base1(i) + {} + } + contract Final is Derived(4) { + })"; + compileAndRun(sourceCode); + BOOST_CHECK(callContractFunction("m_i()") == encodeArgs(4)); +} + +BOOST_AUTO_TEST_CASE(pass_dynamic_arguments_to_the_base_base_with_gap) +{ + char const* sourceCode = R"( + contract Base { + function Base(uint i) + { + m_i = i; + } + uint public m_i; + } + contract Base1 is Base(3) {} + contract Derived is Base(2), Base1 { + function Derived(uint i) Base(i) {} + } + contract Final is Derived(4) { + })"; + compileAndRun(sourceCode); + BOOST_CHECK(callContractFunction("m_i()") == encodeArgs(4)); +} + + BOOST_AUTO_TEST_SUITE_END() } |