Merge remote-tracking branch 'upstream/develop' into blockTests

This commit is contained in:
CJentzsch 2015-02-16 07:38:49 +01:00
commit 1c10c6a547
2 changed files with 16 additions and 1 deletions

View File

@ -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()
} }

View File

@ -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()