Skip to content

Commit

Permalink
Add witness invariant test for typedefs
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Mar 1, 2024
1 parent bb1a2ae commit e4231ef
Show file tree
Hide file tree
Showing 2 changed files with 178 additions and 0 deletions.
163 changes: 163 additions & 0 deletions tests/regression/witness/typedef.t/run.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
$ goblint --enable witness.yaml.enabled --set witness.yaml.entry-types '["location_invariant"]' typedef.c
[Info][Deadcode] Logical lines of code (LLoC) summary:
live: 6
dead: 0
total lines: 6
[Info][Witness] witness generation summary:
total generation entries: 14

$ yamlWitnessStrip < witness.yml
- entry_type: location_invariant
location:
file_name: typedef.c
file_hash: $FILE_HASH
line: 14
column: 2
function: main
location_invariant:
string: x == 42
type: assertion
format: C
- entry_type: location_invariant
location:
file_name: typedef.c
file_hash: $FILE_HASH
line: 14
column: 2
function: main
location_invariant:
string: q == (void *)(& a)
type: assertion
format: C
- entry_type: location_invariant
location:
file_name: typedef.c
file_hash: $FILE_HASH
line: 14
column: 2
function: main
location_invariant:
string: p == (void *)(& x)
type: assertion
format: C
- entry_type: location_invariant
location:
file_name: typedef.c
file_hash: $FILE_HASH
line: 14
column: 2
function: main
location_invariant:
string: a.f == 43
type: assertion
format: C
- entry_type: location_invariant
location:
file_name: typedef.c
file_hash: $FILE_HASH
line: 14
column: 2
function: main
location_invariant:
string: '*((myint *)p) == 42'
type: assertion
format: C
- entry_type: location_invariant
location:
file_name: typedef.c
file_hash: $FILE_HASH
line: 14
column: 2
function: main
location_invariant:
string: ((s *)q)->f == 43
type: assertion
format: C
- entry_type: location_invariant
location:
file_name: typedef.c
file_hash: $FILE_HASH
line: 13
column: 2
function: main
location_invariant:
string: x == 42
type: assertion
format: C
- entry_type: location_invariant
location:
file_name: typedef.c
file_hash: $FILE_HASH
line: 13
column: 2
function: main
location_invariant:
string: p == (void *)(& x)
type: assertion
format: C
- entry_type: location_invariant
location:
file_name: typedef.c
file_hash: $FILE_HASH
line: 13
column: 2
function: main
location_invariant:
string: a.f == 43
type: assertion
format: C
- entry_type: location_invariant
location:
file_name: typedef.c
file_hash: $FILE_HASH
line: 13
column: 2
function: main
location_invariant:
string: '*((myint *)p) == 42'
type: assertion
format: C
- entry_type: location_invariant
location:
file_name: typedef.c
file_hash: $FILE_HASH
line: 12
column: 2
function: main
location_invariant:
string: x == 42
type: assertion
format: C
- entry_type: location_invariant
location:
file_name: typedef.c
file_hash: $FILE_HASH
line: 12
column: 2
function: main
location_invariant:
string: p == (void *)(& x)
type: assertion
format: C
- entry_type: location_invariant
location:
file_name: typedef.c
file_hash: $FILE_HASH
line: 12
column: 2
function: main
location_invariant:
string: '*((myint *)p) == 42'
type: assertion
format: C
- entry_type: location_invariant
location:
file_name: typedef.c
file_hash: $FILE_HASH
line: 9
column: 2
function: main
location_invariant:
string: x == 42
type: assertion
format: C
15 changes: 15 additions & 0 deletions tests/regression/witness/typedef.t/typedef.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
typedef int myint;

typedef struct {
int f;
} s;

int main() {
myint x = 42;
void *p = &x;

s a;
a.f = 43;
void *q = &a;
return 0;
}

0 comments on commit e4231ef

Please sign in to comment.