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

Function TestReadFixedWidthSliceBytes

go/fory/slice_primitive_test.go:479–504  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

477}
478
479func TestReadFixedWidthSliceBytes(t *testing.T) {
480 t.Run("unaligned_size", func(t *testing.T) {
481 buf := NewByteBuffer(nil)
482 buf.WriteLength(3)
483 buf.WriteBinary([]byte{1, 2, 3})
484 buf.SetReaderIndex(0)
485
486 err := &Error{}
487 result := ReadInt16Slice(buf, err)
488
489 assert.True(t, err.HasError())
490 assert.Nil(t, result)
491 })
492
493 t.Run("missing_body", func(t *testing.T) {
494 buf := NewByteBuffer(nil)
495 buf.WriteLength(40000)
496 buf.SetReaderIndex(0)
497
498 err := &Error{}
499 result := ReadFloat64Slice(buf, err)
500
501 assert.True(t, err.HasError())
502 assert.Nil(t, result)
503 })
504}
505
506func TestReadBoolSliceWrappedBuffer(t *testing.T) {
507 arrayBytes := NewByteBuffer(nil)

Callers

nothing calls this directly

Calls 7

WriteLengthMethod · 0.95
WriteBinaryMethod · 0.95
SetReaderIndexMethod · 0.95
HasErrorMethod · 0.95
NewByteBufferFunction · 0.85
ReadInt16SliceFunction · 0.85
ReadFloat64SliceFunction · 0.85

Tested by

no test coverage detected