Skip to content

Commit c393197

Browse files
Regression tests for not instrumenting built-ins
1 parent e88df0b commit c393197

File tree

14 files changed

+181
-0
lines changed

14 files changed

+181
-0
lines changed
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
int main()
2+
{
3+
char a[10];
4+
__CPROVER_input("a[3]", a[3]);
5+
6+
int len = strlen(a);
7+
8+
if(len==3)
9+
{
10+
return 0;
11+
}
12+
else if(len==4)
13+
{
14+
return -1;
15+
}
16+
return 1;
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
main.c
3+
--cover location --unwind 1
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^\*\* 4 of 7 covered
7+
--
8+
^warning: ignoring
9+
^\[.*<builtin-library-
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
struct mystruct {
2+
int x;
3+
char y;
4+
};
5+
6+
int main()
7+
{
8+
struct mystruct s;
9+
char c;
10+
__CPROVER_input("c", c);
11+
12+
memset(&s,c,sizeof(struct mystruct));
13+
14+
if(s.y=='A')
15+
{
16+
return 0;
17+
}
18+
return 1;
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
main.c
3+
--cover location --unwind 10
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^\*\* 4 of 4 covered
7+
--
8+
^warning: ignoring
9+
^\[.*<builtin-library-
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include <stdio.h>
2+
3+
int main()
4+
{
5+
const char *s="test";
6+
int ret=puts(s); //return value is nondet (internal to built-in, thus non-controllable)
7+
8+
if(ret<0)
9+
{
10+
return 1;
11+
}
12+
13+
return 0;
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
main.c
3+
--cover location --unwind 10
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^\*\* 4 of 4 covered
7+
--
8+
^warning: ignoring
9+
^\[.*<builtin-library-
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
int main()
2+
{
3+
char a[10];
4+
__CPROVER_input("a[3]", a[3]);
5+
6+
int len = strlen(a);
7+
8+
if(len==3)
9+
{
10+
return 0;
11+
}
12+
else if(len==4)
13+
{
14+
return -1;
15+
}
16+
return 1;
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
main.c
3+
--cover branch --unwind 5
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^\*\* 5 of 5 covered
7+
--
8+
^warning: ignoring
9+
^\[.*<builtin-library-
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
int main()
2+
{
3+
char a[10];
4+
__CPROVER_input("a[3]", a[3]);
5+
6+
int len = strlen(a);
7+
8+
if(len==3)
9+
{
10+
return 0;
11+
}
12+
else if(len==4)
13+
{
14+
return -1;
15+
}
16+
return 1;
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
main.c
3+
--cover condition --unwind 5
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^\*\* 4 of 4 covered
7+
--
8+
^warning: ignoring
9+
^\[.*<builtin-library-
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
int main()
2+
{
3+
char a[10];
4+
__CPROVER_input("a[3]", a[3]);
5+
6+
int len = strlen(a);
7+
8+
if(len==3)
9+
{
10+
return 0;
11+
}
12+
else if(len==4)
13+
{
14+
return -1;
15+
}
16+
return 1;
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
main.c
3+
--cover decision --unwind 5
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^\*\* 4 of 4 covered
7+
--
8+
^warning: ignoring
9+
^\[.*<builtin-library-
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
int main()
2+
{
3+
char a[10];
4+
__CPROVER_input("a[3]", a[3]);
5+
6+
int len = strlen(a);
7+
8+
if(len==3)
9+
{
10+
return 0;
11+
}
12+
else if(len==4)
13+
{
14+
return -1;
15+
}
16+
return 1;
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
main.c
3+
--cover mcdc --unwind 5
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^\*\* 4 of 4 covered
7+
--
8+
^warning: ignoring
9+
^\[.*<builtin-library-

0 commit comments

Comments
 (0)