mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
test: add a test case for #1343
The test witnesses that #1334 fixes #1343.
This commit is contained in:
parent
1af3c4f754
commit
08a889a908
@ -3355,12 +3355,18 @@ BOOST_AUTO_TEST_CASE(enum_explicit_overflow)
|
||||
choice = ActionChoices(x);
|
||||
d = uint256(choice);
|
||||
}
|
||||
function getChoiceFromSigned(int x) returns (uint d)
|
||||
{
|
||||
choice = ActionChoices(x);
|
||||
d = uint256(choice);
|
||||
}
|
||||
ActionChoices choice;
|
||||
}
|
||||
)";
|
||||
compileAndRun(sourceCode);
|
||||
// These should throw
|
||||
BOOST_CHECK(callContractFunction("getChoiceExp(uint256)", 3) == encodeArgs());
|
||||
BOOST_CHECK(callContractFunction("getChoiceFromSigned(int256)", -1) == encodeArgs());
|
||||
// These should work
|
||||
BOOST_CHECK(callContractFunction("getChoiceExp(uint256)", 2) == encodeArgs(2));
|
||||
BOOST_CHECK(callContractFunction("getChoiceExp(uint256)", 0) == encodeArgs(0));
|
||||
|
Loading…
Reference in New Issue
Block a user