MCPcopy Create free account
hub / github.com/apache/fory / TestStreamSkipDoesNotGrowToSkippedLength

Function TestStreamSkipDoesNotGrowToSkippedLength

go/fory/buffer_test.go:128–140  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

126}
127
128func TestStreamSkipDoesNotGrowToSkippedLength(t *testing.T) {
129 err := &Error{}
130 data := make([]byte, 1<<20)
131 reader := bytes.NewReader(data)
132 buf := NewByteBufferFromReader(reader, 16)
133
134 buf.Skip(len(data), err)
135
136 require.True(t, err.Ok())
137 require.Zero(t, reader.Len())
138 require.Equal(t, len(buf.data), buf.readerIndex)
139 require.LessOrEqual(t, cap(buf.data), 16)
140}
141
142func TestStreamFillDoubleGrowsFromBufferedBytes(t *testing.T) {
143 var err Error

Callers

nothing calls this directly

Calls 5

OkMethod · 0.95
NewByteBufferFromReaderFunction · 0.85
LenMethod · 0.80
SkipMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected