Skip to content

Commit 0c97155

Browse files
committed
Added tests for the non-terminating function case.
1 parent 2a2ce11 commit 0c97155

File tree

2 files changed

+43
-0
lines changed
  • regression/goto-analyzer/variable-sensitivity-assign-aware-merge-non-terminating-function

2 files changed

+43
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
int non_terminating(int *a, int val)
2+
{
3+
while (1)
4+
{
5+
a = val;
6+
}
7+
return a;
8+
}
9+
10+
int non_terminating_extra(int *a, int val)
11+
{
12+
while (1)
13+
{
14+
a = val;
15+
}
16+
return a;
17+
}
18+
19+
void test_non_terminating()
20+
{
21+
int one_val = 5;
22+
int second_val = 6;
23+
__CPROVER_assert(one_val==5, "one_val==5");
24+
__CPROVER_assert(second_val==6, "second_val==6");
25+
26+
non_terminating(&one_val, 10);
27+
__CPROVER_assert(one_val==10, "one_val==10");
28+
non_terminating_extra(&second_val, 12);
29+
__CPROVER_assert(second_val==12, "second_val==12");
30+
non_terminating_extra(&second_val, 13);
31+
__CPROVER_assert(second_val==13, "second_val==13");
32+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CORE
2+
main.c
3+
--function test_non_terminating --variable --pointers --arrays --structs --verify
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
[test_non_terminating.assertion.1] .* one_val==5: Success
7+
[test_non_terminating.assertion.2] .* second_val==6: Success
8+
[test_non_terminating.assertion.3] .* one_val==10: Success \(unreachable\)
9+
[test_non_terminating.assertion.4] .* second_val==12: Success \(unreachable\)
10+
[test_non_terminating.assertion.5] .* second_val==13: Success \(unreachable\)
11+
--

0 commit comments

Comments
 (0)