(t *testing.T, ch Channel)
| 3 | import "testing" |
| 4 | |
| 5 | func testBatches(t *testing.T, ch Channel) { |
| 6 | go func() { |
| 7 | for i := 0; i < 1000; i++ { |
| 8 | ch.In() <- i |
| 9 | } |
| 10 | ch.Close() |
| 11 | }() |
| 12 | |
| 13 | i := 0 |
| 14 | for val := range ch.Out() { |
| 15 | for _, elem := range val.([]interface{}) { |
| 16 | if i != elem.(int) { |
| 17 | t.Fatal("batching channel expected", i, "but got", elem.(int)) |
| 18 | } |
| 19 | i++ |
| 20 | } |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | func TestBatchingChannel(t *testing.T) { |
| 25 | ch := NewBatchingChannel(Infinity) |
no test coverage detected
searching dependent graphs…