Isoltets SMTChecker option and BMC specific tests

This commit is contained in:
Leonardo Alt
2020-11-06 15:03:38 +00:00
parent 170cfeb1f0
commit 00858c0ccf
12 changed files with 98 additions and 24 deletions
@@ -0,0 +1,26 @@
pragma experimental SMTChecker;
contract C {
function f(uint x) public pure {
assert(x > 0);
}
function g(uint x) public pure {
require(x >= 0);
}
function h(uint x) public pure {
require(x == 2);
require(x != 2);
}
function i(uint x) public pure {
if (false) {
if (x != 2) {
}
}
}
}
// ====
// SMTEngine: bmc
// ----
// Warning 4661: (81-94): BMC: Assertion violation happens here.
// Warning 6838: (143-149): BMC: Condition is always true.
// Warning 6838: (218-224): BMC: Condition is always false.
// Warning 2512: (286-292): BMC: Condition unreachable.
@@ -0,0 +1,10 @@
pragma experimental SMTChecker;
contract C {
function f(address payable a) public {
a.transfer(200);
}
}
// ====
// SMTEngine: bmc
// ----
// Warning 1236: (87-102): BMC: Insufficient funds happens here.
@@ -0,0 +1,25 @@
pragma experimental SMTChecker;
contract C {
uint z = 1;
uint w = z - 3;
function a(uint x, uint y) public pure returns (uint) {
return x + y;
}
function s(uint x, uint y) public pure returns (uint) {
return x - y;
}
function m(uint x, uint y) public pure returns (uint) {
return x * y;
}
function d(uint x, uint y) public pure returns (uint) {
return x / y;
}
}
// ====
// SMTEngine: bmc
// ----
// Warning 2661: (141-146): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
// Warning 4144: (217-222): BMC: Underflow (resulting value less than 0) happens here.
// Warning 2661: (293-298): BMC: Overflow (resulting value larger than 2**256 - 1) happens here.
// Warning 3046: (369-374): BMC: Division by zero happens here.
// Warning 6084: (68-73): BMC: Underflow (resulting value less than 0) happens here.