mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge remote-tracking branch 'upstream/develop' into blockTests
This commit is contained in:
commit
1c10c6a547
@ -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()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1080,7 +1080,7 @@ BOOST_AUTO_TEST_CASE(enum_duplicate_values)
|
|||||||
enum ActionChoices { GoLeft, GoRight, GoLeft, Sit }
|
enum ActionChoices { GoLeft, GoRight, GoLeft, Sit }
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
|
BOOST_CHECK_THROW(parseTextAndResolveNames(text), DeclarationError);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
Loading…
Reference in New Issue
Block a user