(t *testing.T)
| 3 | import "testing" |
| 4 | |
| 5 | func 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 | |
| 33 | func TestSharedBufferMultiple(t *testing.T) { |
| 34 | buf := NewSharedBuffer(3) |
nothing calls this directly
no test coverage detected
searching dependent graphs…