Skip to content

Commit e2dca8a

Browse files
committed
Add regression test using __CPROVER_POINTER_OBJECT directly
1 parent ac0bb15 commit e2dca8a

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#define NULL (void *)0
2+
3+
int main()
4+
{
5+
int foo;
6+
7+
// The identifiers are allocated deterministically, so we want to check the
8+
// following properties hold:
9+
10+
// The pointer object of NULL is always going to be zero.
11+
__CPROVER_assert(
12+
__CPROVER_POINTER_OBJECT(NULL) != 0,
13+
"expected to fail with object ID == 0");
14+
// In the case where the program contains a single address of operation,
15+
// the pointer object is going to be 1.
16+
__CPROVER_assert(
17+
__CPROVER_POINTER_OBJECT(&foo) != 1,
18+
"expected to fail with object ID == 1");
19+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
CORE
2+
pointer_object3.c
3+
4+
\[main\.assertion\.1] line \d+ expected to fail with object ID == 0: FAILURE
5+
\[main\.assertion\.2] line \d+ expected to fail with object ID == 1: FAILURE
6+
^VERIFICATION FAILED$
7+
^EXIT=10$
8+
^SIGNAL=0$
9+
--
10+
--
11+
Test that the assignment of object IDs to objects is deterministic:
12+
* 0 for the NULL object, and
13+
* 1 for the single object which is the result of an address of operation

0 commit comments

Comments
 (0)