Skip to content

Commit cd90dfe

Browse files
committed
Add test for synthetic YAML witness invariant locations (PR #758)
1 parent 5959095 commit cd90dfe

File tree

2 files changed

+53
-0
lines changed

2 files changed

+53
-0
lines changed

tests/regression/pr-758.t/pr-758.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Code from https://github.com/goblint/cil/pull/98
2+
3+
int main() {
4+
// for loop
5+
int x = 42;
6+
for (x = 0; x < 10; x++) { // there shouldn't be invariants x <= 9, x <= 10 and 0 <= x before this line
7+
// ...
8+
}
9+
10+
// expression with side effect
11+
int i, k;
12+
i = k = 0; // there shouldn't be invariant k == 0 before this line
13+
14+
// compound initializers
15+
struct kala {
16+
int kaal;
17+
int hind;
18+
};
19+
20+
struct kala a = {2, 3}; // there shouldn't be invariant a.kaal == 2 before this line
21+
return 0;
22+
}

tests/regression/pr-758.t/run.t

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
$ goblint --enable ana.int.interval --enable witness.yaml.enabled pr-758.c
2+
[Info][Deadcode] Logical lines of code (LLoC) summary:
3+
live: 6
4+
dead: 0
5+
total: 6
6+
[Info][Witness] witness generation summary:
7+
total: 2
8+
9+
$ yamlWitnessStrip < witness.yml
10+
- entry_type: loop_invariant
11+
location:
12+
file_name: pr-758.c
13+
file_hash: $STRIPPED_FILE_HASH
14+
line: 21
15+
column: 2
16+
function: main
17+
loop_invariant:
18+
string: a.hind == 3
19+
type: assertion
20+
format: C
21+
- entry_type: loop_invariant
22+
location:
23+
file_name: pr-758.c
24+
file_hash: $STRIPPED_FILE_HASH
25+
line: 20
26+
column: 14
27+
function: main
28+
loop_invariant:
29+
string: i == 0
30+
type: assertion
31+
format: C

0 commit comments

Comments
 (0)