mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
small fixes per chris's comments
This commit is contained in:
parent
2f15494f83
commit
466f0e0100
@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE(exp_operator_const_signed)
|
|||||||
{
|
{
|
||||||
char const* sourceCode = R"(
|
char const* sourceCode = R"(
|
||||||
contract test {
|
contract test {
|
||||||
function f() returns(int d) { return -2 ** 3; }
|
function f() returns(int d) { return (-2) ** 3; }
|
||||||
})";
|
})";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
BOOST_CHECK(callContractFunction("f()", bytes()) == toBigEndian(u256(-8)));
|
BOOST_CHECK(callContractFunction("f()", bytes()) == toBigEndian(u256(-8)));
|
||||||
|
@ -980,16 +980,16 @@ BOOST_AUTO_TEST_CASE(exp_operator_negative_exponent)
|
|||||||
contract test {
|
contract test {
|
||||||
function f() returns(uint d) { return 2 ** -3; }
|
function f() returns(uint d) { return 2 ** -3; }
|
||||||
})";
|
})";
|
||||||
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), InternalCompilerError);
|
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(exp_operator_const_overflowed)
|
BOOST_AUTO_TEST_CASE(exp_operator_exponent_too_big)
|
||||||
{
|
{
|
||||||
char const* sourceCode = R"(
|
char const* sourceCode = R"(
|
||||||
contract test {
|
contract test {
|
||||||
function f() returns(uint d) { return 10 ** 256; }
|
function f() returns(uint d) { return 2 ** 10000000000; }
|
||||||
})";
|
})";
|
||||||
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), InternalCompilerError);
|
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_SUITE_END()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
Loading…
Reference in New Issue
Block a user