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

Function TestInt32Slice

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

Source from the content-addressed store, hash-verified

272}
273
274func TestInt32Slice(t *testing.T) {
275 f := NewFory(WithXlang(false), WithCompatible(false))
276
277 t.Run("int32_slice_large_numbers", func(t *testing.T) {
278 slice := []int32{1, -2, 3, -4, math.MaxInt32, math.MinInt32}
279 data, err := f.Serialize(slice)
280 assert.NoError(t, err)
281
282 var result []int32
283 err = testDeserialize(t, f, data, &result)
284 assert.NoError(t, err)
285 assert.Equal(t, slice, result)
286 })
287
288 t.Run("int32_slice_empty", func(t *testing.T) {
289 slice := []int32{}
290 data, err := f.Serialize(slice)
291 assert.NoError(t, err)
292
293 var result []int32
294 err = testDeserialize(t, f, data, &result)
295 assert.NoError(t, err)
296 assert.NotNil(t, result)
297 assert.Empty(t, result)
298 })
299
300 t.Run("int32_slice_nil", func(t *testing.T) {
301 var slice []int32 = nil
302 data, err := f.Serialize(slice)
303 assert.NoError(t, err)
304
305 var result []int32
306 err = testDeserialize(t, f, data, &result)
307 assert.NoError(t, err)
308 assert.Nil(t, result)
309 })
310}
311
312func TestInt64Slice(t *testing.T) {
313 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