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

Function TestReset

proto/proto_test.go:402–420  ·  view source on GitHub ↗

Does Reset() reset?

(t *testing.T)

Source from the content-addressed store, hash-verified

400
401// Does Reset() reset?
402func TestReset(t *testing.T) {
403 pb := initGoTest(true)
404 // muck with some values
405 pb.F_BoolDefaulted = proto.Bool(false)
406 pb.F_Int32Defaulted = proto.Int32(237)
407 pb.F_Int64Defaulted = proto.Int64(12346)
408 pb.F_Fixed32Defaulted = proto.Uint32(32000)
409 pb.F_Fixed64Defaulted = proto.Uint64(666)
410 pb.F_Uint32Defaulted = proto.Uint32(323232)
411 pb.F_Uint64Defaulted = nil
412 pb.F_FloatDefaulted = nil
413 pb.F_DoubleDefaulted = proto.Float64(0)
414 pb.F_StringDefaulted = proto.String("gotcha")
415 pb.F_BytesDefaulted = []byte("asdfasdf")
416 pb.F_Sint32Defaulted = proto.Int32(123)
417 pb.F_Sint64Defaulted = proto.Int64(789)
418 pb.Reset()
419 checkInitialized(pb, t)
420}
421
422// All required fields set, no defaults provided.
423func TestEncodeDecode1(t *testing.T) {

Callers

nothing calls this directly

Calls 10

BoolFunction · 0.92
Int32Function · 0.92
Int64Function · 0.92
Uint32Function · 0.92
Uint64Function · 0.92
Float64Function · 0.92
StringFunction · 0.92
initGoTestFunction · 0.85
checkInitializedFunction · 0.85
ResetMethod · 0.45

Tested by

no test coverage detected