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

Function TestEncodeDecode2

proto/proto_test.go:456–501  ·  view source on GitHub ↗

All required fields set, defaults provided.

(t *testing.T)

Source from the content-addressed store, hash-verified

454
455// All required fields set, defaults provided.
456func TestEncodeDecode2(t *testing.T) {
457 pb := initGoTest(true)
458 overify(t, pb,
459 protopack.Message{
460 protopack.Tag{1, protopack.VarintType}, protopack.Uvarint(7),
461 protopack.Tag{4, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
462 protopack.Tag{1, protopack.BytesType}, protopack.String("label"),
463 protopack.Tag{2, protopack.BytesType}, protopack.String("type"),
464 }),
465 protopack.Tag{10, protopack.VarintType}, protopack.Bool(true),
466 protopack.Tag{11, protopack.VarintType}, protopack.Varint(3),
467 protopack.Tag{12, protopack.VarintType}, protopack.Varint(6),
468 protopack.Tag{13, protopack.Fixed32Type}, protopack.Uint32(32),
469 protopack.Tag{14, protopack.Fixed64Type}, protopack.Uint64(64),
470 protopack.Tag{15, protopack.VarintType}, protopack.Uvarint(3232),
471 protopack.Tag{16, protopack.VarintType}, protopack.Uvarint(6464),
472 protopack.Tag{17, protopack.Fixed32Type}, protopack.Float32(3232),
473 protopack.Tag{18, protopack.Fixed64Type}, protopack.Float64(6464),
474 protopack.Tag{19, protopack.BytesType}, protopack.String("string"),
475 protopack.Tag{40, protopack.VarintType}, protopack.Bool(true),
476 protopack.Tag{41, protopack.VarintType}, protopack.Varint(32),
477 protopack.Tag{42, protopack.VarintType}, protopack.Varint(64),
478 protopack.Tag{43, protopack.Fixed32Type}, protopack.Uint32(320),
479 protopack.Tag{44, protopack.Fixed64Type}, protopack.Uint64(640),
480 protopack.Tag{45, protopack.VarintType}, protopack.Uvarint(3200),
481 protopack.Tag{46, protopack.VarintType}, protopack.Uvarint(6400),
482 protopack.Tag{47, protopack.Fixed32Type}, protopack.Float32(314159),
483 protopack.Tag{48, protopack.Fixed64Type}, protopack.Float64(271828),
484 protopack.Tag{49, protopack.BytesType}, protopack.String("hello, \"world!\"\n"),
485 protopack.Tag{70, protopack.StartGroupType},
486 protopack.Message{
487 protopack.Tag{71, protopack.BytesType}, protopack.String("required"),
488 },
489 protopack.Tag{70, protopack.EndGroupType},
490 protopack.Tag{101, protopack.BytesType}, protopack.Bytes("bytes"),
491 protopack.Tag{102, protopack.VarintType}, protopack.Svarint(-32),
492 protopack.Tag{103, protopack.VarintType}, protopack.Svarint(-64),
493 protopack.Tag{104, protopack.Fixed32Type}, protopack.Int32(-32),
494 protopack.Tag{105, protopack.Fixed64Type}, protopack.Int64(-64),
495 protopack.Tag{401, protopack.BytesType}, protopack.Bytes("Bignose"),
496 protopack.Tag{402, protopack.VarintType}, protopack.Svarint(-32),
497 protopack.Tag{403, protopack.VarintType}, protopack.Svarint(-64),
498 protopack.Tag{404, protopack.Fixed32Type}, protopack.Int32(-32),
499 protopack.Tag{405, protopack.Fixed64Type}, protopack.Int64(-64),
500 }.Marshal())
501}
502
503// All default fields set to their default value by hand
504func TestEncodeDecode3(t *testing.T) {

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