(t *testing.T)
| 487 | } |
| 488 | |
| 489 | func TestReducedPrecisionSlicesUseListOrdering(t *testing.T) { |
| 490 | type TestStruct struct { |
| 491 | Float16Value float16.Float16 |
| 492 | Bfloat16Value bfloat16.BFloat16 |
| 493 | Bfloat16Array []bfloat16.BFloat16 |
| 494 | Float16Array []float16.Float16 |
| 495 | } |
| 496 | |
| 497 | f := New(WithXlang(true), WithCompatible(false)) |
| 498 | require.NoError(t, f.RegisterStruct(TestStruct{}, 1004)) |
| 499 | |
| 500 | typeInfo, err := f.typeResolver.getTypeInfo(reflect.ValueOf(TestStruct{}), false) |
| 501 | require.NoError(t, err) |
| 502 | |
| 503 | structSer, ok := typeInfo.Serializer.(*structSerializer) |
| 504 | require.True(t, ok) |
| 505 | require.NoError(t, structSer.initialize(f.typeResolver)) |
| 506 | |
| 507 | require.Len(t, structSer.fieldGroup.FixedFields, 2) |
| 508 | require.Equal(t, "float16_value", structSer.fieldGroup.FixedFields[0].Meta.Name) |
| 509 | require.Equal(t, "bfloat16_value", structSer.fieldGroup.FixedFields[1].Meta.Name) |
| 510 | |
| 511 | require.Len(t, structSer.fieldGroup.RemainingFields, 2) |
| 512 | require.Equal(t, "bfloat16_array", structSer.fieldGroup.RemainingFields[0].Meta.Name) |
| 513 | require.Equal(t, TypeId(LIST), structSer.fieldGroup.RemainingFields[0].Meta.TypeId) |
| 514 | require.IsType(t, primitiveListSerializer{}, structSer.fieldGroup.RemainingFields[0].Serializer) |
| 515 | require.Equal(t, "float16_array", structSer.fieldGroup.RemainingFields[1].Meta.Name) |
| 516 | require.Equal(t, TypeId(LIST), structSer.fieldGroup.RemainingFields[1].Meta.TypeId) |
| 517 | require.IsType(t, primitiveListSerializer{}, structSer.fieldGroup.RemainingFields[1].Serializer) |
| 518 | } |
| 519 | |
| 520 | func TestTaggedFieldsKeepGroupedPayloadOrder(t *testing.T) { |
| 521 | type TaggedSortStruct struct { |
nothing calls this directly
no test coverage detected