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

Function TestSerializeCommonReference

go/fory/fory_test.go:499–514  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

497}
498
499func TestSerializeCommonReference(t *testing.T) {
500 fory := NewFory(WithXlang(true), WithCompatible(false), WithRefTracking(true))
501 var values []any
502 values = append(values, commonSlice()...)
503 values = append(values, commonMap()...)
504 for _, data := range values {
505 value := []any{data, data}
506 bytes, err := fory.Marshal(value)
507 require.Nil(t, err)
508 var newValue []any
509 require.Nil(t, fory.Unmarshal(bytes, &newValue))
510 require.Equal(t, unsafe.Pointer(reflect.ValueOf(newValue[0]).Pointer()),
511 unsafe.Pointer(reflect.ValueOf(newValue[1]).Pointer()))
512 require.Equal(t, newValue[0], newValue[1])
513 }
514}
515
516func TestReadBufferObjectRejectsTruncatedInBandData(t *testing.T) {
517 buf := NewByteBuffer(nil)

Callers

nothing calls this directly

Calls 9

MarshalMethod · 0.95
UnmarshalMethod · 0.95
NewForyFunction · 0.85
WithXlangFunction · 0.85
WithCompatibleFunction · 0.85
WithRefTrackingFunction · 0.85
commonSliceFunction · 0.85
commonMapFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected