add tests for state variables accessors. normal and constant

fixed the issue with accessors for constant state variables
This commit is contained in:
LianaHus
2015-08-21 17:57:57 +02:00
parent 289b814670
commit 1af8ff0121
6 changed files with 45 additions and 4 deletions
+21
View File
@@ -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()
}