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

Function TestSliceEachIndividually

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

Source from the content-addressed store, hash-verified

740}
741
742func TestSliceEachIndividually(t *testing.T) {
743 fory := NewFory(WithXlang(true), WithCompatible(false), WithRefTracking(true))
744 for _, srcAny := range commonSlice() {
745 srcType := reflect.TypeOf(srcAny)
746 endPtr := reflect.New(srcType)
747 data, _ := fory.Marshal(srcAny)
748 _ = fory.Unmarshal(data, endPtr.Interface())
749 endVal := endPtr.Elem()
750 endAny := endVal.Interface()
751 require.Equal(t, srcAny, endAny)
752 }
753}
754
755// Test Fory's serialization and deserialization of a struct with a slice of nested structs.
756func TestStructWithNestedSlice(t *testing.T) {

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected