solidity/test/libsolidity/smtCheckerTests/invariants/state_machine_1_fail.sol

35 lines
427 B
Solidity
Raw Normal View History

pragma experimental SMTChecker;
contract C {
uint x;
function f() public {
if (x == 0)
x = 1;
}
function g() public {
if (x == 1)
x = 2;
}
function h() public {
if (x == 2)
x = 0;
}
function j() public {
if (x < 2)
x = 100;
}
// Fails due to j.
function i() public view {
assert(x < 2);
}
}
// ====
// SMTSolvers: z3
// ----
2020-09-09 14:12:55 +00:00
// Warning 6328: (311-324): Assertion violation happens here.