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

Function TestInt16Slice

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

Source from the content-addressed store, hash-verified

234}
235
236func TestInt16Slice(t *testing.T) {
237 f := NewFory(WithXlang(false), WithCompatible(false))
238
239 t.Run("int16_slice_large_numbers", func(t *testing.T) {
240 slice := []int16{1, -2, 3, -4, math.MaxInt16, math.MinInt16}
241 data, err := f.Serialize(slice)
242 assert.NoError(t, err)
243
244 var result []int16
245 err = testDeserialize(t, f, data, &result)
246 assert.NoError(t, err)
247 assert.Equal(t, slice, result)
248 })
249
250 t.Run("int16_slice_empty", func(t *testing.T) {
251 slice := []int16{}
252 data, err := f.Serialize(slice)
253 assert.NoError(t, err)
254
255 var result []int16
256 err = testDeserialize(t, f, data, &result)
257 assert.NoError(t, err)
258 assert.NotNil(t, result)
259 assert.Empty(t, result)
260 })
261
262 t.Run("int16_slice_nil", func(t *testing.T) {
263 var slice []int16 = nil
264 data, err := f.Serialize(slice)
265 assert.NoError(t, err)
266
267 var result []int16
268 err = testDeserialize(t, f, data, &result)
269 assert.NoError(t, err)
270 assert.Nil(t, result)
271 })
272}
273
274func TestInt32Slice(t *testing.T) {
275 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