func BenchmarkUnmarshalNinOptStructWhole(b *testing.B) { r := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) for i := 0; i < b.N; i++ { b.StopTimer() p := test.NewPopulatedNinOptStruct(r, false) data, err := proto.Marshal(p) if err != nil { panic(err) } b.StartTimer() pp := &test.NinOptStruct{} proto.Unmarshal(data, pp) } }
func TestString(t *testing.T) { r := rand.New(rand.NewSource(time.Now().UnixNano())) s := test.NewPopulatedNinOptStruct(r, false) data, err := proto.Marshal(s) if err != nil { panic(err) } buf := bytes.NewBuffer(nil) err = fieldpath.ToString("test", "NinOptStruct", test.ThetestDescription(), "", data, 0, os.Stdout) if err != nil { panic(err) } _ = buf t.Logf("%v", string(buf.Bytes())) }