Skip to content

Commit 5be5efc

Browse files
committed
[WIP] Add rudimentary tests for the exists quantifier.
1 parent 8d90822 commit 5be5efc

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <assert.h>
2+
#include <stdlib.h>
3+
4+
// clang-format off
5+
int main() {
6+
char *a = malloc(1);
7+
8+
// lots of errors with `--pointer-check` enabled
9+
assert(*a == *a);
10+
11+
// no errors even with `--pointer-check` enabled
12+
assert(
13+
__CPROVER_exists {
14+
int i ; (0 <= i && i < 1) && *(a+i) == *(a+i)
15+
}
16+
);
17+
}
18+
// clang-format on
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
test.c
3+
--pointer-check
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
--
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <assert.h>
2+
#include <stdlib.h>
3+
4+
// clang-format off
5+
int main() {
6+
char *a = malloc(1);
7+
8+
// lots of errors with `--pointer-check` enabled
9+
assert(*a == *a);
10+
11+
// no errors even with `--pointer-check` enabled
12+
assert(
13+
__CPROVER_exists {
14+
int i ; (0 <= i && i < 10) && *(a+i) == *(a+i)
15+
}
16+
);
17+
}
18+
// clang-format on
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
test.c
3+
--pointer-check
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
--
8+
--

0 commit comments

Comments
 (0)