source: CIVL/examples/experimental/contracts.c@ 77ad37b

1.23 2.0 main test-branch
Last change on this file since 77ad37b was eb17c2b, checked in by Ziqing Luo <ziqing@…>, 11 years ago

git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@2557 fb995dde-84ed-4084-dfe6-e5aef3e2452c

  • Property mode set to 100644
File size: 400 bytes
Line 
1#include <civlc.cvh>
2#include <assert.h>
3
4$input int in;
5$assume(in > 0);
6
7int f1(int a, int b)
8 $requires $collective(in) {a > 0}
9$requires {b > 1}
10$ensures {$result > 0}
11$ensures {b >= 2} {
12
13 if(a == 1)
14 return a + b;
15 else
16 return a - b;
17}
18
19int f2(int a, int b)
20$ensures {a > 0}{
21 int x;
22
23 x = a + b;
24}
25
26
27
28int main() {
29 int i = 0;
30
31 i = f1(in, 2);
32 i = f2(1, 2);
33 return 0;
34}
35
Note: See TracBrowser for help on using the repository browser.