MCPcopy
hub / github.com/segmentio/kafka-go / TestPageRefReadByte

Function TestPageRefReadByte

protocol/buffer_test.go:89–108  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

87}
88
89func TestPageRefReadByte(t *testing.T) {
90 buffer := newPageBuffer()
91 defer buffer.unref()
92
93 content := bytes.Repeat([]byte("1234567890"), 10e3)
94 buffer.Write(content)
95
96 ref := buffer.ref(0, buffer.Size())
97 defer ref.unref()
98
99 for i, c := range content {
100 b, err := ref.ReadByte()
101 if err != nil {
102 t.Fatal(err)
103 }
104 if b != c {
105 t.Fatalf("byte at offset %d mismatch, expected '%c' but got '%c'", i, c, b)
106 }
107 }
108}

Callers

nothing calls this directly

Calls 6

newPageBufferFunction · 0.85
unrefMethod · 0.45
WriteMethod · 0.45
refMethod · 0.45
SizeMethod · 0.45
ReadByteMethod · 0.45

Tested by

no test coverage detected