solidity/test/libsolidity/smtCheckerTests/unchecked/inc_dec.sol

27 lines
485 B
Solidity
Raw Normal View History

2020-12-16 17:32:34 +00:00
contract C {
function o() public pure {
uint x = type(uint).max;
unchecked { ++x; }
assert(x == type(uint).min);
}
function u() public pure {
uint x = type(uint).min;
unchecked { --x; }
assert(x == type(uint).max);
}
function o_int() public pure {
int x = type(int).max;
unchecked { ++x; }
assert(x == type(int).min);
}
function u_int() public pure {
int x = type(int).min;
unchecked { --x; }
assert(x == type(int).max);
}
}
2021-03-31 15:11:54 +00:00
// ====
// SMTEngine: all