Skip to content

Commit 500aef3

Browse files
brsongraydon
authored andcommitted
---
yaml --- r: 1211 b: refs/heads/master c: 32c1c9f h: refs/heads/master i: 1209: 70135a4 1207: b145a46 v: v3
1 parent ee3d11e commit 500aef3

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: b5e62b04a060dea5e51f9bb65677ea8bd23dc971
2+
refs/heads/master: 32c1c9f55c7a5575aa462bcec9e00cd11273841a

trunk/src/test/run-pass/chan-poweroftwo.rs

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,32 @@
11
// -*- rust -*-
22

3-
// Regression test for circular_buffer initialization
3+
// Regression tests for circular_buffer when using a unit
4+
// that has a size that is not a power of two
45

56
use std;
67

78
import std.option;
89
import std._uint;
910
import std._vec;
1011

11-
// 12-byte unit for the channel buffer. Assuming that the default
12-
// buffer size needs to hold 8 units, then the minimum buffer size
13-
// needs to be 96. That's not a power of two so needs to be rounded up.
12+
// A 12-byte unit to send over the channel
1413
type record = rec(i32 val1, i32 val2, i32 val3);
1514

16-
impure fn worker(chan[record] channel) {
15+
// Assuming that the default buffer size needs to hold 8 units,
16+
// then the minimum buffer size needs to be 96. That's not a
17+
// power of two so needs to be rounded up. Don't trigger any
18+
// assertions.
19+
impure fn test_init() {
20+
let port[record] myport = port();
21+
auto mychan = chan(myport);
22+
1723
let record val = rec(val1=0i32, val2=0i32, val3=0i32);
18-
channel <| val;
24+
25+
mychan <| val;
1926
}
2027

2128
impure fn main() {
22-
let port[record] myport = port();
23-
auto mychan = chan(myport);
24-
25-
auto temp = spawn worker(mychan);
26-
auto val <- myport;
29+
test_init();
2730
}
2831

2932
// Local Variables:

0 commit comments

Comments
 (0)