Skip to content

Commit f4a6f43

Browse files
committed
Add regression tests for pre and postconditions
1 parent 8f445f9 commit f4a6f43

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
int func(int a)
2+
{
3+
__CPROVER_precondition(a > 10, "Argument should be larger than 10");
4+
int rval = a - 10;
5+
__CPROVER_postcondition(rval > 1, "Return value should be positive");
6+
return rval;
7+
}
8+
9+
int main()
10+
{
11+
int a = 11;
12+
int rval = func(a);
13+
return 0;
14+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
main.c
3+
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
--
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
void func(int a)
2+
{
3+
__CPROVER_precondition(a > 10, "Argument should be larger than 10.");
4+
}
5+
6+
int main()
7+
{
8+
int a = 10;
9+
10+
func(a);
11+
12+
return 0;
13+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
main.c
3+
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
--

0 commit comments

Comments
 (0)