Skip to content

Commit 5fa9452

Browse files
committed
Add regression tests for nondet return value generation
1 parent 20c4bc1 commit 5fa9452

File tree

8 files changed

+94
-0
lines changed

8 files changed

+94
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <assert.h>
2+
3+
const int func();
4+
5+
void main()
6+
{
7+
assert(func() == 0);
8+
assert(func() != 0);
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--generate-function-body func --generate-function-body-options nondet-return
4+
^SIGNAL=0$
5+
\[main.assertion.1\] line \d+ assertion func\(\) == 0: FAILURE
6+
\[main.assertion.2\] line \d+ assertion func\(\) != 0: FAILURE
7+
--
8+
^warning: ignoring
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include <assert.h>
2+
#include <stdlib.h>
3+
4+
int **func();
5+
6+
void main()
7+
{
8+
int **p = func();
9+
10+
assert(p != NULL);
11+
assert(*p != NULL);
12+
13+
assert(**p == 0);
14+
assert(**p != 0);
15+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
main.c
3+
--generate-function-body func --generate-function-body-options nondet-return --min-null-tree-depth 10 --max-nondet-tree-depth 5
4+
^SIGNAL=0$
5+
\[main.assertion.1\] line \d+ assertion p != .*(0|(NULL))\)?: SUCCESS
6+
\[main.assertion.2\] line \d+ assertion \*p != .*(0|(NULL))\)?: SUCCESS
7+
\[main.assertion.3\] line \d+ assertion \*\*p == 0: FAILURE
8+
\[main.assertion.4\] line \d+ assertion \*\*p != 0: FAILURE
9+
--
10+
^warning: ignoring
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include <assert.h>
2+
3+
int func();
4+
5+
void main()
6+
{
7+
assert(func() == 0);
8+
assert(func() != 0);
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--generate-function-body func --generate-function-body-options nondet-return
4+
^SIGNAL=0$
5+
\[main.assertion.1\] line \d+ assertion func\(\) == 0: FAILURE
6+
\[main.assertion.2\] line \d+ assertion func\(\) != 0: FAILURE
7+
--
8+
^warning: ignoring
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <assert.h>
2+
#include <stdlib.h>
3+
4+
typedef struct st
5+
{
6+
struct st *next;
7+
int data;
8+
} st_t;
9+
10+
st_t dummy;
11+
12+
st_t *func();
13+
14+
void main()
15+
{
16+
st_t *st = func();
17+
18+
assert(st != NULL);
19+
20+
assert(st->next != NULL);
21+
assert(st->next->next != NULL);
22+
assert(st->next->next->next == NULL);
23+
24+
assert(st != &dummy);
25+
assert(st->next != &dummy);
26+
assert(st->next->next != &dummy);
27+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--generate-function-body func --generate-function-body-options nondet-return --min-null-tree-depth 10 --max-nondet-tree-depth 3
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
VERIFICATION SUCCESSFUL
7+
--
8+
^warning: ignoring

0 commit comments

Comments
 (0)