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

Function TestEncodeDecode1

proto/proto_test.go:423–453  ·  view source on GitHub ↗

All required fields set, no defaults provided.

(t *testing.T)

Source from the content-addressed store, hash-verified

421
422// All required fields set, no defaults provided.
423func TestEncodeDecode1(t *testing.T) {
424 pb := initGoTest(false)
425 overify(t, pb,
426 protopack.Message{
427 protopack.Tag{1, protopack.VarintType}, protopack.Uvarint(7),
428 protopack.Tag{4, protopack.BytesType}, protopack.LengthPrefix(protopack.Message{
429 protopack.Tag{1, protopack.BytesType}, protopack.String("label"),
430 protopack.Tag{2, protopack.BytesType}, protopack.String("type"),
431 }),
432 protopack.Tag{10, protopack.VarintType}, protopack.Bool(true),
433 protopack.Tag{11, protopack.VarintType}, protopack.Varint(3),
434 protopack.Tag{12, protopack.VarintType}, protopack.Varint(6),
435 protopack.Tag{13, protopack.Fixed32Type}, protopack.Uint32(32),
436 protopack.Tag{14, protopack.Fixed64Type}, protopack.Uint64(64),
437 protopack.Tag{15, protopack.VarintType}, protopack.Uvarint(3232),
438 protopack.Tag{16, protopack.VarintType}, protopack.Uvarint(6464),
439 protopack.Tag{17, protopack.Fixed32Type}, protopack.Float32(3232),
440 protopack.Tag{18, protopack.Fixed64Type}, protopack.Float64(6464),
441 protopack.Tag{19, protopack.BytesType}, protopack.String("string"),
442 protopack.Tag{70, protopack.StartGroupType},
443 protopack.Message{
444 protopack.Tag{71, protopack.BytesType}, protopack.String("required"),
445 },
446 protopack.Tag{70, protopack.EndGroupType},
447 protopack.Tag{101, protopack.BytesType}, protopack.Bytes("bytes"),
448 protopack.Tag{102, protopack.VarintType}, protopack.Svarint(-32),
449 protopack.Tag{103, protopack.VarintType}, protopack.Svarint(-64),
450 protopack.Tag{104, protopack.Fixed32Type}, protopack.Int32(-32),
451 protopack.Tag{105, protopack.Fixed64Type}, protopack.Int64(-64),
452 }.Marshal())
453}
454
455// All required fields set, defaults provided.
456func TestEncodeDecode2(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