mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Tests that used to give false negatives
This commit is contained in:
parent
1d63b97857
commit
2764d2f525
@ -0,0 +1,19 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// ----
|
||||||
|
// Warning: (209-223): Assertion violation happens here
|
@ -0,0 +1,18 @@
|
|||||||
|
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();
|
||||||
|
else
|
||||||
|
f();
|
||||||
|
assert(x == 1);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
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: (209-223): Assertion violation happens here
|
||||||
|
// Warning: (321-335): Assertion violation happens here
|
Loading…
Reference in New Issue
Block a user