File tree Expand file tree Collapse file tree 13 files changed +84
-9
lines changed Expand file tree Collapse file tree 13 files changed +84
-9
lines changed Original file line number Diff line number Diff line change 1
- #include <assert.h>
1
+ // function_apply_01
2
2
3
- // Note that this is supposed to have an incorrect contract.
3
+ // Note that this test is supposed to have an incorrect contract.
4
4
// We verify that applying (without checking) the contract yields success,
5
5
// and that checking the contract yields failure.
6
+
7
+ #include <assert.h>
8
+
6
9
int foo ()
7
10
__CPROVER_ensures (__CPROVER_return_value == 0 )
8
11
{
Original file line number Diff line number Diff line change
1
+ // function_check_01
2
+
3
+ // This tests a simple example of a function with requires and
4
+ // ensures which should both be satisfied.
5
+
1
6
#include <assert.h>
2
7
3
8
int min (int a , int b )
Original file line number Diff line number Diff line change
1
+ // function_check_02
2
+
3
+ // This test checks the use of quantifiers in ensures clauses.
4
+ // A known bug causes the use of quantifiers in ensures to fail.
5
+
1
6
int initialize (int * arr )
2
7
__CPROVER_ensures (
3
8
__CPROVER_forall {int i ; (0 <= i && i < 10 ) == > arr [i ] == i }
Original file line number Diff line number Diff line change
1
+ // function_check_03
2
+
3
+ // This extends function_check_02's test of quantifiers in ensures
4
+ // and adds in a loop invariant which can be used to prove the ensures.
5
+ // This currently fails because side-effect checking in loop invariants is
6
+ // incorrect.
7
+
1
8
void initialize (int * arr , int len )
2
9
__CPROVER_ensures (
3
10
__CPROVER_forall {int i ; (0 <= i && i < len ) == > arr [i ] == i }
Original file line number Diff line number Diff line change
1
+ // function_check_04
2
+
3
+ // Note that this test is supposed to have an incorrect contract.
4
+ // We verify that checking this faulty contract (correctly) yields a failure.
5
+
1
6
#include <assert.h>
2
7
3
- // Note that this is supposed to have an incorrect contract.
4
- // We verify that applying (without checking) the contract yields success,
5
- // and that checking the contract yields failure.
6
8
int foo ()
7
9
__CPROVER_ensures (__CPROVER_return_value == 0 )
8
10
{
Original file line number Diff line number Diff line change
1
+ // function_check_05
2
+
3
+ // This test checks that when a function call is replaced by an invariant,
4
+ // it adequately havocs the locations modified by the function.
5
+ // This test currently fails because the analysis of what is modified by
6
+ // a function is flawed.
7
+
1
8
#include <assert.h>
2
9
3
10
int foo (int * x )
Original file line number Diff line number Diff line change
1
+ // function_check_mem_01
2
+
3
+ // This test checks the use of pointer-related predicates in assumptions and
4
+ // requires.
5
+ // This test currently fails because of the lack of support for assuming
6
+ // pointer predicates.
7
+
1
8
#include <stddef.h>
2
9
3
10
#define __CPROVER_VALID_MEM (ptr , size ) \
Original file line number Diff line number Diff line change
1
+ // invar_check_01
2
+
3
+ // This test checks that a basic loop invariant can be proven and used in
4
+ // combination with the negation of the loop guard to get a result.
5
+
1
6
#include <assert.h>
2
7
3
8
int main ()
Original file line number Diff line number Diff line change
1
+ // invar_check_02
2
+
3
+ // This test checks that loop invariants adequately handle continues.
4
+
1
5
#include <assert.h>
2
6
3
7
int main ()
Original file line number Diff line number Diff line change
1
+ // invar_check_03
2
+
3
+ // This test checks the use of loop invariants on a larger problem --- in this
4
+ // case, the partition portion of quicksort, applied to a fixed-length array.
5
+ // This serves as a stop-gap test until issues to do with quantifiers and
6
+ // side-effects in loop invariants are fixed.
7
+
1
8
#include <stdio.h>
2
9
#include <assert.h>
3
10
You can’t perform that action at this time.
0 commit comments