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

Function TestSharedBufferSingleton

shared_buffer_test.go:5–31  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3import "testing"
4
5func TestSharedBufferSingleton(t *testing.T) {
6 buf := NewSharedBuffer(3)
7
8 ch := buf.NewChannel()
9 for i := 0; i < 5; i++ {
10 ch.In() <- (*int)(nil)
11 ch.In() <- (*int)(nil)
12 ch.In() <- (*int)(nil)
13 select {
14 case ch.In() <- (*int)(nil):
15 t.Error("Wrote to full shared-buffer")
16 default:
17 }
18
19 <-ch.Out()
20 <-ch.Out()
21 <-ch.Out()
22 select {
23 case <-ch.Out():
24 t.Error("Read from empty shared-buffer")
25 default:
26 }
27 }
28
29 ch.Close()
30 buf.Close()
31}
32
33func TestSharedBufferMultiple(t *testing.T) {
34 buf := NewSharedBuffer(3)

Callers

nothing calls this directly

Calls 6

NewChannelMethod · 0.95
CloseMethod · 0.95
NewSharedBufferFunction · 0.85
InMethod · 0.65
OutMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…