Skip to content

Commit 360bfe1

Browse files
committed
aggressive slicer regression tests
1 parent 70d0175 commit 360bfe1

File tree

15 files changed

+329
-0
lines changed

15 files changed

+329
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// test should pass. Shortest path main -> C -> D
2+
void D()
3+
{
4+
__CPROVER_assert(0, "");
5+
}
6+
7+
void C()
8+
{
9+
int nondet;
10+
if(nondet)
11+
D();
12+
}
13+
14+
void B()
15+
{
16+
C();
17+
};
18+
19+
int main()
20+
{
21+
int nondet;
22+
23+
__CPROVER_assume(nondet != 3);
24+
switch(nondet)
25+
{
26+
case 1:
27+
B();
28+
break;
29+
case 3:
30+
C();
31+
break;
32+
default:
33+
break;
34+
}
35+
return 0;
36+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--aggressive-slice
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// test should pass. Shortest path is preserved, main -> C -> D,
2+
// but is not a possible counterexample because of assumption that
3+
// nondet != 3
4+
5+
void D()
6+
{
7+
__CPROVER_assert(0, "");
8+
}
9+
10+
void C()
11+
{
12+
int nondet;
13+
if(nondet)
14+
D();
15+
}
16+
17+
void B()
18+
{
19+
C();
20+
};
21+
22+
int main()
23+
{
24+
int nondet;
25+
26+
__CPROVER_assume(nondet != 3);
27+
switch(nondet)
28+
{
29+
case 1:
30+
B();
31+
break;
32+
case 3:
33+
C();
34+
break;
35+
default:
36+
break;
37+
}
38+
return 0;
39+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--aggressive-slice --property D.assertion.1
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// test should fail. Shortest path is preserved, main -> C -> D,
2+
void D()
3+
{
4+
__CPROVER_assert(0, "");
5+
}
6+
7+
void C()
8+
{
9+
int nondet;
10+
if(nondet)
11+
D();
12+
}
13+
14+
void B()
15+
{
16+
C();
17+
};
18+
19+
int main()
20+
{
21+
int nondet;
22+
23+
switch(nondet)
24+
{
25+
case 1:
26+
B();
27+
break;
28+
case 3:
29+
C();
30+
break;
31+
default:
32+
break;
33+
}
34+
return 0;
35+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--aggressive-slice
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
--
8+
^warning: ignoring
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// test should fail
2+
// shortest path only is not sufficient to violate assertion,
3+
// but we specifically require that function B is kept, which
4+
// allows path main -> B -> C -> D
5+
6+
void D()
7+
{
8+
__CPROVER_assert(0, "");
9+
}
10+
11+
void C()
12+
{
13+
int nondet;
14+
if(nondet)
15+
D();
16+
}
17+
18+
void B()
19+
{
20+
C();
21+
};
22+
23+
int main()
24+
{
25+
int nondet;
26+
__CPROVER_assume(nondet != 3);
27+
switch(nondet)
28+
{
29+
case 1:
30+
B();
31+
break;
32+
case 3:
33+
C();
34+
break;
35+
default:
36+
break;
37+
}
38+
return 0;
39+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--aggressive-slice --aggressive-slice-preserve-function B
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
--
8+
^warning: ignoring
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Test should fail. Shortest path only is not sufficient
2+
// due to assumption that nondet !=3, but
3+
// preserve-all-direct-paths preserves the path main -> B -> C -> D.
4+
5+
void D()
6+
{
7+
__CPROVER_assert(0, "");
8+
}
9+
10+
void C()
11+
{
12+
int nondet;
13+
if(nondet)
14+
D();
15+
}
16+
17+
void B()
18+
{
19+
C();
20+
};
21+
22+
int main()
23+
{
24+
int nondet;
25+
__CPROVER_assume(nondet != 3);
26+
switch(nondet)
27+
{
28+
case 1:
29+
B();
30+
break;
31+
case 3:
32+
C();
33+
break;
34+
default:
35+
break;
36+
}
37+
return 0;
38+
}
Binary file not shown.

0 commit comments

Comments
 (0)