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

Function TestIntSlice

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

Source from the content-addressed store, hash-verified

120}
121
122func TestIntSlice(t *testing.T) {
123 f := NewFory(WithXlang(false), WithCompatible(false))
124
125 t.Run("int_slice_large_numbers", func(t *testing.T) {
126 slice := []int{1, -2, 3, -4, math.MaxInt, math.MinInt}
127 data, err := f.Serialize(slice)
128 assert.NoError(t, err)
129
130 var result []int
131 err = testDeserialize(t, f, data, &result)
132 assert.NoError(t, err)
133 assert.Equal(t, slice, result)
134 })
135
136 t.Run("int_slice_empty", func(t *testing.T) {
137 slice := []int{}
138 data, err := f.Serialize(slice)
139 assert.NoError(t, err)
140
141 var result []int
142 err = testDeserialize(t, f, data, &result)
143 assert.NoError(t, err)
144 assert.NotNil(t, result)
145 assert.Empty(t, result)
146 })
147
148 t.Run("int_slice_nil", func(t *testing.T) {
149 var slice []int = nil
150 data, err := f.Serialize(slice)
151 assert.NoError(t, err)
152
153 var result []int
154 err = testDeserialize(t, f, data, &result)
155 assert.NoError(t, err)
156 assert.Nil(t, result)
157 })
158}
159
160func TestUintSlice(t *testing.T) {
161 f := NewFory(WithXlang(false), WithCompatible(false))

Callers

nothing calls this directly

Calls 7

SerializeMethod · 0.95
NewForyFunction · 0.85
WithXlangFunction · 0.85
WithCompatibleFunction · 0.85
testDeserializeFunction · 0.85
EqualMethod · 0.45
EmptyMethod · 0.45

Tested by

no test coverage detected