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

Function TestEncodeDecode6

proto/proto_test.go:776–833  ·  view source on GitHub ↗

All required fields set, all packed repeated fields given two values.

(t *testing.T)

Source from the content-addressed store, hash-verified

774
775// All required fields set, all packed repeated fields given two values.
776func TestEncodeDecode6(t *testing.T) {
777 pb := initGoTest(false)
778 pb.F_BoolRepeatedPacked = []bool{false, true}
779 pb.F_Int32RepeatedPacked = []int32{32, 33}
780 pb.F_Int64RepeatedPacked = []int64{64, 65}
781 pb.F_Fixed32RepeatedPacked = []uint32{3232, 3333}
782 pb.F_Fixed64RepeatedPacked = []uint64{6464, 6565}
783 pb.F_Uint32RepeatedPacked = []uint32{323232, 333333}
784 pb.F_Uint64RepeatedPacked = []uint64{646464, 656565}
785 pb.F_FloatRepeatedPacked = []float32{32., 33.}
786 pb.F_DoubleRepeatedPacked = []float64{64., 65.}
787 pb.F_Sint32RepeatedPacked = []int32{32, -32}
788 pb.F_Sint64RepeatedPacked = []int64{64, -64}
789 pb.F_Sfixed32RepeatedPacked = []int32{32, -32}
790 pb.F_Sfixed64RepeatedPacked = []int64{64, -64}
791
792 overify(t, pb,
793 protopack.Message{
794 protopack.Tag{1, protopack.VarintType}, protopack.Uvarint(7),
795 protopack.Tag{4, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
796 protopack.Tag{1, protopack.BytesType}, protopack.String("label"),
797 protopack.Tag{2, protopack.BytesType}, protopack.String("type"),
798 }),
799 protopack.Tag{10, protopack.VarintType}, protopack.Bool(true),
800 protopack.Tag{11, protopack.VarintType}, protopack.Varint(3),
801 protopack.Tag{12, protopack.VarintType}, protopack.Varint(6),
802 protopack.Tag{13, protopack.Fixed32Type}, protopack.Uint32(32),
803 protopack.Tag{14, protopack.Fixed64Type}, protopack.Uint64(64),
804 protopack.Tag{15, protopack.VarintType}, protopack.Uvarint(3232),
805 protopack.Tag{16, protopack.VarintType}, protopack.Uvarint(6464),
806 protopack.Tag{17, protopack.Fixed32Type}, protopack.Float32(3232),
807 protopack.Tag{18, protopack.Fixed64Type}, protopack.Float64(6464),
808 protopack.Tag{19, protopack.BytesType}, protopack.String("string"),
809 protopack.Tag{50, protopack.BytesType}, protopack.LengthPrefix{protopack.Bool(false), protopack.Bool(true)},
810 protopack.Tag{51, protopack.BytesType}, protopack.LengthPrefix{protopack.Varint(32), protopack.Varint(33)},
811 protopack.Tag{52, protopack.BytesType}, protopack.LengthPrefix{protopack.Varint(64), protopack.Varint(65)},
812 protopack.Tag{53, protopack.BytesType}, protopack.LengthPrefix{protopack.Uint32(3232), protopack.Uint32(3333)},
813 protopack.Tag{54, protopack.BytesType}, protopack.LengthPrefix{protopack.Uint64(6464), protopack.Uint64(6565)},
814 protopack.Tag{55, protopack.BytesType}, protopack.LengthPrefix{protopack.Uvarint(323232), protopack.Uvarint(333333)},
815 protopack.Tag{56, protopack.BytesType}, protopack.LengthPrefix{protopack.Uvarint(646464), protopack.Uvarint(656565)},
816 protopack.Tag{57, protopack.BytesType}, protopack.LengthPrefix{protopack.Float32(32), protopack.Float32(33)},
817 protopack.Tag{58, protopack.BytesType}, protopack.LengthPrefix{protopack.Float64(64), protopack.Float64(65)},
818 protopack.Tag{70, protopack.StartGroupType},
819 protopack.Message{
820 protopack.Tag{71, protopack.BytesType}, protopack.String("required"),
821 },
822 protopack.Tag{70, protopack.EndGroupType},
823 protopack.Tag{101, protopack.BytesType}, protopack.Bytes("bytes"),
824 protopack.Tag{102, protopack.VarintType}, protopack.Svarint(-32),
825 protopack.Tag{103, protopack.VarintType}, protopack.Svarint(-64),
826 protopack.Tag{104, protopack.Fixed32Type}, protopack.Int32(-32),
827 protopack.Tag{105, protopack.Fixed64Type}, protopack.Int64(-64),
828 protopack.Tag{502, protopack.BytesType}, protopack.LengthPrefix{protopack.Svarint(32), protopack.Svarint(-32)},
829 protopack.Tag{503, protopack.BytesType}, protopack.LengthPrefix{protopack.Svarint(64), protopack.Svarint(-64)},
830 protopack.Tag{504, protopack.BytesType}, protopack.LengthPrefix{protopack.Int32(32), protopack.Int32(-32)},
831 protopack.Tag{505, protopack.BytesType}, protopack.LengthPrefix{protopack.Int64(64), protopack.Int64(-64)},
832 }.Marshal())
833}

Callers

nothing calls this directly

Calls 5

initGoTestFunction · 0.85
overifyFunction · 0.85
BytesMethod · 0.80
MarshalMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected