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

Function TestEncodeDecode3

proto/proto_test.go:504–565  ·  view source on GitHub ↗

All default fields set to their default value by hand

(t *testing.T)

Source from the content-addressed store, hash-verified

502
503// All default fields set to their default value by hand
504func TestEncodeDecode3(t *testing.T) {
505 pb := initGoTest(false)
506 pb.F_BoolDefaulted = proto.Bool(true)
507 pb.F_Int32Defaulted = proto.Int32(32)
508 pb.F_Int64Defaulted = proto.Int64(64)
509 pb.F_Fixed32Defaulted = proto.Uint32(320)
510 pb.F_Fixed64Defaulted = proto.Uint64(640)
511 pb.F_Uint32Defaulted = proto.Uint32(3200)
512 pb.F_Uint64Defaulted = proto.Uint64(6400)
513 pb.F_FloatDefaulted = proto.Float32(314159)
514 pb.F_DoubleDefaulted = proto.Float64(271828)
515 pb.F_StringDefaulted = proto.String("hello, \"world!\"\n")
516 pb.F_BytesDefaulted = []byte("Bignose")
517 pb.F_Sint32Defaulted = proto.Int32(-32)
518 pb.F_Sint64Defaulted = proto.Int64(-64)
519 pb.F_Sfixed32Defaulted = proto.Int32(-32)
520 pb.F_Sfixed64Defaulted = proto.Int64(-64)
521
522 overify(t, pb,
523 protopack.Message{
524 protopack.Tag{1, protopack.VarintType}, protopack.Uvarint(7),
525 protopack.Tag{4, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
526 protopack.Tag{1, protopack.BytesType}, protopack.String("label"),
527 protopack.Tag{2, protopack.BytesType}, protopack.String("type"),
528 }),
529 protopack.Tag{10, protopack.VarintType}, protopack.Bool(true),
530 protopack.Tag{11, protopack.VarintType}, protopack.Varint(3),
531 protopack.Tag{12, protopack.VarintType}, protopack.Varint(6),
532 protopack.Tag{13, protopack.Fixed32Type}, protopack.Uint32(32),
533 protopack.Tag{14, protopack.Fixed64Type}, protopack.Uint64(64),
534 protopack.Tag{15, protopack.VarintType}, protopack.Uvarint(3232),
535 protopack.Tag{16, protopack.VarintType}, protopack.Uvarint(6464),
536 protopack.Tag{17, protopack.Fixed32Type}, protopack.Float32(3232),
537 protopack.Tag{18, protopack.Fixed64Type}, protopack.Float64(6464),
538 protopack.Tag{19, protopack.BytesType}, protopack.String("string"),
539 protopack.Tag{40, protopack.VarintType}, protopack.Bool(true),
540 protopack.Tag{41, protopack.VarintType}, protopack.Varint(32),
541 protopack.Tag{42, protopack.VarintType}, protopack.Varint(64),
542 protopack.Tag{43, protopack.Fixed32Type}, protopack.Uint32(320),
543 protopack.Tag{44, protopack.Fixed64Type}, protopack.Uint64(640),
544 protopack.Tag{45, protopack.VarintType}, protopack.Uvarint(3200),
545 protopack.Tag{46, protopack.VarintType}, protopack.Uvarint(6400),
546 protopack.Tag{47, protopack.Fixed32Type}, protopack.Float32(314159),
547 protopack.Tag{48, protopack.Fixed64Type}, protopack.Float64(271828),
548 protopack.Tag{49, protopack.BytesType}, protopack.String("hello, \"world!\"\n"),
549 protopack.Tag{70, protopack.StartGroupType},
550 protopack.Message{
551 protopack.Tag{71, protopack.BytesType}, protopack.String("required"),
552 },
553 protopack.Tag{70, protopack.EndGroupType},
554 protopack.Tag{101, protopack.BytesType}, protopack.Bytes("bytes"),
555 protopack.Tag{102, protopack.VarintType}, protopack.Svarint(-32),
556 protopack.Tag{103, protopack.VarintType}, protopack.Svarint(-64),
557 protopack.Tag{104, protopack.Fixed32Type}, protopack.Int32(-32),
558 protopack.Tag{105, protopack.Fixed64Type}, protopack.Int64(-64),
559 protopack.Tag{401, protopack.BytesType}, protopack.Bytes("Bignose"),
560 protopack.Tag{402, protopack.VarintType}, protopack.Svarint(-32),
561 protopack.Tag{403, protopack.VarintType}, protopack.Svarint(-64),

Callers

nothing calls this directly

Calls 13

BoolFunction · 0.92
Int32Function · 0.92
Int64Function · 0.92
Uint32Function · 0.92
Uint64Function · 0.92
Float32Function · 0.92
Float64Function · 0.92
StringFunction · 0.92
initGoTestFunction · 0.85
overifyFunction · 0.85
BytesMethod · 0.80
MarshalMethod · 0.65

Tested by

no test coverage detected