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

Function TestUnmarshalFuzz

proto/proto_test.go:1522–1534  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1520}
1521
1522func TestUnmarshalFuzz(t *testing.T) {
1523 const N = 1000
1524 seed := time.Now().UnixNano()
1525 t.Logf("RNG seed is %d", seed)
1526 rng := rand.New(rand.NewSource(seed))
1527 buf := make([]byte, 20)
1528 for i := 0; i < N; i++ {
1529 for j := range buf {
1530 buf[j] = byte(rng.Intn(256))
1531 }
1532 fuzzUnmarshal(t, buf)
1533 }
1534}
1535
1536func TestMergeMessages(t *testing.T) {
1537 pb := &pb2.MessageList{Message: []*pb2.MessageList_Message{{Name: proto.String("x"), Count: proto.Int32(1)}}}

Callers

nothing calls this directly

Calls 2

fuzzUnmarshalFunction · 0.85
NewMethod · 0.45

Tested by

no test coverage detected