Skip to content

Commit f3543c4

Browse files
peterschrammelEnrico Steffinlongo
authored and
Enrico Steffinlongo
committed
Add tests for gathering shadow memory declarations
Check that right/wrong shadow memory declarations are accepted/rejected.
1 parent d84ee18 commit f3543c4

File tree

6 files changed

+47
-0
lines changed

6 files changed

+47
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
void bad_declaration1()
2+
{
3+
__CPROVER_field_decl_local("field1", (int)0);
4+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
void bad_declaration2()
2+
{
3+
struct STRUCT
4+
{
5+
char x;
6+
} s;
7+
__CPROVER_field_decl_global("field2", s);
8+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
void good_declarations()
2+
{
3+
__CPROVER_field_decl_local("field1", (_Bool)0);
4+
__CPROVER_field_decl_global("field2", (unsigned __CPROVER_bitvector[6])0);
5+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
bad1.c
3+
--function bad_declaration1 --verbosity 10
4+
^EXIT=6$
5+
^SIGNAL=0$
6+
^A shadow memory field must not be larger than 8 bits.
7+
--
8+
--
9+
Test that a shadow memory declaration of a too large type is rejected.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
bad2.c
3+
--function bad_declaration2 --verbosity 10
4+
^EXIT=6$
5+
^SIGNAL=0$
6+
^A shadow memory field must be of a bitvector type.
7+
--
8+
--
9+
Test that a shadow memory declaration of a non-bitvector type is rejected.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
good.c
3+
--function good_declarations --verbosity 10
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
^Shadow memory: declare local field field1 of type c_bool\[8\]
8+
^Shadow memory: declare global field field2 of type unsignedbv\[6\]
9+
--
10+
^A shadow memory field must
11+
--
12+
Test that shadow memory declarations are correctly gathered.

0 commit comments

Comments
 (0)