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

Function TestNidRepNativeMarshalTo

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

Source from the content-addressed store, hash-verified

260}
261
262func TestNidRepNativeMarshalTo(t *testing.T) {
263 seed := time.Now().UnixNano()
264 popr := math_rand.New(math_rand.NewSource(seed))
265 p := NewPopulatedNidRepNative(popr, false)
266 size := p.Size()
267 dAtA := make([]byte, size)
268 for i := range dAtA {
269 dAtA[i] = byte(popr.Intn(256))
270 }
271 _, err := p.MarshalTo(dAtA)
272 if err != nil {
273 t.Fatalf("seed = %d, err = %v", seed, err)
274 }
275 msg := &NidRepNative{}
276 if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
277 t.Fatalf("seed = %d, err = %v", seed, err)
278 }
279 for i := range dAtA {
280 dAtA[i] = byte(popr.Intn(256))
281 }
282 if err := p.VerboseEqual(msg); err != nil {
283 t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
284 }
285 if !p.Equal(msg) {
286 t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
287 }
288}
289
290func BenchmarkNidRepNativeProtoMarshal(b *testing.B) {
291 popr := math_rand.New(math_rand.NewSource(616))

Callers

nothing calls this directly

Calls 7

NewPopulatedNidRepNativeFunction · 0.70
SizeMethod · 0.65
IntnMethod · 0.65
MarshalToMethod · 0.65
UnmarshalMethod · 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…