diff --git a/util/proto/marshal_test.go b/util/proto/marshal_test.go index 5d887ce..a848bb5 100644 --- a/util/proto/marshal_test.go +++ b/util/proto/marshal_test.go @@ -113,6 +113,10 @@ func repPrimitivesEqual(t *testing.T, a *generated.RepPrimitives, b *test.RepPri require.Equal(t, a.FieldE, b.FieldE) require.Equal(t, a.FieldF, b.FieldF) require.Equal(t, a.FieldFu, b.FieldFu) + require.Equal(t, len(a.GetFieldAux()), len(b.GetFieldAux())) + for i := range a.FieldAux { + require.Equal(t, a.GetFieldAux()[i].GetInnerField(), b.GetFieldAux()[i].GetInnerField()) + } } func randIntSlice[T protoInt](n int, includeZero bool) []T { @@ -129,6 +133,14 @@ func randIntSlice[T protoInt](n int, includeZero bool) []T { return r } +func uint32SliceToAux(s []uint32) []*generated.RepPrimitives_Aux { + r := make([]*generated.RepPrimitives_Aux, len(s)) + for i := range s { + r[i] = &generated.RepPrimitives_Aux{s[i]} + } + return r +} + func TestStableMarshalRep(t *testing.T) { t.Run("empty", func(t *testing.T) { marshalCases := []struct { @@ -176,6 +188,9 @@ func TestStableMarshalRep(t *testing.T) { {name: "uint64", input: &generated.RepPrimitives{FieldFu: randIntSlice[uint64](1, true)}}, {name: "uint64", input: &generated.RepPrimitives{FieldFu: randIntSlice[uint64](2, true)}}, {name: "uint64", input: &generated.RepPrimitives{FieldFu: randIntSlice[uint64](2, false)}}, + {name: "message", input: &generated.RepPrimitives{FieldAux: uint32SliceToAux(randIntSlice[uint32](1, true))}}, + {name: "message", input: &generated.RepPrimitives{FieldAux: uint32SliceToAux(randIntSlice[uint32](2, true))}}, + {name: "message", input: &generated.RepPrimitives{FieldAux: uint32SliceToAux(randIntSlice[uint32](2, false))}}, } for _, tc := range marshalCases { t.Run(tc.name, func(t *testing.T) { diff --git a/util/proto/test/custom/test_frostfs.pb.go b/util/proto/test/custom/test_frostfs.pb.go index a39bba7..f3b958f 100644 Binary files a/util/proto/test/custom/test_frostfs.pb.go and b/util/proto/test/custom/test_frostfs.pb.go differ diff --git a/util/proto/test/test.pb.go b/util/proto/test/test.pb.go index de8ec65..e7d5699 100644 Binary files a/util/proto/test/test.pb.go and b/util/proto/test/test.pb.go differ diff --git a/util/proto/test/test.proto b/util/proto/test/test.proto index f33be49..58cee2f 100644 --- a/util/proto/test/test.proto +++ b/util/proto/test/test.proto @@ -40,4 +40,7 @@ message RepPrimitives { repeated int64 field_e = 5; repeated uint64 field_f = 6; repeated uint64 field_fu = 7 [ packed = false ]; + + message Aux { uint32 inner_field = 1; } + repeated Aux field_aux = 8; }