diff options
author | LianaHus <liana@ethdev.com> | 2015-08-21 23:57:57 +0800 |
---|---|---|
committer | LianaHus <liana@ethdev.com> | 2015-08-21 23:57:57 +0800 |
commit | 1af8ff01215f4d6ab5d5b3b1c4e2d1785a69c9c9 (patch) | |
tree | 8be884acdc58815c5463860c6ff147f37f548793 /test/libsolidity/SolidityEndToEndTest.cpp | |
parent | 289b8146703521943e6106e5d3f178deb0117652 (diff) | |
download | dexon-solidity-1af8ff01215f4d6ab5d5b3b1c4e2d1785a69c9c9.tar.gz dexon-solidity-1af8ff01215f4d6ab5d5b3b1c4e2d1785a69c9c9.tar.zst dexon-solidity-1af8ff01215f4d6ab5d5b3b1c4e2d1785a69c9c9.zip |
add tests for state variables accessors. normal and constant
fixed the issue with accessors for constant state variables
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index ae2fc6dc..d74fd180 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -5161,6 +5161,27 @@ BOOST_AUTO_TEST_CASE(string_as_mapping_key) ) == encodeArgs(u256(7 + i))); } +BOOST_AUTO_TEST_CASE(accessor_for_state_variable) +{ + char const* sourceCode = R"( + contract Lotto{ + uint public ticketPrice = 500; + })"; + + compileAndRun(sourceCode); + BOOST_CHECK(callContractFunction("ticketPrice()") == encodeArgs(u256(500))); +} + +BOOST_AUTO_TEST_CASE(accessor_for_const_state_variable) +{ + char const* sourceCode = R"( + contract Lotto{ + uint constant public ticketPrice = 555; + })"; + + compileAndRun(sourceCode); + BOOST_CHECK(callContractFunction("ticketPrice()") == encodeArgs(u256(555))); +} BOOST_AUTO_TEST_SUITE_END() } |