Skip to content

Commit 280e85f

Browse files
committed
Adds quantifiers regression tests for requires.
1 parent 3ca053c commit 280e85f

File tree

8 files changed

+96
-0
lines changed

8 files changed

+96
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
int f1(int *arr)
2+
__CPROVER_requires(
3+
__CPROVER_exists {int i; (0 <= i && i < 10) && arr[i] == 4}
4+
)
5+
__CPROVER_ensures(__CPROVER_return_value == 0)
6+
{
7+
return 0;
8+
}
9+
10+
int main()
11+
{
12+
int arr[10] = {0,1,2,3,4,5,6,7,8,9};
13+
f1(arr);
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
main.c
3+
--replace-all-calls-with-contracts
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
--
9+
Verification:
10+
This test asserts the preconditions of f1.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
int f1(int *arr)
2+
__CPROVER_requires(
3+
__CPROVER_exists {int i; (0 <= i && i < 10) && arr[i] == 1}
4+
)
5+
__CPROVER_ensures(__CPROVER_return_value == 0)
6+
{
7+
return 0;
8+
}
9+
10+
int main()
11+
{
12+
int arr[10] = {0,0,0,0,0,0,0,0,0,0};
13+
f1(arr);
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
main.c
3+
--replace-all-calls-with-contracts
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
--
8+
--
9+
Verification:
10+
This test asserts the preconditions of f1.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
int f1(int *arr)
2+
__CPROVER_requires(
3+
__CPROVER_forall {int i; (0 <= i && i < 10) ==> arr[i] == i}
4+
)
5+
__CPROVER_ensures(__CPROVER_return_value == 0)
6+
{
7+
return 0;
8+
}
9+
10+
int main()
11+
{
12+
int arr[10] = {0,1,2,3,4,5,6,7,8,9};
13+
f1(arr);
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
main.c
3+
--replace-all-calls-with-contracts
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
--
9+
Verification:
10+
This test asserts the preconditions of f1.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
int f1(int *arr)
2+
__CPROVER_requires(
3+
__CPROVER_forall {int i; (0 <= i && i < 10) ==> arr[i] == i}
4+
)
5+
__CPROVER_ensures(__CPROVER_return_value == 0)
6+
{
7+
return 0;
8+
}
9+
10+
int main()
11+
{
12+
int arr[10] = {-1,1,2,3,4,5,6,7,8,9};
13+
f1(arr);
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
main.c
3+
--replace-all-calls-with-contracts
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
--
8+
--
9+
Verification:
10+
This test asserts the preconditions of f1.

0 commit comments

Comments
 (0)