test: add a test conerting an enum into another enum, which should fail

This commit is contained in:
Yoichi Hirai 2016-11-09 15:53:00 +01:00
parent 0a6c937dcb
commit 4b6e7e0677
No known key found for this signature in database
GPG Key ID: E7B75D080FCF7992

View File

@ -1535,6 +1535,21 @@ BOOST_AUTO_TEST_CASE(enum_implicit_conversion_is_not_okay)
BOOST_CHECK(expectError(text) == Error::Type::TypeError);
}
BOOST_AUTO_TEST_CASE(enum_to_enum_conversion_is_not_okay)
{
char const* text = R"(
contract test {
enum Paper { Up, Down, Left, Right }
enum Ground { North, South, West, East }
function test()
{
Ground(Paper.Up);
}
}
)";
BOOST_CHECK(expectError(text) == Error::Type::TypeError);
}
BOOST_AUTO_TEST_CASE(enum_duplicate_values)
{
char const* text = R"(