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

Function initGoTest

proto/proto_test.go:58–98  ·  view source on GitHub ↗
(setdefaults bool)

Source from the content-addressed store, hash-verified

56}
57
58func initGoTest(setdefaults bool) *pb2.GoTest {
59 pb := new(pb2.GoTest)
60 if setdefaults {
61 pb.F_BoolDefaulted = proto.Bool(pb2.Default_GoTest_F_BoolDefaulted)
62 pb.F_Int32Defaulted = proto.Int32(pb2.Default_GoTest_F_Int32Defaulted)
63 pb.F_Int64Defaulted = proto.Int64(pb2.Default_GoTest_F_Int64Defaulted)
64 pb.F_Fixed32Defaulted = proto.Uint32(pb2.Default_GoTest_F_Fixed32Defaulted)
65 pb.F_Fixed64Defaulted = proto.Uint64(pb2.Default_GoTest_F_Fixed64Defaulted)
66 pb.F_Uint32Defaulted = proto.Uint32(pb2.Default_GoTest_F_Uint32Defaulted)
67 pb.F_Uint64Defaulted = proto.Uint64(pb2.Default_GoTest_F_Uint64Defaulted)
68 pb.F_FloatDefaulted = proto.Float32(pb2.Default_GoTest_F_FloatDefaulted)
69 pb.F_DoubleDefaulted = proto.Float64(pb2.Default_GoTest_F_DoubleDefaulted)
70 pb.F_StringDefaulted = proto.String(pb2.Default_GoTest_F_StringDefaulted)
71 pb.F_BytesDefaulted = pb2.Default_GoTest_F_BytesDefaulted
72 pb.F_Sint32Defaulted = proto.Int32(pb2.Default_GoTest_F_Sint32Defaulted)
73 pb.F_Sint64Defaulted = proto.Int64(pb2.Default_GoTest_F_Sint64Defaulted)
74 pb.F_Sfixed32Defaulted = proto.Int32(pb2.Default_GoTest_F_Sfixed32Defaulted)
75 pb.F_Sfixed64Defaulted = proto.Int64(pb2.Default_GoTest_F_Sfixed64Defaulted)
76 }
77
78 pb.Kind = pb2.GoTest_TIME.Enum()
79 pb.RequiredField = initGoTestField()
80 pb.F_BoolRequired = proto.Bool(true)
81 pb.F_Int32Required = proto.Int32(3)
82 pb.F_Int64Required = proto.Int64(6)
83 pb.F_Fixed32Required = proto.Uint32(32)
84 pb.F_Fixed64Required = proto.Uint64(64)
85 pb.F_Uint32Required = proto.Uint32(3232)
86 pb.F_Uint64Required = proto.Uint64(6464)
87 pb.F_FloatRequired = proto.Float32(3232)
88 pb.F_DoubleRequired = proto.Float64(6464)
89 pb.F_StringRequired = proto.String("string")
90 pb.F_BytesRequired = []byte("bytes")
91 pb.F_Sint32Required = proto.Int32(-32)
92 pb.F_Sint64Required = proto.Int64(-64)
93 pb.F_Sfixed32Required = proto.Int32(-32)
94 pb.F_Sfixed64Required = proto.Int64(-64)
95 pb.Requiredgroup = initGoTest_RequiredGroup()
96
97 return pb
98}
99
100func overify(t *testing.T, pb *pb2.GoTest, want []byte) {
101 bb := new(proto.Buffer)

Callers 14

TestResetFunction · 0.85
TestEncodeDecode1Function · 0.85
TestEncodeDecode2Function · 0.85
TestEncodeDecode3Function · 0.85
TestEncodeDecode4Function · 0.85
TestEncodeDecode5Function · 0.85
TestEncodeDecode6Function · 0.85
TestEncodeDecodeBytes1Function · 0.85
TestEncodeDecodeBytes2Function · 0.85
TestBigRepeatedFunction · 0.85
TestRequiredNotSetErrorFunction · 0.85
TestConcurrentMarshalFunction · 0.85

Calls 11

BoolFunction · 0.92
Int32Function · 0.92
Int64Function · 0.92
Uint32Function · 0.92
Uint64Function · 0.92
Float32Function · 0.92
Float64Function · 0.92
StringFunction · 0.92
initGoTestFieldFunction · 0.85
initGoTest_RequiredGroupFunction · 0.85
EnumMethod · 0.45

Tested by

no test coverage detected