add two more exp tests

This commit is contained in:
Lu Guanqun 2015-02-09 23:15:36 +08:00
parent 3ce223c6cb
commit 2f15494f83

View File

@ -974,6 +974,24 @@ BOOST_AUTO_TEST_CASE(overflow_caused_by_ether_units)
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
}
BOOST_AUTO_TEST_CASE(exp_operator_negative_exponent)
{
char const* sourceCode = R"(
contract test {
function f() returns(uint d) { return 2 ** -3; }
})";
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), InternalCompilerError);
}
BOOST_AUTO_TEST_CASE(exp_operator_const_overflowed)
{
char const* sourceCode = R"(
contract test {
function f() returns(uint d) { return 10 ** 256; }
})";
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), InternalCompilerError);
}
BOOST_AUTO_TEST_SUITE_END()
}