[#107] proto/test: Add oneof test
All checks were successful
Tests and linters / Tests (1.23) (pull_request) Successful in 1m13s
DCO action / DCO (pull_request) Successful in 1m20s
Tests and linters / Tests (1.22) (pull_request) Successful in 1m25s
Tests and linters / Tests with -race (pull_request) Successful in 1m52s
Tests and linters / Lint (pull_request) Successful in 2m30s
All checks were successful
Tests and linters / Tests (1.23) (pull_request) Successful in 1m13s
DCO action / DCO (pull_request) Successful in 1m20s
Tests and linters / Tests (1.22) (pull_request) Successful in 1m25s
Tests and linters / Tests with -race (pull_request) Successful in 1m52s
Tests and linters / Lint (pull_request) Successful in 2m30s
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
10713b026e
commit
912a5b4d0b
4 changed files with 13 additions and 0 deletions
|
@ -49,6 +49,8 @@ func TestStableMarshalSingle(t *testing.T) {
|
|||
{name: "fixed32", input: &generated.Primitives{FieldK: nonZero[uint32]()}},
|
||||
{name: "enum, positive", input: &generated.Primitives{FieldH: generated.Primitives_POSITIVE}},
|
||||
{name: "enum, negative", input: &generated.Primitives{FieldH: generated.Primitives_NEGATIVE}},
|
||||
{name: "oneof, first", input: &generated.Primitives{FieldM: &generated.Primitives_FieldMa{FieldMa: []byte{4, 2}}}},
|
||||
{name: "oneof, second", input: &generated.Primitives{FieldM: &generated.Primitives_FieldMe{FieldMe: nonZero[uint32]()}}},
|
||||
}
|
||||
for _, tc := range marshalCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
|
@ -97,6 +99,9 @@ func primitivesEqual(t *testing.T, a *generated.Primitives, b *test.Primitives)
|
|||
require.Equal(t, a.FieldJ, b.FieldJ)
|
||||
require.Equal(t, a.FieldK, b.FieldK)
|
||||
require.EqualValues(t, a.FieldH, b.FieldH)
|
||||
require.Equal(t, a.GetFieldMa(), b.GetFieldMa())
|
||||
require.Equal(t, a.GetFieldMe(), b.GetFieldMe())
|
||||
require.Equal(t, a.GetFieldAux().GetInnerField(), b.GetFieldAux().GetInnerField())
|
||||
}
|
||||
|
||||
func repPrimitivesEqual(t *testing.T, a *generated.RepPrimitives, b *test.RepPrimitives) {
|
||||
|
|
BIN
util/proto/test/custom/test_frostfs.pb.go
generated
BIN
util/proto/test/custom/test_frostfs.pb.go
generated
Binary file not shown.
BIN
util/proto/test/test.pb.go
generated
BIN
util/proto/test/test.pb.go
generated
Binary file not shown.
|
@ -22,6 +22,14 @@ message Primitives {
|
|||
NEGATIVE = -1;
|
||||
}
|
||||
SomeEnum field_h = 300;
|
||||
|
||||
message Aux { uint32 inner_field = 1; }
|
||||
|
||||
oneof field_m {
|
||||
bytes field_ma = 401;
|
||||
uint32 field_me = 402;
|
||||
Aux field_aux = 403;
|
||||
}
|
||||
}
|
||||
|
||||
message RepPrimitives {
|
||||
|
|
Loading…
Reference in a new issue