1.23
2.0
main
test-branch
| Line | |
|---|
| 1 | #include <civlc.cvh>
|
|---|
| 2 | #include <assert.h>
|
|---|
| 3 |
|
|---|
| 4 | $input int in;
|
|---|
| 5 | $assume(in > 0);
|
|---|
| 6 |
|
|---|
| 7 | int 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 |
|
|---|
| 19 | int f2(int a, int b)
|
|---|
| 20 | $ensures {a > 0}{
|
|---|
| 21 | int x;
|
|---|
| 22 |
|
|---|
| 23 | x = a + b;
|
|---|
| 24 | }
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 | int 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.