Add uncovered test and replace uncovered tests by asserts

This commit is contained in:
Leonardo Alt
2020-11-30 18:46:47 +01:00
parent 7e7a42c6ad
commit fa561dbd0e
6 changed files with 103 additions and 100 deletions
@@ -1,7 +1,12 @@
pragma experimental SMTChecker;
contract C {
function f() public pure returns (byte) {
return (~byte(0xFF));
}
function f() public pure {
// ffff0000 in bytes4
bytes4 x = ~bytes4(hex"ffff");
assert(x == 0xffff0000); // should fail
assert(x == 0x0000ffff); // should hold
}
}
// ----
// Warning 6328: (175-198): CHC: Assertion violation happens here.
@@ -0,0 +1,10 @@
pragma experimental SMTChecker;
contract D {
function f(uint x) public pure {
assert(x**2 == 4);
}
}
// ----
// Warning 5188: (88-92): Assertion checker does not yet implement this operator.
// Warning 6328: (81-98): CHC: Assertion violation happens here.
// Warning 5188: (88-92): Assertion checker does not yet implement this operator.
@@ -0,0 +1,15 @@
pragma experimental SMTChecker;
contract D {
function f() public pure {
assert(1000000000000000000 wei == 1 ether);
assert(100000000000000000 wei == 1 ether);
assert(1000000000 wei == 1 gwei);
assert(100000000 wei == 1 gwei);
assert(1000000000 gwei == 1 ether);
assert(100000000 gwei == 1 ether);
}
}
// ----
// Warning 6328: (121-162): CHC: Assertion violation happens here.
// Warning 6328: (202-233): CHC: Assertion violation happens here.
// Warning 6328: (275-308): CHC: Assertion violation happens here.
@@ -0,0 +1,21 @@
pragma experimental SMTChecker;
contract D {
function f() public pure {
assert(1 == 1 seconds);
assert(2 == 1 seconds);
assert(2 minutes == 120 seconds);
assert(3 minutes == 120 seconds);
assert(2 hours == 120 minutes);
assert(3 hours == 120 minutes);
assert(2 days == 48 hours);
assert(4 days == 48 hours);
assert(2 weeks == 14 days);
assert(25 weeks == 14 days);
}
}
// ----
// Warning 6328: (101-123): CHC: Assertion violation happens here.
// Warning 6328: (163-195): CHC: Assertion violation happens here.
// Warning 6328: (233-263): CHC: Assertion violation happens here.
// Warning 6328: (297-323): CHC: Assertion violation happens here.
// Warning 6328: (357-384): CHC: Assertion violation happens here.