MCPcopy
hub / github.com/golang/protobuf / TestEncodeDecode4

Function TestEncodeDecode4

proto/proto_test.go:568–659  ·  view source on GitHub ↗

All required fields set, defaults provided, all non-defaulted optional fields have values.

(t *testing.T)

Source from the content-addressed store, hash-verified

566
567// All required fields set, defaults provided, all non-defaulted optional fields have values.
568func TestEncodeDecode4(t *testing.T) {
569 pb := initGoTest(true)
570 pb.Table = proto.String("hello")
571 pb.Param = proto.Int32(7)
572 pb.OptionalField = initGoTestField()
573 pb.F_BoolOptional = proto.Bool(true)
574 pb.F_Int32Optional = proto.Int32(32)
575 pb.F_Int64Optional = proto.Int64(64)
576 pb.F_Fixed32Optional = proto.Uint32(3232)
577 pb.F_Fixed64Optional = proto.Uint64(6464)
578 pb.F_Uint32Optional = proto.Uint32(323232)
579 pb.F_Uint64Optional = proto.Uint64(646464)
580 pb.F_FloatOptional = proto.Float32(32.)
581 pb.F_DoubleOptional = proto.Float64(64.)
582 pb.F_StringOptional = proto.String("hello")
583 pb.F_BytesOptional = []byte("Bignose")
584 pb.F_Sint32Optional = proto.Int32(-32)
585 pb.F_Sint64Optional = proto.Int64(-64)
586 pb.F_Sfixed32Optional = proto.Int32(-32)
587 pb.F_Sfixed64Optional = proto.Int64(-64)
588 pb.Optionalgroup = initGoTest_OptionalGroup()
589
590 overify(t, pb,
591 protopack.Message{
592 protopack.Tag{1, protopack.VarintType}, protopack.Uvarint(7),
593 protopack.Tag{2, protopack.BytesType}, protopack.String("hello"),
594 protopack.Tag{3, protopack.VarintType}, protopack.Varint(7),
595 protopack.Tag{4, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
596 protopack.Tag{1, protopack.BytesType}, protopack.String("label"),
597 protopack.Tag{2, protopack.BytesType}, protopack.String("type"),
598 }),
599 protopack.Tag{6, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
600 protopack.Tag{1, protopack.BytesType}, protopack.String("label"),
601 protopack.Tag{2, protopack.BytesType}, protopack.String("type"),
602 }),
603 protopack.Tag{10, protopack.VarintType}, protopack.Bool(true),
604 protopack.Tag{11, protopack.VarintType}, protopack.Varint(3),
605 protopack.Tag{12, protopack.VarintType}, protopack.Varint(6),
606 protopack.Tag{13, protopack.Fixed32Type}, protopack.Uint32(32),
607 protopack.Tag{14, protopack.Fixed64Type}, protopack.Uint64(64),
608 protopack.Tag{15, protopack.VarintType}, protopack.Uvarint(3232),
609 protopack.Tag{16, protopack.VarintType}, protopack.Uvarint(6464),
610 protopack.Tag{17, protopack.Fixed32Type}, protopack.Float32(3232),
611 protopack.Tag{18, protopack.Fixed64Type}, protopack.Float64(6464),
612 protopack.Tag{19, protopack.BytesType}, protopack.String("string"),
613 protopack.Tag{30, protopack.VarintType}, protopack.Bool(true),
614 protopack.Tag{31, protopack.VarintType}, protopack.Varint(32),
615 protopack.Tag{32, protopack.VarintType}, protopack.Varint(64),
616 protopack.Tag{33, protopack.Fixed32Type}, protopack.Uint32(3232),
617 protopack.Tag{34, protopack.Fixed64Type}, protopack.Uint64(6464),
618 protopack.Tag{35, protopack.VarintType}, protopack.Uvarint(323232),
619 protopack.Tag{36, protopack.VarintType}, protopack.Uvarint(646464),
620 protopack.Tag{37, protopack.Fixed32Type}, protopack.Float32(32),
621 protopack.Tag{38, protopack.Fixed64Type}, protopack.Float64(64),
622 protopack.Tag{39, protopack.BytesType}, protopack.String("hello"),
623 protopack.Tag{40, protopack.VarintType}, protopack.Bool(true),
624 protopack.Tag{41, protopack.VarintType}, protopack.Varint(32),
625 protopack.Tag{42, protopack.VarintType}, protopack.Varint(64),

Callers

nothing calls this directly

Calls 15

StringFunction · 0.92
Int32Function · 0.92
BoolFunction · 0.92
Int64Function · 0.92
Uint32Function · 0.92
Uint64Function · 0.92
Float32Function · 0.92
Float64Function · 0.92
initGoTestFunction · 0.85
initGoTestFieldFunction · 0.85
initGoTest_OptionalGroupFunction · 0.85
overifyFunction · 0.85

Tested by

no test coverage detected