MCPcopy Create free account
hub / github.com/djherbis/buffer / poolAtTest

Function poolAtTest

buffer_test.go:836–850  ·  view source on GitHub ↗
(pool PoolAt, t *testing.T)

Source from the content-addressed store, hash-verified

834}
835
836func poolAtTest(pool PoolAt, t *testing.T) {
837 buf, err := pool.Get()
838 if err != nil {
839 t.Error(err)
840 }
841 if n, err := buf.Write([]byte("hello world")); n != 10 {
842 t.Errorf("wrote incorrect amount")
843 } else if err == nil {
844 t.Errorf("should have been a shortwrite error here")
845 }
846 pool.Put(buf)
847 if buf.Len() > 0 {
848 t.Errorf("should have emptied the buffer")
849 }
850}
851
852func TestPartitionAt(t *testing.T) {
853 buf := NewPartitionAt(NewMemPoolAt(5))

Callers 1

TestMemPoolAtFunction · 0.85

Calls 4

GetMethod · 0.65
PutMethod · 0.65
LenMethod · 0.65
WriteMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…