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

Function TestNinRepNativeProto

test/combos/both/thetestpb_test.go:330–362  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

328}
329
330func TestNinRepNativeProto(t *testing.T) {
331 seed := time.Now().UnixNano()
332 popr := math_rand.New(math_rand.NewSource(seed))
333 p := NewPopulatedNinRepNative(popr, false)
334 dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
335 if err != nil {
336 t.Fatalf("seed = %d, err = %v", seed, err)
337 }
338 msg := &NinRepNative{}
339 if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
340 t.Fatalf("seed = %d, err = %v", seed, err)
341 }
342 littlefuzz := make([]byte, len(dAtA))
343 copy(littlefuzz, dAtA)
344 for i := range dAtA {
345 dAtA[i] = byte(popr.Intn(256))
346 }
347 if err := p.VerboseEqual(msg); err != nil {
348 t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
349 }
350 if !p.Equal(msg) {
351 t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
352 }
353 if len(littlefuzz) > 0 {
354 fuzzamount := 100
355 for i := 0; i < fuzzamount; i++ {
356 littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
357 littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
358 }
359 // shouldn't panic
360 _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
361 }
362}
363
364func TestNinRepNativeMarshalTo(t *testing.T) {
365 seed := time.Now().UnixNano()

Callers

nothing calls this directly

Calls 6

NewPopulatedNinRepNativeFunction · 0.70
MarshalMethod · 0.65
UnmarshalMethod · 0.65
IntnMethod · 0.65
VerboseEqualMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…