Skip to content

Commit e0c3138

Browse files
author
klaas
committed
Added detailed description to regression tests.
1 parent 3464088 commit e0c3138

File tree

13 files changed

+84
-9
lines changed

13 files changed

+84
-9
lines changed

regression/contracts/function_apply_01/main.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
#include <assert.h>
1+
// function_apply_01
22

3-
// Note that this is supposed to have an incorrect contract.
3+
// Note that this test is supposed to have an incorrect contract.
44
// We verify that applying (without checking) the contract yields success,
55
// and that checking the contract yields failure.
6+
7+
#include <assert.h>
8+
69
int foo()
710
__CPROVER_ensures(__CPROVER_return_value == 0)
811
{

regression/contracts/function_check_01/main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
16
#include <assert.h>
27

38
int min(int a, int b)

regression/contracts/function_check_02/main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
16
int initialize(int* arr)
27
__CPROVER_ensures(
38
__CPROVER_forall {int i; (0 <= i && i < 10) ==> arr[i] == i}

regression/contracts/function_check_03/main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
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+
18
void initialize(int* arr, int len)
29
__CPROVER_ensures(
310
__CPROVER_forall {int i; (0 <= i && i < len) ==> arr[i] == i}

regression/contracts/function_check_04/main.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
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+
16
#include <assert.h>
27

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.
68
int foo()
79
__CPROVER_ensures(__CPROVER_return_value == 0)
810
{

regression/contracts/function_check_05/main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
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+
18
#include <assert.h>
29

310
int foo(int* x)

regression/contracts/function_check_mem_01/main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
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+
18
#include <stddef.h>
29

310
#define __CPROVER_VALID_MEM(ptr, size) \

regression/contracts/invar_check_01/main.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
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+
16
#include <assert.h>
27

38
int main()

regression/contracts/invar_check_02/main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// invar_check_02
2+
3+
// This test checks that loop invariants adequately handle continues.
4+
15
#include <assert.h>
26

37
int main()

regression/contracts/invar_check_03/main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
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+
18
#include <stdio.h>
29
#include <assert.h>
310

0 commit comments

Comments
 (0)