2011-04-19 15:35:49 -05:00
|
|
|
fn main() -> () {
|
2010-07-19 16:05:18 -05:00
|
|
|
test00();
|
|
|
|
}
|
|
|
|
|
2011-04-19 15:35:49 -05:00
|
|
|
fn test00() {
|
2010-07-19 19:33:50 -05:00
|
|
|
let int r = 0;
|
|
|
|
let int sum = 0;
|
2010-07-19 16:05:18 -05:00
|
|
|
let port[int] p = port();
|
|
|
|
let chan[int] c = chan(p);
|
2010-07-19 19:33:50 -05:00
|
|
|
|
|
|
|
c <| 1;
|
|
|
|
c <| 2;
|
|
|
|
c <| 3;
|
|
|
|
c <| 4;
|
|
|
|
|
|
|
|
r <- p; sum += r; log (r);
|
|
|
|
r <- p; sum += r; log (r);
|
|
|
|
r <- p; sum += r; log (r);
|
|
|
|
r <- p; sum += r; log (r);
|
|
|
|
|
|
|
|
c <| 5;
|
|
|
|
c <| 6;
|
|
|
|
c <| 7;
|
|
|
|
c <| 8;
|
|
|
|
|
|
|
|
r <- p; sum += r; log (r);
|
|
|
|
r <- p; sum += r; log (r);
|
|
|
|
r <- p; sum += r; log (r);
|
|
|
|
r <- p; sum += r; log (r);
|
|
|
|
|
2011-05-02 13:23:07 -05:00
|
|
|
assert (sum == 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8);
|
2010-07-19 16:05:18 -05:00
|
|
|
}
|