1.23
2.0
acw/focus-triggers
main
test-branch
| Line | |
|---|
| 1 | #include "civlc.h"
|
|---|
| 2 | #include "stdio.h"
|
|---|
| 3 |
|
|---|
| 4 | $input int N;
|
|---|
| 5 | $input int B;
|
|---|
| 6 | $assume(0 <= N && N <= B);
|
|---|
| 7 |
|
|---|
| 8 | int actual;
|
|---|
| 9 |
|
|---|
| 10 | void f ($proc prev, int i) {
|
|---|
| 11 | $wait(prev);
|
|---|
| 12 | actual = i - actual;
|
|---|
| 13 | }
|
|---|
| 14 |
|
|---|
| 15 | void g (){}
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 | int main ( void ) {
|
|---|
| 19 |
|
|---|
| 20 | actual = 0;
|
|---|
| 21 | $proc last_proc = $spawn g();
|
|---|
| 22 | for (int i = 0; i < N; i++)
|
|---|
| 23 | last_proc = $spawn f(last_proc, i);
|
|---|
| 24 |
|
|---|
| 25 | int expected = 0;
|
|---|
| 26 | for (int i = 0; i < N; i++)
|
|---|
| 27 | expected = i - expected;
|
|---|
| 28 |
|
|---|
| 29 | $wait(last_proc);
|
|---|
| 30 | printf("expected = %d, actual = %d\n", expected, actual);
|
|---|
| 31 | $assert(actual == expected);
|
|---|
| 32 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.