Skip to content

Commit ef99071

Browse files
committed
--vsd-flow-insensitive regression tests
1 parent d114bf7 commit ef99071

File tree

8 files changed

+112
-0
lines changed

8 files changed

+112
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <assert.h>
2+
3+
int fun(int other)
4+
{
5+
if(other > 0)
6+
{
7+
int value = fun(other - 1);
8+
return value + 1;
9+
}
10+
else
11+
{
12+
return 0;
13+
}
14+
}
15+
16+
int main(int argc, char *argv[])
17+
{
18+
int z = fun(0);
19+
assert(z == 0); // Unknown as flow-insensitive fails to stop the recursive case being explored
20+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--variable-sensitivity --vsd-flow-insensitive --verify
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^\[main\.assertion\.1\] .* assertion z == 0: UNKNOWN$
7+
--
8+
^warning: ignoring
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <assert.h>
2+
3+
int main(int argc, char *argv[])
4+
{
5+
int y = 1;
6+
int z;
7+
if(y)
8+
{
9+
assert(y != 0);
10+
z = 1;
11+
}
12+
else
13+
{
14+
assert(y == 0);
15+
z = 0;
16+
}
17+
assert(z == 1);
18+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
main.c
3+
--variable-sensitivity --vsd-flow-insensitive --verify
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^\[main\.assertion\.1\] .* assertion y != 0: SUCCESS$
7+
^\[main\.assertion\.2\] .* assertion y == 0: FAILURE \(if reachable\)$
8+
^\[main\.assertion\.3\] .* assertion z == 1: UNKNOWN$
9+
--
10+
^warning: ignoring
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <assert.h>
2+
3+
int fun(int other)
4+
{
5+
if(other > 0)
6+
{
7+
int value = fun(other - 1);
8+
return value + 1;
9+
}
10+
else
11+
{
12+
return 0;
13+
}
14+
}
15+
16+
int main(int argc, char *argv[])
17+
{
18+
int z = fun(0);
19+
assert(z == 0); // Success because flow-sensitivity blocks the branch
20+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--variable-sensitivity --verify
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^\[main\.assertion\.1\] .* assertion z == 0: SUCCESS$
7+
--
8+
^warning: ignoring
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <assert.h>
2+
3+
int main(int argc, char *argv[])
4+
{
5+
int y = 1;
6+
int z;
7+
if(y)
8+
{
9+
assert(y != 0);
10+
z = 1;
11+
}
12+
else
13+
{
14+
assert(y == 0);
15+
z = 0;
16+
}
17+
assert(z == 1);
18+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
main.c
3+
--variable-sensitivity --verify
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^\[main\.assertion\.1\] .* assertion y != 0: SUCCESS$
7+
^\[main\.assertion\.2\] .* assertion y == 0: SUCCESS \(unreachable\)$
8+
^\[main\.assertion\.3\] .* assertion z == 1: SUCCESS$
9+
--
10+
^warning: ignoring

0 commit comments

Comments
 (0)