Skip to content

Commit 1986ddf

Browse files
committed
Refined test cases, on nested loops, for the unwind option of goto-instrument.
1 parent d6ec0ab commit 1986ddf

File tree

7 files changed

+148
-0
lines changed

7 files changed

+148
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
void f() {}
3+
void f2() {}
4+
5+
int main()
6+
{
7+
/**
8+
* This is a test case for the unwind operation of goto-instrument;
9+
* every loop will be unwound K times
10+
**/
11+
const unsigned K=10;
12+
13+
const unsigned n=100;
14+
unsigned c=0, i;
15+
16+
for(i=1; i<=n; i++)
17+
{
18+
f();
19+
c++;
20+
21+
// the nested loop
22+
unsigned j, c2=0;
23+
for(j=1; j<=i; j++)
24+
{
25+
f2();
26+
c2++;
27+
}
28+
unsigned eva2=i;
29+
if(K<eva2) eva2=K;
30+
31+
__CPROVER_assert(c2==eva2, "Nested loops unwind (1): the inner one");
32+
33+
}
34+
35+
unsigned eva=n;
36+
if(K<eva) eva=K;
37+
38+
__CPROVER_assert(c==eva, "Nested loops unwind (1)");
39+
40+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
aclwdrr002.c
3+
POWER OPT
4+
^SIGNAL=0$
5+
^VERIFICATION FAILED$
6+
--
7+
^warning: ignoring
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
void f() {}
3+
void f2() {}
4+
5+
int main()
6+
{
7+
/**
8+
* This is a test case for the unwind operation of goto-instrument;
9+
* every loop will be unwound K times
10+
**/
11+
const unsigned K=10;
12+
13+
const unsigned n=100;
14+
unsigned c=0, i;
15+
16+
for(i=1; i<=n; i++)
17+
{
18+
f();
19+
c++;
20+
21+
// the nested loop
22+
unsigned j, c2=0;
23+
for(j=1; j<=i; j++)
24+
{
25+
f2();
26+
c2++;
27+
}
28+
unsigned eva2=i;
29+
if(K<eva2) eva2=K;
30+
31+
__CPROVER_assert(c2==eva2, "Nested loops unwind (1): the inner one");
32+
33+
}
34+
35+
unsigned eva=n;
36+
if(K<eva) eva=K;
37+
38+
__CPROVER_assert(c==eva, "Nested loops unwind (1)");
39+
40+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
main.c
3+
10
4+
^SIGNAL=0$
5+
^VERIFICATION SUCCESSFUL$
6+
--
7+
^warning: ignoring
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
aclwdrr002.c
3+
POWER OPT
4+
^SIGNAL=0$
5+
^VERIFICATION FAILED$
6+
--
7+
^warning: ignoring
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
void f() {}
3+
void f2() {}
4+
5+
int main()
6+
{
7+
/**
8+
* This is a test case for the unwind operation of goto-instrument;
9+
* every loop will be unwound K times
10+
**/
11+
const unsigned K=10;
12+
13+
const unsigned n=6;
14+
unsigned c=0, i;
15+
16+
for(i=1; i<=n; i++)
17+
{
18+
f();
19+
c++;
20+
21+
// the nested loop
22+
unsigned j, c2=0;
23+
for(j=1; j<=i; j++)
24+
{
25+
f2();
26+
c2++;
27+
}
28+
unsigned eva2=i;
29+
if(K<eva2) eva2=K;
30+
31+
__CPROVER_assert(c2==eva2, "Nested loops unwind (2): the inner one");
32+
33+
}
34+
35+
unsigned eva=n;
36+
if(K<eva) eva=K;
37+
38+
__CPROVER_assert(c==eva, "Nested loops unwind (2)");
39+
40+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
main.c
3+
10
4+
^SIGNAL=0$
5+
^VERIFICATION SUCCESSFUL$
6+
--
7+
^warning: ignoring

0 commit comments

Comments
 (0)