mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge remote-tracking branch 'upstream/develop' into addTests
This commit is contained in:
commit
8404c87477
@ -910,6 +910,28 @@ BOOST_AUTO_TEST_CASE(disallow_declaration_of_void_type)
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(overflow_caused_by_ether_units)
|
||||
{
|
||||
char const* sourceCodeFine = R"(
|
||||
contract c {
|
||||
function c ()
|
||||
{
|
||||
a = 115792089237316195423570985008687907853269984665640564039458;
|
||||
}
|
||||
uint256 a;
|
||||
})";
|
||||
BOOST_CHECK_NO_THROW(parseTextAndResolveNames(sourceCodeFine));
|
||||
char const* sourceCode = R"(
|
||||
contract c {
|
||||
function c ()
|
||||
{
|
||||
a = 115792089237316195423570985008687907853269984665640564039458 ether;
|
||||
}
|
||||
uint256 a;
|
||||
})";
|
||||
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
@ -679,6 +679,19 @@ BOOST_AUTO_TEST_CASE(literal_constants_with_ether_subdenominations)
|
||||
BOOST_CHECK_NO_THROW(parseTextExplainError(text));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(literal_constants_with_ether_subdenominations_in_expressions)
|
||||
{
|
||||
char const* text = R"(
|
||||
contract c {
|
||||
function c ()
|
||||
{
|
||||
a = 1 wei * 100 wei + 7 szabo - 3;
|
||||
}
|
||||
uint256 a;
|
||||
})";
|
||||
BOOST_CHECK_NO_THROW(parseTextExplainError(text));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user