mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
SMTChecker: Bring back counterexample checks in regression tests
Since the default is now to ignore the counterexamples when checking test output, we bring back counterexample checks in tests where the counterexample is (mostly) deterministic.
This commit is contained in:
@@ -9,6 +9,9 @@ contract C {
|
||||
assert(x != 2); // should fail
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// SMTEngine: all
|
||||
// SMTIgnoreCex: no
|
||||
// ----
|
||||
// Warning 6328: (174-188): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (174-188): CHC: Assertion violation happens here.\nCounterexample:\nx = 2\n\nTransaction trace:\nC.constructor()\nState: x = 2\nC.g()
|
||||
// Info 1391: CHC: 1 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them.
|
||||
|
||||
@@ -17,7 +17,10 @@ contract D is C {
|
||||
assert(y == 3); // should hold
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// SMTEngine: all
|
||||
// SMTIgnoreCex: no
|
||||
// ----
|
||||
// Warning 6328: (95-109): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (180-194): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (95-109): CHC: Assertion violation happens here.\nCounterexample:\ny = 3, x = 3\n\nTransaction trace:\nD.constructor()\nState: y = 3, x = 3\nC.f()
|
||||
// Warning 6328: (180-194): CHC: Assertion violation happens here.\nCounterexample:\nx = 2\n\nTransaction trace:\nC.constructor()\nState: x = 2\nC.g()
|
||||
// Info 1391: CHC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them.
|
||||
|
||||
@@ -2,18 +2,19 @@ contract C {
|
||||
function f() public pure {
|
||||
int8 x = 1;
|
||||
int8 y = 0;
|
||||
assert(x & y != 0);
|
||||
assert(x & y != 0); // should fail
|
||||
x = -1; y = 3;
|
||||
assert(x & y == 3);
|
||||
assert(x & y == 3); // should hold
|
||||
y = -1;
|
||||
int8 z = x & y;
|
||||
assert(z == -1);
|
||||
assert(z == -1); // should hold
|
||||
y = 127;
|
||||
assert(x & y == 127);
|
||||
assert(x & y == 127); // should hold
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// SMTEngine: all
|
||||
// SMTIgnoreCex: no
|
||||
// ----
|
||||
// Warning 6328: (71-89): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (71-89): CHC: Assertion violation happens here.\nCounterexample:\n\nx = 1\ny = 0\nz = 0\n\nTransaction trace:\nC.constructor()\nC.f()
|
||||
// Info 1391: CHC: 3 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them.
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
contract C {
|
||||
function left() public pure {
|
||||
uint x = 0x4266;
|
||||
assert(x << 0x0 == 0x4266);
|
||||
// Fails because the above is true.
|
||||
assert(x << 0x0 == 0x4268);
|
||||
}
|
||||
|
||||
function right() public pure {
|
||||
uint x = 0x4266;
|
||||
assert(x >> 0x0 == 0x4266);
|
||||
// Fails because the above is true.
|
||||
assert(x >> 0x0 == 0x4268);
|
||||
}
|
||||
}
|
||||
// ====
|
||||
// SMTEngine: all
|
||||
// SMTIgnoreCex: no
|
||||
// ----
|
||||
// Warning 6328: (133-159): CHC: Assertion violation happens here.\nCounterexample:\n\nx = 16998\n\nTransaction trace:\nC.constructor()\nC.left()
|
||||
// Warning 6328: (286-312): CHC: Assertion violation happens here.\nCounterexample:\n\nx = 16998\n\nTransaction trace:\nC.constructor()\nC.right()
|
||||
// Info 1391: CHC: 2 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them.
|
||||
@@ -13,6 +13,7 @@ contract C
|
||||
}
|
||||
// ====
|
||||
// SMTEngine: all
|
||||
// SMTIgnoreCex: no
|
||||
// ----
|
||||
// Warning 6328: (161-174): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (161-174): CHC: Assertion violation happens here.\nCounterexample:\n\nx = 4\na = 3\nb = 3\n\nTransaction trace:\nC.constructor()\nC.f()
|
||||
// Info 1391: CHC: 5 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them.
|
||||
|
||||
@@ -13,6 +13,7 @@ contract C
|
||||
}
|
||||
// ====
|
||||
// SMTEngine: all
|
||||
// SMTIgnoreCex: no
|
||||
// ----
|
||||
// Warning 6328: (161-174): CHC: Assertion violation happens here.
|
||||
// Warning 6328: (161-174): CHC: Assertion violation happens here.\nCounterexample:\n\nx = 3\na = 4\nb = 4\n\nTransaction trace:\nC.constructor()\nC.f()
|
||||
// Info 1391: CHC: 5 verification condition(s) proved safe! Enable the model checker option "show proved safe" to see all of them.
|
||||
|
||||
Reference in New Issue
Block a user