MCPcopy Create free account
hub / github.com/eapache/channels / testBatches

Function testBatches

batching_channel_test.go:5–22  ·  view source on GitHub ↗
(t *testing.T, ch Channel)

Source from the content-addressed store, hash-verified

3import "testing"
4
5func 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
24func TestBatchingChannel(t *testing.T) {
25 ch := NewBatchingChannel(Infinity)

Callers 1

TestBatchingChannelFunction · 0.85

Calls 3

InMethod · 0.65
CloseMethod · 0.65
OutMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…