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

Function TestEncodeDecode3

proto/all_test.go:589–644  ·  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

587
588// All default fields set to their default value by hand
589func TestEncodeDecode3(t *testing.T) {
590 pb := initGoTest(false)
591 pb.F_BoolDefaulted = Bool(true)
592 pb.F_Int32Defaulted = Int32(32)
593 pb.F_Int64Defaulted = Int64(64)
594 pb.F_Fixed32Defaulted = Uint32(320)
595 pb.F_Fixed64Defaulted = Uint64(640)
596 pb.F_Uint32Defaulted = Uint32(3200)
597 pb.F_Uint64Defaulted = Uint64(6400)
598 pb.F_FloatDefaulted = Float32(314159)
599 pb.F_DoubleDefaulted = Float64(271828)
600 pb.F_StringDefaulted = String("hello, \"world!\"\n")
601 pb.F_BytesDefaulted = []byte("Bignose")
602 pb.F_Sint32Defaulted = Int32(-32)
603 pb.F_Sint64Defaulted = Int64(-64)
604 pb.F_Sfixed32Defaulted = Int32(-32)
605 pb.F_Sfixed64Defaulted = Int64(-64)
606
607 overify(t, pb,
608 "0807"+ // field 1, encoding 0, value 7
609 "220d"+"0a056c6162656c120474797065"+ // field 4, encoding 2 (GoTestField)
610 "5001"+ // field 10, encoding 0, value 1
611 "5803"+ // field 11, encoding 0, value 3
612 "6006"+ // field 12, encoding 0, value 6
613 "6d20000000"+ // field 13, encoding 5, value 32
614 "714000000000000000"+ // field 14, encoding 1, value 64
615 "78a019"+ // field 15, encoding 0, value 3232
616 "8001c032"+ // field 16, encoding 0, value 6464
617 "8d0100004a45"+ // field 17, encoding 5, value 3232.0
618 "9101000000000040b940"+ // field 18, encoding 1, value 6464.0
619 "9a0106"+"737472696e67"+ // field 19, encoding 2 string "string"
620 "c00201"+ // field 40, encoding 0, value 1
621 "c80220"+ // field 41, encoding 0, value 32
622 "d00240"+ // field 42, encoding 0, value 64
623 "dd0240010000"+ // field 43, encoding 5, value 320
624 "e1028002000000000000"+ // field 44, encoding 1, value 640
625 "e8028019"+ // field 45, encoding 0, value 3200
626 "f0028032"+ // field 46, encoding 0, value 6400
627 "fd02e0659948"+ // field 47, encoding 5, value 314159.0
628 "81030000000050971041"+ // field 48, encoding 1, value 271828.0
629 "8a0310"+"68656c6c6f2c2022776f726c6421220a"+ // field 49, encoding 2 string "hello, \"world!\"\n"
630 "b304"+ // start group field 70 level 1
631 "ba0408"+"7265717569726564"+ // field 71, encoding 2, string "required"
632 "b404"+ // end group field 70 level 1
633 "aa0605"+"6279746573"+ // field 101, encoding 2 string "bytes"
634 "b0063f"+ // field 102, encoding 0, 0x3f zigzag32
635 "b8067f"+ // field 103, encoding 0, 0x7f zigzag64
636 "c506e0ffffff"+ // field 104, encoding 5, -32 fixed32
637 "c906c0ffffffffffffff"+ // field 105, encoding 1, -64 fixed64
638 "8a1907"+"4269676e6f7365"+ // field 401, encoding 2, string "Bignose"
639 "90193f"+ // field 402, encoding 0, value 63
640 "98197f"+ // field 403, encoding 0, value 127
641 "a519e0ffffff"+ // field 404, encoding 5, -32 fixed32
642 "a919c0ffffffffffffff") // field 405, encoding 1, -64 fixed64
643
644}
645
646// All required fields set, defaults provided, all non-defaulted optional fields have values.

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…