mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
added test to check string as mapping key
This commit is contained in:
parent
625be53252
commit
ffcf18406b
@ -5182,6 +5182,22 @@ BOOST_AUTO_TEST_CASE(accessor_for_const_state_variable)
|
||||
compileAndRun(sourceCode);
|
||||
BOOST_CHECK(callContractFunction("ticketPrice()") == encodeArgs(u256(555)));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(storage_string_as_mapping_key_without_variable)
|
||||
{
|
||||
char const* sourceCode = R"(
|
||||
contract Test {
|
||||
mapping(string => uint) data;
|
||||
function f() returns (uint) {
|
||||
data["abc"] = 2;
|
||||
return data["abc"];
|
||||
}
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode, 0, "Test");
|
||||
BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(2)));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user