Skip to content

Commit 8eb28b1

Browse files
author
Leo Alt
committed
Add SMTChecker tests with modules
1 parent 7d1df95 commit 8eb28b1

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
==== Source: A ====
2+
import "s1.sol" as M;
3+
contract D is M.C {
4+
function f(uint _y) public {
5+
g(_y);
6+
assert(x == _y); // should hold
7+
assert(x > 100); // should fail
8+
}
9+
}
10+
==== Source: s1.sol ====
11+
contract C {
12+
uint x;
13+
function g(uint _x) public {
14+
x = _x;
15+
}
16+
}
17+
// ====
18+
// SMTEngine: all
19+
// ----
20+
// Warning 6328: (A:117-132): CHC: Assertion violation happens here.\nCounterexample:\nx = 0\n_y = 0\n\nTransaction trace:\nD.constructor()\nState: x = 0\nD.f(0)\n C.g(0) -- internal call
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
==== Source: A ====
2+
import "s1.sol" as M;
3+
function f(uint _x) pure {
4+
assert(_x > 0);
5+
}
6+
contract D {
7+
function g(uint _y) public pure {
8+
M.f(200); // should hold
9+
M.f(_y); // should fail
10+
f(10); // should hold
11+
f(_y); // should fail
12+
}
13+
}
14+
==== Source: s1.sol ====
15+
function f(uint _x) pure {
16+
assert(_x > 100);
17+
}
18+
// ====
19+
// SMTEngine: all
20+
// ----
21+
// Warning 8364: (A:118-119): Assertion checker does not yet implement type module "s1.sol"
22+
// Warning 8364: (A:145-146): Assertion checker does not yet implement type module "s1.sol"
23+
// Warning 6328: (A:50-64): CHC: Assertion violation happens here.\nCounterexample:\n\n_y = 0\n\nTransaction trace:\nD.constructor()\nD.g(0)\n s1.sol:f(200) -- internal call\n s1.sol:f(0) -- internal call\n A:f(10) -- internal call\n A:f(0) -- internal call
24+
// Warning 6328: (s1.sol:28-44): CHC: Assertion violation happens here.\nCounterexample:\n\n_y = 0\n\nTransaction trace:\nD.constructor()\nD.g(0)\n s1.sol:f(200) -- internal call\n s1.sol:f(0) -- internal call
25+
// Warning 8364: (A:118-119): Assertion checker does not yet implement type module "s1.sol"
26+
// Warning 8364: (A:145-146): Assertion checker does not yet implement type module "s1.sol"

0 commit comments

Comments
 (0)