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

Function TestInt8Slice

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

Source from the content-addressed store, hash-verified

196}
197
198func TestInt8Slice(t *testing.T) {
199 f := NewFory(WithXlang(false), WithCompatible(false))
200
201 t.Run("int8_slice_large_numbers", func(t *testing.T) {
202 slice := []int8{1, -2, 3, -4, math.MaxInt8, math.MinInt8}
203 data, err := f.Serialize(slice)
204 assert.NoError(t, err)
205
206 var result []int8
207 err = testDeserialize(t, f, data, &result)
208 assert.NoError(t, err)
209 assert.Equal(t, slice, result)
210 })
211
212 t.Run("int8_slice_empty", func(t *testing.T) {
213 slice := []int8{}
214 data, err := f.Serialize(slice)
215 assert.NoError(t, err)
216
217 var result []int8
218 err = testDeserialize(t, f, data, &result)
219 assert.NoError(t, err)
220 assert.NotNil(t, result)
221 assert.Empty(t, result)
222 })
223
224 t.Run("int8_slice_nil", func(t *testing.T) {
225 var slice []int8 = nil
226 data, err := f.Serialize(slice)
227 assert.NoError(t, err)
228
229 var result []int8
230 err = testDeserialize(t, f, data, &result)
231 assert.NoError(t, err)
232 assert.Nil(t, result)
233 })
234}
235
236func TestInt16Slice(t *testing.T) {
237 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