File tree Expand file tree Collapse file tree 9 files changed +120
-0
lines changed
Expand file tree Collapse file tree 9 files changed +120
-0
lines changed Original file line number Diff line number Diff line change 1+ int f1 (int * x1 )
2+ {
3+ return * x1 + 1 ;
4+ }
5+
6+ int main ()
7+ {
8+ int p ;
9+ __CPROVER_assume (p > 1 && p < 10000 );
10+ f1 (& p );
11+
12+ return 0 ;
13+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ test.json
3+
4+ \_\_CPROVER\_requires.*\_\_CPROVER\_requires.*\_\_CPROVER_ensures
5+ ^EXIT=0$
6+ ^SIGNAL=0$
7+ --
8+ --
9+ Annotate function contracts to function f1.
Original file line number Diff line number Diff line change 1+ {
2+ "sources" : [
3+ " main.c"
4+ ],
5+ "functions" : [
6+ {
7+ "f1" : [
8+ " requires *x1 > 1" ,
9+ " requires *x1 < 10000" ,
10+ " ensures __CPROVER_return_value == *x1 + 1"
11+ ]
12+ }
13+ ],
14+ "output" : " stdout"
15+ }
Original file line number Diff line number Diff line change 1+ int foo (int * x )
2+ {
3+ * x = * x + 0 ;
4+ return * x + 5 ;
5+ }
6+
7+ int main ()
8+ {
9+ int n = 4 ;
10+ n = foo (& n );
11+
12+ return 0 ;
13+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ test.json
3+
4+ \_\_CPROVER\_assigns.*_\_CPROVER_ensures
5+ ^EXIT=0$
6+ ^SIGNAL=0$
7+ --
8+ --
9+ Annotate function contracts to function foo.
Original file line number Diff line number Diff line change 1+ {
2+ "sources" : [
3+ " main.c"
4+ ],
5+ "functions" : [
6+ {
7+ "foo" : [
8+ " assigns *x" ,
9+ " ensures __CPROVER_return_value == *x + 5"
10+ ]
11+ }
12+ ],
13+ "output" : " stdout"
14+ }
Original file line number Diff line number Diff line change 1+ int f1 (int * x1 )
2+ {
3+ return f2 (x1 ) + 1 ;
4+ }
5+
6+ int f2 (int * x2 )
7+ {
8+ return * x2 + 1 ;
9+ }
10+
11+ int main ()
12+ {
13+ int p ;
14+ __CPROVER_assume (p > 1 && p < 10000 );
15+ f1 (& p );
16+
17+ return 0 ;
18+ }
Original file line number Diff line number Diff line change 1+ CORE
2+ test.json
3+
4+ activate-multi-line-match
5+ ^EXIT=0$
6+ ^SIGNAL=0$
7+ int f1\(int \*x1\)\n \_\_CPROVER\_requires\(\*x1\>1\&\&\*x1\<10000\) \_\_CPROVER\_ensures\(.*\=\=\*x1\+2\)
8+ int f2\(int \*x2\)\n \_\_CPROVER\_requires\(\*x2\>1\&\&\*x2\<10000\) \_\_CPROVER\_ensures\(.*\=\=\*x2\+1\)
9+ --
10+ --
11+ Annotate function contracts to functions f1 and f2.
Original file line number Diff line number Diff line change 1+ {
2+ "sources" : [
3+ " main.c"
4+ ],
5+ "functions" : [
6+ {
7+ "f1" : [
8+ " requires *x1 > 1 && *x1 < 10000" ,
9+ " ensures __CPROVER_return_value == *x1 + 2"
10+ ],
11+ "f2" : [
12+ " requires *x2 > 1 && *x2 < 10000" ,
13+ " ensures __CPROVER_return_value == *x2 + 1"
14+ ]
15+ }
16+ ],
17+ "output" : " stdout"
18+ }
You can’t perform that action at this time.
0 commit comments