solidity/test/libsolidity/smtCheckerTests/functions/function_inside_branch_modify_state_var_3.sol

29 lines
473 B
Solidity

pragma experimental SMTChecker;
contract C
{
uint x;
function f() internal {
require(x < 10000);
x = x + 1;
}
function g(bool b) public {
x = 0;
if (b)
f();
// Should fail for `b == true`.
assert(x == 0);
}
function h(bool b) public {
x = 0;
if (!b)
f();
// Should fail for `b == false`.
assert(x == 0);
}
}
// ----
// Warning 4661: (209-223): Assertion violation happens here
// Warning 4661: (321-335): Assertion violation happens here