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