mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
add tests for state variables accessors. normal and constant
fixed the issue with accessors for constant state variables
This commit is contained in:
@@ -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()
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user