mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Forced cleanup for conversion to enum.
This commit is contained in:
parent
31425a1fc0
commit
600b38224e
@ -2519,6 +2519,21 @@ BOOST_AUTO_TEST_CASE(using_enums)
|
|||||||
BOOST_CHECK(callContractFunction("getChoice()") == encodeArgs(2));
|
BOOST_CHECK(callContractFunction("getChoice()") == encodeArgs(2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(constructing_enums_from_ints)
|
||||||
|
{
|
||||||
|
char const* sourceCode = R"(
|
||||||
|
contract c {
|
||||||
|
enum Truth { False, True }
|
||||||
|
function test() returns (uint)
|
||||||
|
{
|
||||||
|
return uint(Truth(uint8(0x701)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
compileAndRun(sourceCode);
|
||||||
|
BOOST_CHECK(callContractFunction("test()") == encodeArgs(1));
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user