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

Function TestReadCollectionLengthDoesNotTreatElementsAsBytes

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

Source from the content-addressed store, hash-verified

157}
158
159func TestReadCollectionLengthDoesNotTreatElementsAsBytes(t *testing.T) {
160 writer := NewByteBuffer(nil)
161 writer.WriteLength(1024)
162
163 ctx := NewReadContext(false)
164 ctx.SetData(writer.Bytes())
165
166 require.Equal(t, 1024, ctx.ReadCollectionLength())
167 require.False(t, ctx.HasError())
168}
169
170func TestReadVarUint32Small7RejectsOverflowFifthByte(t *testing.T) {
171 buf := NewByteBuffer([]byte{0x80, 0x80, 0x80, 0x80, 0x10})

Callers

nothing calls this directly

Calls 8

WriteLengthMethod · 0.95
SetDataMethod · 0.95
BytesMethod · 0.95
ReadCollectionLengthMethod · 0.95
HasErrorMethod · 0.95
NewByteBufferFunction · 0.85
NewReadContextFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected