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

Function TestSerializeAny

go/fory/threadsafe/fory_test.go:92–114  ·  view source on GitHub ↗

TestSerializeAny tests the Serialize/Deserialize methods

(t *testing.T)

Source from the content-addressed store, hash-verified

90
91// TestSerializeAny tests the Serialize/Deserialize methods
92func TestSerializeAny(t *testing.T) {
93 f := New(fory.WithXlang(false), fory.WithRefTracking(true), fory.WithCompatible(false))
94
95 t.Run("Primitives", func(t *testing.T) {
96 data, err := f.Serialize(int32(42))
97 require.NoError(t, err)
98
99 var result int32
100 err = f.Deserialize(data, &result)
101 require.NoError(t, err)
102 require.Equal(t, int32(42), result)
103 })
104
105 t.Run("String", func(t *testing.T) {
106 data, err := f.Serialize("hello")
107 require.NoError(t, err)
108
109 var result string
110 err = f.Deserialize(data, &result)
111 require.NoError(t, err)
112 require.Equal(t, "hello", result)
113 })
114}
115
116// TestDeserialize tests the Deserialize generic function
117func TestDeserialize(t *testing.T) {

Callers

nothing calls this directly

Calls 5

NewFunction · 0.70
int32Function · 0.50
SerializeMethod · 0.45
DeserializeMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected