mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-30 10:10:21 +00:00
16047 lines
479 KiB
Go
16047 lines
479 KiB
Go
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
|
// source: thetest.proto
|
|
|
|
/*
|
|
Package test is a generated protocol buffer package.
|
|
|
|
It is generated from these files:
|
|
thetest.proto
|
|
|
|
It has these top-level messages:
|
|
NidOptNative
|
|
NinOptNative
|
|
NidRepNative
|
|
NinRepNative
|
|
NidRepPackedNative
|
|
NinRepPackedNative
|
|
NidOptStruct
|
|
NinOptStruct
|
|
NidRepStruct
|
|
NinRepStruct
|
|
NidEmbeddedStruct
|
|
NinEmbeddedStruct
|
|
NidNestedStruct
|
|
NinNestedStruct
|
|
NidOptCustom
|
|
CustomDash
|
|
NinOptCustom
|
|
NidRepCustom
|
|
NinRepCustom
|
|
NinOptNativeUnion
|
|
NinOptStructUnion
|
|
NinEmbeddedStructUnion
|
|
NinNestedStructUnion
|
|
Tree
|
|
OrBranch
|
|
AndBranch
|
|
Leaf
|
|
DeepTree
|
|
ADeepBranch
|
|
AndDeepBranch
|
|
DeepLeaf
|
|
Nil
|
|
NidOptEnum
|
|
NinOptEnum
|
|
NidRepEnum
|
|
NinRepEnum
|
|
NinOptEnumDefault
|
|
AnotherNinOptEnum
|
|
AnotherNinOptEnumDefault
|
|
Timer
|
|
MyExtendable
|
|
OtherExtenable
|
|
NestedDefinition
|
|
NestedScope
|
|
NinOptNativeDefault
|
|
CustomContainer
|
|
CustomNameNidOptNative
|
|
CustomNameNinOptNative
|
|
CustomNameNinRepNative
|
|
CustomNameNinStruct
|
|
CustomNameCustomType
|
|
CustomNameNinEmbeddedStructUnion
|
|
CustomNameEnum
|
|
NoExtensionsMap
|
|
Unrecognized
|
|
UnrecognizedWithInner
|
|
UnrecognizedWithEmbed
|
|
Node
|
|
NonByteCustomType
|
|
NidOptNonByteCustomType
|
|
NinOptNonByteCustomType
|
|
NidRepNonByteCustomType
|
|
NinRepNonByteCustomType
|
|
ProtoType
|
|
*/
|
|
package test
|
|
|
|
import testing "testing"
|
|
import math_rand "math/rand"
|
|
import time "time"
|
|
import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
|
|
import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb"
|
|
import fmt "fmt"
|
|
import go_parser "go/parser"
|
|
import proto "github.com/gogo/protobuf/proto"
|
|
import math "math"
|
|
import _ "github.com/gogo/protobuf/gogoproto"
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
var _ = proto.Marshal
|
|
var _ = fmt.Errorf
|
|
var _ = math.Inf
|
|
|
|
func TestNidOptNativeProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidOptNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidOptNativeProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidOptNative, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNidOptNative(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNidOptNativeProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNidOptNative(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NidOptNative{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinOptNativeProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinOptNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinOptNativeProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinOptNative, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNinOptNative(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNinOptNativeProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNinOptNative(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NinOptNative{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidRepNativeProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidRepNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidRepNativeProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidRepNative, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNidRepNative(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNidRepNativeProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNidRepNative(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NidRepNative{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinRepNativeProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinRepNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinRepNativeProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinRepNative, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNinRepNative(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNinRepNativeProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNinRepNative(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NinRepNative{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidRepPackedNativeProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepPackedNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidRepPackedNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidRepPackedNativeProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidRepPackedNative, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNidRepPackedNative(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNidRepPackedNativeProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNidRepPackedNative(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NidRepPackedNative{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinRepPackedNativeProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepPackedNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinRepPackedNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinRepPackedNativeProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinRepPackedNative, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNinRepPackedNative(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNinRepPackedNativeProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNinRepPackedNative(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NinRepPackedNative{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidOptStructProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidOptStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidOptStructProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidOptStruct, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNidOptStruct(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNidOptStructProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNidOptStruct(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NidOptStruct{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinOptStructProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinOptStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinOptStructProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinOptStruct, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNinOptStruct(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNinOptStructProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNinOptStruct(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NinOptStruct{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidRepStructProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidRepStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidRepStructProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidRepStruct, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNidRepStruct(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNidRepStructProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNidRepStruct(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NidRepStruct{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinRepStructProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinRepStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinRepStructProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinRepStruct, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNinRepStruct(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNinRepStructProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNinRepStruct(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NinRepStruct{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidEmbeddedStructProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidEmbeddedStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidEmbeddedStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidEmbeddedStructProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidEmbeddedStruct, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNidEmbeddedStruct(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNidEmbeddedStructProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNidEmbeddedStruct(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NidEmbeddedStruct{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinEmbeddedStructProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinEmbeddedStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinEmbeddedStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinEmbeddedStructProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinEmbeddedStruct, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNinEmbeddedStruct(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNinEmbeddedStructProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNinEmbeddedStruct(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NinEmbeddedStruct{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidNestedStructProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidNestedStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidNestedStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidNestedStructProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidNestedStruct, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNidNestedStruct(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNidNestedStructProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNidNestedStruct(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NidNestedStruct{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinNestedStructProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinNestedStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinNestedStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinNestedStructProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinNestedStruct, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNinNestedStruct(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNinNestedStructProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNinNestedStruct(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NinNestedStruct{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidOptCustomProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptCustom(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidOptCustom{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidOptCustomProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidOptCustom, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNidOptCustom(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNidOptCustomProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNidOptCustom(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NidOptCustom{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestCustomDashProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomDash(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &CustomDash{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkCustomDashProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*CustomDash, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedCustomDash(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkCustomDashProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedCustomDash(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &CustomDash{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinOptCustomProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptCustom(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinOptCustom{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinOptCustomProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinOptCustom, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNinOptCustom(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNinOptCustomProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNinOptCustom(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NinOptCustom{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidRepCustomProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepCustom(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidRepCustom{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidRepCustomProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidRepCustom, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNidRepCustom(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNidRepCustomProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNidRepCustom(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NidRepCustom{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinRepCustomProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepCustom(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinRepCustom{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinRepCustomProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinRepCustom, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNinRepCustom(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNinRepCustomProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNinRepCustom(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NinRepCustom{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinOptNativeUnionProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptNativeUnion(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinOptNativeUnion{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinOptNativeUnionProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinOptNativeUnion, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNinOptNativeUnion(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNinOptNativeUnionProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNinOptNativeUnion(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NinOptNativeUnion{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinOptStructUnionProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptStructUnion(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinOptStructUnion{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinOptStructUnionProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinOptStructUnion, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNinOptStructUnion(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNinOptStructUnionProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNinOptStructUnion(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NinOptStructUnion{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinEmbeddedStructUnionProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinEmbeddedStructUnion(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinEmbeddedStructUnion{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinEmbeddedStructUnionProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinEmbeddedStructUnion, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNinEmbeddedStructUnion(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNinEmbeddedStructUnionProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNinEmbeddedStructUnion(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NinEmbeddedStructUnion{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinNestedStructUnionProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinNestedStructUnion(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinNestedStructUnion{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinNestedStructUnionProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinNestedStructUnion, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNinNestedStructUnion(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNinNestedStructUnionProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNinNestedStructUnion(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NinNestedStructUnion{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestTreeProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedTree(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &Tree{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkTreeProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*Tree, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedTree(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkTreeProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedTree(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &Tree{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestOrBranchProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedOrBranch(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &OrBranch{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkOrBranchProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*OrBranch, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedOrBranch(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkOrBranchProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedOrBranch(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &OrBranch{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestAndBranchProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedAndBranch(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &AndBranch{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkAndBranchProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*AndBranch, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedAndBranch(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkAndBranchProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedAndBranch(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &AndBranch{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestLeafProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedLeaf(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &Leaf{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkLeafProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*Leaf, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedLeaf(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkLeafProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedLeaf(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &Leaf{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestDeepTreeProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedDeepTree(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &DeepTree{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkDeepTreeProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*DeepTree, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedDeepTree(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkDeepTreeProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedDeepTree(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &DeepTree{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestADeepBranchProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedADeepBranch(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &ADeepBranch{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkADeepBranchProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*ADeepBranch, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedADeepBranch(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkADeepBranchProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedADeepBranch(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &ADeepBranch{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestAndDeepBranchProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedAndDeepBranch(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &AndDeepBranch{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkAndDeepBranchProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*AndDeepBranch, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedAndDeepBranch(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkAndDeepBranchProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedAndDeepBranch(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &AndDeepBranch{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestDeepLeafProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedDeepLeaf(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &DeepLeaf{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkDeepLeafProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*DeepLeaf, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedDeepLeaf(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkDeepLeafProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedDeepLeaf(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &DeepLeaf{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNilProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNil(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &Nil{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNilProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*Nil, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNil(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNilProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNil(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &Nil{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidOptEnumProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptEnum(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidOptEnum{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidOptEnumProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidOptEnum, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNidOptEnum(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNidOptEnumProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNidOptEnum(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NidOptEnum{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinOptEnumProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptEnum(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinOptEnum{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinOptEnumProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinOptEnum, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNinOptEnum(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNinOptEnumProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNinOptEnum(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NinOptEnum{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidRepEnumProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepEnum(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidRepEnum{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidRepEnumProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidRepEnum, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNidRepEnum(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNidRepEnumProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNidRepEnum(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NidRepEnum{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinRepEnumProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepEnum(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinRepEnum{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinRepEnumProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinRepEnum, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNinRepEnum(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNinRepEnumProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNinRepEnum(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NinRepEnum{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinOptEnumDefaultProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptEnumDefault(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinOptEnumDefault{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinOptEnumDefaultProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinOptEnumDefault, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNinOptEnumDefault(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNinOptEnumDefaultProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNinOptEnumDefault(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NinOptEnumDefault{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestAnotherNinOptEnumProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedAnotherNinOptEnum(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &AnotherNinOptEnum{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkAnotherNinOptEnumProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*AnotherNinOptEnum, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedAnotherNinOptEnum(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkAnotherNinOptEnumProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedAnotherNinOptEnum(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &AnotherNinOptEnum{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestAnotherNinOptEnumDefaultProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedAnotherNinOptEnumDefault(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &AnotherNinOptEnumDefault{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkAnotherNinOptEnumDefaultProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*AnotherNinOptEnumDefault, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedAnotherNinOptEnumDefault(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkAnotherNinOptEnumDefaultProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedAnotherNinOptEnumDefault(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &AnotherNinOptEnumDefault{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestTimerProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedTimer(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &Timer{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkTimerProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*Timer, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedTimer(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkTimerProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedTimer(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &Timer{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestMyExtendableProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedMyExtendable(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &MyExtendable{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkMyExtendableProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*MyExtendable, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedMyExtendable(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkMyExtendableProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedMyExtendable(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &MyExtendable{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestOtherExtenableProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedOtherExtenable(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &OtherExtenable{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkOtherExtenableProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*OtherExtenable, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedOtherExtenable(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkOtherExtenableProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedOtherExtenable(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &OtherExtenable{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNestedDefinitionProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNestedDefinition(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NestedDefinition{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNestedDefinitionProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NestedDefinition, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNestedDefinition(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNestedDefinitionProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNestedDefinition(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NestedDefinition{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNestedDefinition_NestedMessageProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNestedDefinition_NestedMessage(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NestedDefinition_NestedMessage{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNestedDefinition_NestedMessageProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NestedDefinition_NestedMessage, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNestedDefinition_NestedMessage(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNestedDefinition_NestedMessageProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNestedDefinition_NestedMessage(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NestedDefinition_NestedMessage{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNestedDefinition_NestedMessage_NestedNestedMsgProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNestedDefinition_NestedMessage_NestedNestedMsg(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NestedDefinition_NestedMessage_NestedNestedMsg{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNestedDefinition_NestedMessage_NestedNestedMsgProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NestedDefinition_NestedMessage_NestedNestedMsg, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNestedDefinition_NestedMessage_NestedNestedMsg(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNestedDefinition_NestedMessage_NestedNestedMsgProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNestedDefinition_NestedMessage_NestedNestedMsg(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NestedDefinition_NestedMessage_NestedNestedMsg{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNestedScopeProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNestedScope(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NestedScope{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNestedScopeProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NestedScope, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNestedScope(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNestedScopeProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNestedScope(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NestedScope{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinOptNativeDefaultProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptNativeDefault(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinOptNativeDefault{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinOptNativeDefaultProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinOptNativeDefault, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNinOptNativeDefault(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNinOptNativeDefaultProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNinOptNativeDefault(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NinOptNativeDefault{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestCustomContainerProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomContainer(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &CustomContainer{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkCustomContainerProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*CustomContainer, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedCustomContainer(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkCustomContainerProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedCustomContainer(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &CustomContainer{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestCustomNameNidOptNativeProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNidOptNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &CustomNameNidOptNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkCustomNameNidOptNativeProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*CustomNameNidOptNative, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedCustomNameNidOptNative(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkCustomNameNidOptNativeProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedCustomNameNidOptNative(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &CustomNameNidOptNative{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestCustomNameNinOptNativeProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNinOptNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &CustomNameNinOptNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkCustomNameNinOptNativeProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*CustomNameNinOptNative, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedCustomNameNinOptNative(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkCustomNameNinOptNativeProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedCustomNameNinOptNative(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &CustomNameNinOptNative{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestCustomNameNinRepNativeProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNinRepNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &CustomNameNinRepNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkCustomNameNinRepNativeProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*CustomNameNinRepNative, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedCustomNameNinRepNative(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkCustomNameNinRepNativeProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedCustomNameNinRepNative(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &CustomNameNinRepNative{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestCustomNameNinStructProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNinStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &CustomNameNinStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkCustomNameNinStructProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*CustomNameNinStruct, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedCustomNameNinStruct(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkCustomNameNinStructProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedCustomNameNinStruct(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &CustomNameNinStruct{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestCustomNameCustomTypeProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameCustomType(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &CustomNameCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkCustomNameCustomTypeProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*CustomNameCustomType, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedCustomNameCustomType(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkCustomNameCustomTypeProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedCustomNameCustomType(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &CustomNameCustomType{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestCustomNameNinEmbeddedStructUnionProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNinEmbeddedStructUnion(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &CustomNameNinEmbeddedStructUnion{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkCustomNameNinEmbeddedStructUnionProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*CustomNameNinEmbeddedStructUnion, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedCustomNameNinEmbeddedStructUnion(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkCustomNameNinEmbeddedStructUnionProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedCustomNameNinEmbeddedStructUnion(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &CustomNameNinEmbeddedStructUnion{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestCustomNameEnumProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameEnum(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &CustomNameEnum{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkCustomNameEnumProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*CustomNameEnum, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedCustomNameEnum(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkCustomNameEnumProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedCustomNameEnum(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &CustomNameEnum{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNoExtensionsMapProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNoExtensionsMap(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NoExtensionsMap{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNoExtensionsMapProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NoExtensionsMap, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNoExtensionsMap(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNoExtensionsMapProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNoExtensionsMap(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NoExtensionsMap{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestUnrecognizedProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognized(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &Unrecognized{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkUnrecognizedProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*Unrecognized, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedUnrecognized(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkUnrecognizedProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedUnrecognized(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &Unrecognized{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestUnrecognizedWithInnerProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognizedWithInner(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &UnrecognizedWithInner{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkUnrecognizedWithInnerProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*UnrecognizedWithInner, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedUnrecognizedWithInner(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkUnrecognizedWithInnerProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedUnrecognizedWithInner(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &UnrecognizedWithInner{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestUnrecognizedWithInner_InnerProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognizedWithInner_Inner(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &UnrecognizedWithInner_Inner{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkUnrecognizedWithInner_InnerProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*UnrecognizedWithInner_Inner, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedUnrecognizedWithInner_Inner(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkUnrecognizedWithInner_InnerProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedUnrecognizedWithInner_Inner(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &UnrecognizedWithInner_Inner{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestUnrecognizedWithEmbedProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognizedWithEmbed(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &UnrecognizedWithEmbed{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkUnrecognizedWithEmbedProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*UnrecognizedWithEmbed, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedUnrecognizedWithEmbed(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkUnrecognizedWithEmbedProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedUnrecognizedWithEmbed(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &UnrecognizedWithEmbed{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestUnrecognizedWithEmbed_EmbeddedProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognizedWithEmbed_Embedded(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &UnrecognizedWithEmbed_Embedded{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkUnrecognizedWithEmbed_EmbeddedProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*UnrecognizedWithEmbed_Embedded, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedUnrecognizedWithEmbed_Embedded(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkUnrecognizedWithEmbed_EmbeddedProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedUnrecognizedWithEmbed_Embedded(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &UnrecognizedWithEmbed_Embedded{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNodeProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNode(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &Node{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNodeProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*Node, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNode(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNodeProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNode(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &Node{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNonByteCustomTypeProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNonByteCustomType(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNonByteCustomTypeProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NonByteCustomType, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNonByteCustomType(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNonByteCustomTypeProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNonByteCustomType(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NonByteCustomType{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidOptNonByteCustomTypeProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptNonByteCustomType(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidOptNonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidOptNonByteCustomTypeProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidOptNonByteCustomType, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNidOptNonByteCustomType(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNidOptNonByteCustomTypeProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNidOptNonByteCustomType(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NidOptNonByteCustomType{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinOptNonByteCustomTypeProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptNonByteCustomType(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinOptNonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinOptNonByteCustomTypeProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinOptNonByteCustomType, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNinOptNonByteCustomType(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNinOptNonByteCustomTypeProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNinOptNonByteCustomType(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NinOptNonByteCustomType{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidRepNonByteCustomTypeProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepNonByteCustomType(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidRepNonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidRepNonByteCustomTypeProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidRepNonByteCustomType, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNidRepNonByteCustomType(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNidRepNonByteCustomTypeProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNidRepNonByteCustomType(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NidRepNonByteCustomType{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinRepNonByteCustomTypeProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepNonByteCustomType(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinRepNonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinRepNonByteCustomTypeProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinRepNonByteCustomType, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedNinRepNonByteCustomType(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkNinRepNonByteCustomTypeProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedNinRepNonByteCustomType(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &NinRepNonByteCustomType{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestProtoTypeProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedProtoType(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &ProtoType{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
littlefuzz := make([]byte, len(dAtA))
|
|
copy(littlefuzz, dAtA)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
if len(littlefuzz) > 0 {
|
|
fuzzamount := 100
|
|
for i := 0; i < fuzzamount; i++ {
|
|
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
|
|
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
|
|
}
|
|
// shouldn't panic
|
|
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func BenchmarkProtoTypeProtoMarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*ProtoType, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
pops[i] = NewPopulatedProtoType(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
total += len(dAtA)
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func BenchmarkProtoTypeProtoUnmarshal(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
datas := make([][]byte, 10000)
|
|
for i := 0; i < 10000; i++ {
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedProtoType(popr, false))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
datas[i] = dAtA
|
|
}
|
|
msg := &ProtoType{}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += len(datas[i%10000])
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
|
panic(err)
|
|
}
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidOptNativeJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptNative(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidOptNative{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNinOptNativeJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptNative(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinOptNative{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNidRepNativeJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepNative(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidRepNative{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNinRepNativeJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepNative(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinRepNative{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNidRepPackedNativeJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepPackedNative(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidRepPackedNative{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNinRepPackedNativeJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepPackedNative(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinRepPackedNative{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNidOptStructJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptStruct(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidOptStruct{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNinOptStructJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptStruct(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinOptStruct{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNidRepStructJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepStruct(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidRepStruct{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNinRepStructJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepStruct(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinRepStruct{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNidEmbeddedStructJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidEmbeddedStruct(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidEmbeddedStruct{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNinEmbeddedStructJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinEmbeddedStruct(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinEmbeddedStruct{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNidNestedStructJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidNestedStruct(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidNestedStruct{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNinNestedStructJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinNestedStruct(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinNestedStruct{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNidOptCustomJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptCustom(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidOptCustom{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestCustomDashJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomDash(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &CustomDash{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNinOptCustomJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptCustom(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinOptCustom{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNidRepCustomJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepCustom(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidRepCustom{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNinRepCustomJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepCustom(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinRepCustom{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNinOptNativeUnionJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptNativeUnion(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinOptNativeUnion{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNinOptStructUnionJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptStructUnion(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinOptStructUnion{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNinEmbeddedStructUnionJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinEmbeddedStructUnion(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinEmbeddedStructUnion{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNinNestedStructUnionJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinNestedStructUnion(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinNestedStructUnion{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestTreeJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedTree(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &Tree{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestOrBranchJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedOrBranch(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &OrBranch{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestAndBranchJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedAndBranch(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &AndBranch{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestLeafJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedLeaf(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &Leaf{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestDeepTreeJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedDeepTree(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &DeepTree{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestADeepBranchJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedADeepBranch(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &ADeepBranch{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestAndDeepBranchJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedAndDeepBranch(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &AndDeepBranch{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestDeepLeafJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedDeepLeaf(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &DeepLeaf{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNilJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNil(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &Nil{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNidOptEnumJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptEnum(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidOptEnum{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNinOptEnumJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptEnum(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinOptEnum{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNidRepEnumJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepEnum(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidRepEnum{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNinRepEnumJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepEnum(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinRepEnum{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNinOptEnumDefaultJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptEnumDefault(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinOptEnumDefault{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestAnotherNinOptEnumJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedAnotherNinOptEnum(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &AnotherNinOptEnum{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestAnotherNinOptEnumDefaultJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedAnotherNinOptEnumDefault(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &AnotherNinOptEnumDefault{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestTimerJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedTimer(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &Timer{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestMyExtendableJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedMyExtendable(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &MyExtendable{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestOtherExtenableJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedOtherExtenable(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &OtherExtenable{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNestedDefinitionJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNestedDefinition(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NestedDefinition{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNestedDefinition_NestedMessageJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNestedDefinition_NestedMessage(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NestedDefinition_NestedMessage{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNestedDefinition_NestedMessage_NestedNestedMsgJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNestedDefinition_NestedMessage_NestedNestedMsg(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NestedDefinition_NestedMessage_NestedNestedMsg{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNestedScopeJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNestedScope(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NestedScope{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNinOptNativeDefaultJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptNativeDefault(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinOptNativeDefault{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestCustomContainerJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomContainer(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &CustomContainer{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestCustomNameNidOptNativeJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNidOptNative(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &CustomNameNidOptNative{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestCustomNameNinOptNativeJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNinOptNative(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &CustomNameNinOptNative{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestCustomNameNinRepNativeJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNinRepNative(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &CustomNameNinRepNative{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestCustomNameNinStructJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNinStruct(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &CustomNameNinStruct{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestCustomNameCustomTypeJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameCustomType(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &CustomNameCustomType{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestCustomNameNinEmbeddedStructUnionJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNinEmbeddedStructUnion(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &CustomNameNinEmbeddedStructUnion{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestCustomNameEnumJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameEnum(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &CustomNameEnum{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNoExtensionsMapJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNoExtensionsMap(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NoExtensionsMap{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestUnrecognizedJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognized(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &Unrecognized{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithInnerJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognizedWithInner(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &UnrecognizedWithInner{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithInner_InnerJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognizedWithInner_Inner(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &UnrecognizedWithInner_Inner{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithEmbedJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognizedWithEmbed(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &UnrecognizedWithEmbed{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithEmbed_EmbeddedJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognizedWithEmbed_Embedded(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &UnrecognizedWithEmbed_Embedded{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNodeJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNode(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &Node{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNonByteCustomTypeJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNonByteCustomType(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NonByteCustomType{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNidOptNonByteCustomTypeJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptNonByteCustomType(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidOptNonByteCustomType{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNinOptNonByteCustomTypeJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptNonByteCustomType(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinOptNonByteCustomType{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNidRepNonByteCustomTypeJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepNonByteCustomType(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NidRepNonByteCustomType{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNinRepNonByteCustomTypeJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepNonByteCustomType(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &NinRepNonByteCustomType{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestProtoTypeJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedProtoType(popr, true)
|
|
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &ProtoType{}
|
|
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
|
|
}
|
|
}
|
|
func TestNidOptNativeProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptNative(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NidOptNative{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidOptNativeProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptNative(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NidOptNative{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinOptNativeProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptNative(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NinOptNative{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinOptNativeProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptNative(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NinOptNative{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidRepNativeProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepNative(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NidRepNative{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidRepNativeProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepNative(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NidRepNative{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinRepNativeProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepNative(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NinRepNative{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinRepNativeProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepNative(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NinRepNative{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidRepPackedNativeProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepPackedNative(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NidRepPackedNative{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidRepPackedNativeProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepPackedNative(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NidRepPackedNative{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinRepPackedNativeProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepPackedNative(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NinRepPackedNative{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinRepPackedNativeProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepPackedNative(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NinRepPackedNative{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidOptStructProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptStruct(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NidOptStruct{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidOptStructProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptStruct(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NidOptStruct{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinOptStructProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptStruct(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NinOptStruct{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinOptStructProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptStruct(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NinOptStruct{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidRepStructProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepStruct(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NidRepStruct{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidRepStructProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepStruct(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NidRepStruct{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinRepStructProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepStruct(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NinRepStruct{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinRepStructProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepStruct(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NinRepStruct{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidEmbeddedStructProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidEmbeddedStruct(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NidEmbeddedStruct{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidEmbeddedStructProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidEmbeddedStruct(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NidEmbeddedStruct{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinEmbeddedStructProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinEmbeddedStruct(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NinEmbeddedStruct{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinEmbeddedStructProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinEmbeddedStruct(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NinEmbeddedStruct{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidNestedStructProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidNestedStruct(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NidNestedStruct{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidNestedStructProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidNestedStruct(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NidNestedStruct{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinNestedStructProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinNestedStruct(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NinNestedStruct{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinNestedStructProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinNestedStruct(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NinNestedStruct{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidOptCustomProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptCustom(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NidOptCustom{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidOptCustomProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptCustom(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NidOptCustom{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestCustomDashProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomDash(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &CustomDash{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestCustomDashProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomDash(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &CustomDash{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinOptCustomProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptCustom(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NinOptCustom{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinOptCustomProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptCustom(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NinOptCustom{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidRepCustomProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepCustom(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NidRepCustom{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidRepCustomProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepCustom(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NidRepCustom{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinRepCustomProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepCustom(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NinRepCustom{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinRepCustomProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepCustom(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NinRepCustom{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinOptNativeUnionProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptNativeUnion(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NinOptNativeUnion{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinOptNativeUnionProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptNativeUnion(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NinOptNativeUnion{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinOptStructUnionProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptStructUnion(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NinOptStructUnion{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinOptStructUnionProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptStructUnion(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NinOptStructUnion{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinEmbeddedStructUnionProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinEmbeddedStructUnion(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NinEmbeddedStructUnion{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinEmbeddedStructUnionProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinEmbeddedStructUnion(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NinEmbeddedStructUnion{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinNestedStructUnionProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinNestedStructUnion(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NinNestedStructUnion{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinNestedStructUnionProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinNestedStructUnion(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NinNestedStructUnion{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestTreeProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedTree(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &Tree{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestTreeProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedTree(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &Tree{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestOrBranchProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedOrBranch(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &OrBranch{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestOrBranchProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedOrBranch(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &OrBranch{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestAndBranchProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedAndBranch(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &AndBranch{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestAndBranchProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedAndBranch(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &AndBranch{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestLeafProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedLeaf(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &Leaf{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestLeafProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedLeaf(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &Leaf{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestDeepTreeProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedDeepTree(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &DeepTree{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestDeepTreeProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedDeepTree(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &DeepTree{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestADeepBranchProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedADeepBranch(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &ADeepBranch{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestADeepBranchProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedADeepBranch(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &ADeepBranch{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestAndDeepBranchProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedAndDeepBranch(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &AndDeepBranch{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestAndDeepBranchProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedAndDeepBranch(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &AndDeepBranch{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestDeepLeafProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedDeepLeaf(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &DeepLeaf{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestDeepLeafProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedDeepLeaf(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &DeepLeaf{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNilProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNil(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &Nil{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNilProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNil(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &Nil{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidOptEnumProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptEnum(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NidOptEnum{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidOptEnumProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptEnum(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NidOptEnum{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinOptEnumProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptEnum(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NinOptEnum{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinOptEnumProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptEnum(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NinOptEnum{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidRepEnumProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepEnum(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NidRepEnum{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidRepEnumProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepEnum(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NidRepEnum{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinRepEnumProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepEnum(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NinRepEnum{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinRepEnumProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepEnum(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NinRepEnum{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinOptEnumDefaultProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptEnumDefault(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NinOptEnumDefault{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinOptEnumDefaultProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptEnumDefault(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NinOptEnumDefault{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestAnotherNinOptEnumProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedAnotherNinOptEnum(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &AnotherNinOptEnum{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestAnotherNinOptEnumProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedAnotherNinOptEnum(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &AnotherNinOptEnum{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestAnotherNinOptEnumDefaultProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedAnotherNinOptEnumDefault(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &AnotherNinOptEnumDefault{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestAnotherNinOptEnumDefaultProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedAnotherNinOptEnumDefault(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &AnotherNinOptEnumDefault{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestTimerProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedTimer(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &Timer{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestTimerProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedTimer(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &Timer{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestMyExtendableProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedMyExtendable(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &MyExtendable{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestMyExtendableProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedMyExtendable(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &MyExtendable{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestOtherExtenableProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedOtherExtenable(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &OtherExtenable{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestOtherExtenableProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedOtherExtenable(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &OtherExtenable{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNestedDefinitionProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNestedDefinition(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NestedDefinition{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNestedDefinitionProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNestedDefinition(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NestedDefinition{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNestedDefinition_NestedMessageProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNestedDefinition_NestedMessage(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NestedDefinition_NestedMessage{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNestedDefinition_NestedMessageProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNestedDefinition_NestedMessage(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NestedDefinition_NestedMessage{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNestedDefinition_NestedMessage_NestedNestedMsgProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNestedDefinition_NestedMessage_NestedNestedMsg(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NestedDefinition_NestedMessage_NestedNestedMsg{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNestedDefinition_NestedMessage_NestedNestedMsgProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNestedDefinition_NestedMessage_NestedNestedMsg(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NestedDefinition_NestedMessage_NestedNestedMsg{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNestedScopeProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNestedScope(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NestedScope{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNestedScopeProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNestedScope(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NestedScope{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinOptNativeDefaultProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptNativeDefault(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NinOptNativeDefault{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinOptNativeDefaultProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptNativeDefault(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NinOptNativeDefault{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestCustomContainerProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomContainer(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &CustomContainer{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestCustomContainerProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomContainer(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &CustomContainer{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestCustomNameNidOptNativeProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNidOptNative(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &CustomNameNidOptNative{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestCustomNameNidOptNativeProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNidOptNative(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &CustomNameNidOptNative{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestCustomNameNinOptNativeProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNinOptNative(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &CustomNameNinOptNative{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestCustomNameNinOptNativeProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNinOptNative(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &CustomNameNinOptNative{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestCustomNameNinRepNativeProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNinRepNative(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &CustomNameNinRepNative{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestCustomNameNinRepNativeProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNinRepNative(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &CustomNameNinRepNative{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestCustomNameNinStructProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNinStruct(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &CustomNameNinStruct{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestCustomNameNinStructProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNinStruct(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &CustomNameNinStruct{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestCustomNameCustomTypeProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameCustomType(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &CustomNameCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestCustomNameCustomTypeProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameCustomType(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &CustomNameCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestCustomNameNinEmbeddedStructUnionProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNinEmbeddedStructUnion(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &CustomNameNinEmbeddedStructUnion{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestCustomNameNinEmbeddedStructUnionProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNinEmbeddedStructUnion(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &CustomNameNinEmbeddedStructUnion{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestCustomNameEnumProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameEnum(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &CustomNameEnum{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestCustomNameEnumProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameEnum(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &CustomNameEnum{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNoExtensionsMapProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNoExtensionsMap(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NoExtensionsMap{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNoExtensionsMapProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNoExtensionsMap(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NoExtensionsMap{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestUnrecognizedProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognized(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &Unrecognized{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestUnrecognizedProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognized(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &Unrecognized{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestUnrecognizedWithInnerProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognizedWithInner(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &UnrecognizedWithInner{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestUnrecognizedWithInnerProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognizedWithInner(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &UnrecognizedWithInner{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestUnrecognizedWithInner_InnerProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognizedWithInner_Inner(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &UnrecognizedWithInner_Inner{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestUnrecognizedWithInner_InnerProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognizedWithInner_Inner(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &UnrecognizedWithInner_Inner{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestUnrecognizedWithEmbedProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognizedWithEmbed(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &UnrecognizedWithEmbed{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestUnrecognizedWithEmbedProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognizedWithEmbed(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &UnrecognizedWithEmbed{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestUnrecognizedWithEmbed_EmbeddedProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognizedWithEmbed_Embedded(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &UnrecognizedWithEmbed_Embedded{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestUnrecognizedWithEmbed_EmbeddedProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognizedWithEmbed_Embedded(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &UnrecognizedWithEmbed_Embedded{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNodeProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNode(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &Node{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNodeProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNode(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &Node{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNonByteCustomTypeProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNonByteCustomType(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNonByteCustomTypeProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNonByteCustomType(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidOptNonByteCustomTypeProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptNonByteCustomType(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NidOptNonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidOptNonByteCustomTypeProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptNonByteCustomType(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NidOptNonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinOptNonByteCustomTypeProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptNonByteCustomType(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NinOptNonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinOptNonByteCustomTypeProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptNonByteCustomType(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NinOptNonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidRepNonByteCustomTypeProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepNonByteCustomType(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NidRepNonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidRepNonByteCustomTypeProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepNonByteCustomType(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NidRepNonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinRepNonByteCustomTypeProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepNonByteCustomType(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &NinRepNonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNinRepNonByteCustomTypeProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepNonByteCustomType(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &NinRepNonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestProtoTypeProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedProtoType(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
|
msg := &ProtoType{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestProtoTypeProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedProtoType(popr, true)
|
|
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
|
msg := &ProtoType{}
|
|
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
|
|
}
|
|
}
|
|
|
|
func TestNidOptNativeCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidOptNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNidOptNative(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNinOptNativeCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinOptNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNinOptNative(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNidRepNativeCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidRepNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNidRepNative(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNinRepNativeCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinRepNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNinRepNative(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNidRepPackedNativeCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepPackedNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidRepPackedNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNidRepPackedNative(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNinRepPackedNativeCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepPackedNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinRepPackedNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNinRepPackedNative(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNidOptStructCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidOptStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNidOptStruct(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNinOptStructCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinOptStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNinOptStruct(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNidRepStructCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidRepStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNidRepStruct(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNinRepStructCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinRepStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNinRepStruct(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNidEmbeddedStructCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidEmbeddedStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidEmbeddedStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNidEmbeddedStruct(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNinEmbeddedStructCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinEmbeddedStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinEmbeddedStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNinEmbeddedStruct(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNidNestedStructCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidNestedStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidNestedStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNidNestedStruct(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNinNestedStructCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinNestedStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinNestedStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNinNestedStruct(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNidOptCustomCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptCustom(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidOptCustom{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNidOptCustom(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestCustomDashCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomDash(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &CustomDash{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedCustomDash(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNinOptCustomCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptCustom(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinOptCustom{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNinOptCustom(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNidRepCustomCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepCustom(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidRepCustom{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNidRepCustom(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNinRepCustomCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepCustom(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinRepCustom{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNinRepCustom(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNinOptNativeUnionCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptNativeUnion(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinOptNativeUnion{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNinOptNativeUnion(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNinOptStructUnionCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptStructUnion(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinOptStructUnion{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNinOptStructUnion(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNinEmbeddedStructUnionCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinEmbeddedStructUnion(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinEmbeddedStructUnion{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNinEmbeddedStructUnion(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNinNestedStructUnionCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinNestedStructUnion(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinNestedStructUnion{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNinNestedStructUnion(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestTreeCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedTree(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &Tree{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedTree(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestOrBranchCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOrBranch(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &OrBranch{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedOrBranch(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestAndBranchCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedAndBranch(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &AndBranch{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedAndBranch(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestLeafCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedLeaf(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &Leaf{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedLeaf(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestDeepTreeCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedDeepTree(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &DeepTree{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedDeepTree(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestADeepBranchCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedADeepBranch(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &ADeepBranch{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedADeepBranch(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestAndDeepBranchCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedAndDeepBranch(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &AndDeepBranch{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedAndDeepBranch(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestDeepLeafCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedDeepLeaf(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &DeepLeaf{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedDeepLeaf(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNilCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNil(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &Nil{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNil(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNidOptEnumCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptEnum(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidOptEnum{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNidOptEnum(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNinOptEnumCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptEnum(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinOptEnum{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNinOptEnum(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNidRepEnumCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepEnum(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidRepEnum{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNidRepEnum(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNinRepEnumCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepEnum(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinRepEnum{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNinRepEnum(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNinOptEnumDefaultCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptEnumDefault(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinOptEnumDefault{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNinOptEnumDefault(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestAnotherNinOptEnumCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedAnotherNinOptEnum(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &AnotherNinOptEnum{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedAnotherNinOptEnum(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestAnotherNinOptEnumDefaultCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedAnotherNinOptEnumDefault(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &AnotherNinOptEnumDefault{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedAnotherNinOptEnumDefault(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestTimerCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedTimer(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &Timer{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedTimer(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestMyExtendableCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedMyExtendable(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &MyExtendable{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedMyExtendable(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestOtherExtenableCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOtherExtenable(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &OtherExtenable{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedOtherExtenable(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNestedDefinitionCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNestedDefinition(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NestedDefinition{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNestedDefinition(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNestedDefinition_NestedMessageCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNestedDefinition_NestedMessage(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NestedDefinition_NestedMessage{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNestedDefinition_NestedMessage(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNestedDefinition_NestedMessage_NestedNestedMsgCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNestedDefinition_NestedMessage_NestedNestedMsg(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NestedDefinition_NestedMessage_NestedNestedMsg{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNestedDefinition_NestedMessage_NestedNestedMsg(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNestedScopeCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNestedScope(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NestedScope{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNestedScope(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNinOptNativeDefaultCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptNativeDefault(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinOptNativeDefault{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNinOptNativeDefault(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestCustomContainerCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomContainer(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &CustomContainer{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedCustomContainer(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestCustomNameNidOptNativeCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNidOptNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &CustomNameNidOptNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedCustomNameNidOptNative(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestCustomNameNinOptNativeCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNinOptNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &CustomNameNinOptNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedCustomNameNinOptNative(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestCustomNameNinRepNativeCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNinRepNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &CustomNameNinRepNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedCustomNameNinRepNative(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestCustomNameNinStructCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNinStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &CustomNameNinStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedCustomNameNinStruct(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestCustomNameCustomTypeCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameCustomType(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &CustomNameCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedCustomNameCustomType(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestCustomNameNinEmbeddedStructUnionCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNinEmbeddedStructUnion(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &CustomNameNinEmbeddedStructUnion{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedCustomNameNinEmbeddedStructUnion(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestCustomNameEnumCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameEnum(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &CustomNameEnum{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedCustomNameEnum(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNoExtensionsMapCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNoExtensionsMap(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NoExtensionsMap{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNoExtensionsMap(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestUnrecognizedCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognized(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &Unrecognized{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedUnrecognized(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithInnerCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognizedWithInner(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &UnrecognizedWithInner{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedUnrecognizedWithInner(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithInner_InnerCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognizedWithInner_Inner(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &UnrecognizedWithInner_Inner{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedUnrecognizedWithInner_Inner(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithEmbedCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognizedWithEmbed(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &UnrecognizedWithEmbed{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedUnrecognizedWithEmbed(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithEmbed_EmbeddedCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognizedWithEmbed_Embedded(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &UnrecognizedWithEmbed_Embedded{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedUnrecognizedWithEmbed_Embedded(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNodeCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNode(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &Node{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNode(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNonByteCustomTypeCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNonByteCustomType(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNonByteCustomType(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNidOptNonByteCustomTypeCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptNonByteCustomType(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidOptNonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNidOptNonByteCustomType(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNinOptNonByteCustomTypeCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptNonByteCustomType(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinOptNonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNinOptNonByteCustomType(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNidRepNonByteCustomTypeCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepNonByteCustomType(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidRepNonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNidRepNonByteCustomType(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestNinRepNonByteCustomTypeCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepNonByteCustomType(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinRepNonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedNinRepNonByteCustomType(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestProtoTypeCompare(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedProtoType(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &ProtoType{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if c := p.Compare(msg); c != 0 {
|
|
t.Fatalf("%#v !Compare %#v, since %d", msg, p, c)
|
|
}
|
|
p2 := NewPopulatedProtoType(popr, false)
|
|
c := p.Compare(p2)
|
|
c2 := p2.Compare(p)
|
|
if c != (-1 * c2) {
|
|
t.Errorf("p.Compare(p2) = %d", c)
|
|
t.Errorf("p2.Compare(p) = %d", c2)
|
|
t.Errorf("p = %#v", p)
|
|
t.Errorf("p2 = %#v", p2)
|
|
}
|
|
}
|
|
func TestThetestDescription(t *testing.T) {
|
|
ThetestDescription()
|
|
}
|
|
func TestNidOptNativeVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidOptNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNinOptNativeVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinOptNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNidRepNativeVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidRepNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNinRepNativeVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinRepNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNidRepPackedNativeVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepPackedNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidRepPackedNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNinRepPackedNativeVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepPackedNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinRepPackedNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNidOptStructVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidOptStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNinOptStructVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinOptStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNidRepStructVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidRepStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNinRepStructVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinRepStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNidEmbeddedStructVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidEmbeddedStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidEmbeddedStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNinEmbeddedStructVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinEmbeddedStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinEmbeddedStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNidNestedStructVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidNestedStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidNestedStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNinNestedStructVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinNestedStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinNestedStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNidOptCustomVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptCustom(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidOptCustom{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestCustomDashVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomDash(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &CustomDash{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNinOptCustomVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptCustom(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinOptCustom{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNidRepCustomVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepCustom(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidRepCustom{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNinRepCustomVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepCustom(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinRepCustom{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNinOptNativeUnionVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptNativeUnion(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinOptNativeUnion{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNinOptStructUnionVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptStructUnion(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinOptStructUnion{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNinEmbeddedStructUnionVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinEmbeddedStructUnion(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinEmbeddedStructUnion{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNinNestedStructUnionVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinNestedStructUnion(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinNestedStructUnion{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestTreeVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedTree(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &Tree{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestOrBranchVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOrBranch(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &OrBranch{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestAndBranchVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedAndBranch(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &AndBranch{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestLeafVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedLeaf(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &Leaf{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestDeepTreeVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedDeepTree(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &DeepTree{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestADeepBranchVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedADeepBranch(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &ADeepBranch{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestAndDeepBranchVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedAndDeepBranch(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &AndDeepBranch{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestDeepLeafVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedDeepLeaf(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &DeepLeaf{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNilVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNil(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &Nil{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNidOptEnumVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptEnum(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidOptEnum{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNinOptEnumVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptEnum(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinOptEnum{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNidRepEnumVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepEnum(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidRepEnum{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNinRepEnumVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepEnum(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinRepEnum{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNinOptEnumDefaultVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptEnumDefault(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinOptEnumDefault{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestAnotherNinOptEnumVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedAnotherNinOptEnum(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &AnotherNinOptEnum{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestAnotherNinOptEnumDefaultVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedAnotherNinOptEnumDefault(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &AnotherNinOptEnumDefault{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestTimerVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedTimer(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &Timer{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestMyExtendableVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedMyExtendable(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &MyExtendable{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestOtherExtenableVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOtherExtenable(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &OtherExtenable{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNestedDefinitionVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNestedDefinition(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NestedDefinition{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNestedDefinition_NestedMessageVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNestedDefinition_NestedMessage(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NestedDefinition_NestedMessage{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNestedDefinition_NestedMessage_NestedNestedMsgVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNestedDefinition_NestedMessage_NestedNestedMsg(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NestedDefinition_NestedMessage_NestedNestedMsg{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNestedScopeVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNestedScope(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NestedScope{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNinOptNativeDefaultVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptNativeDefault(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinOptNativeDefault{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestCustomContainerVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomContainer(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &CustomContainer{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestCustomNameNidOptNativeVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNidOptNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &CustomNameNidOptNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestCustomNameNinOptNativeVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNinOptNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &CustomNameNinOptNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestCustomNameNinRepNativeVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNinRepNative(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &CustomNameNinRepNative{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestCustomNameNinStructVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNinStruct(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &CustomNameNinStruct{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestCustomNameCustomTypeVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameCustomType(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &CustomNameCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestCustomNameNinEmbeddedStructUnionVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNinEmbeddedStructUnion(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &CustomNameNinEmbeddedStructUnion{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestCustomNameEnumVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameEnum(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &CustomNameEnum{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNoExtensionsMapVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNoExtensionsMap(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NoExtensionsMap{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestUnrecognizedVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognized(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &Unrecognized{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithInnerVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognizedWithInner(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &UnrecognizedWithInner{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithInner_InnerVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognizedWithInner_Inner(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &UnrecognizedWithInner_Inner{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithEmbedVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognizedWithEmbed(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &UnrecognizedWithEmbed{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithEmbed_EmbeddedVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognizedWithEmbed_Embedded(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &UnrecognizedWithEmbed_Embedded{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNodeVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNode(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &Node{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNonByteCustomTypeVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNonByteCustomType(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNidOptNonByteCustomTypeVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptNonByteCustomType(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidOptNonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNinOptNonByteCustomTypeVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptNonByteCustomType(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinOptNonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNidRepNonByteCustomTypeVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepNonByteCustomType(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NidRepNonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNinRepNonByteCustomTypeVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepNonByteCustomType(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &NinRepNonByteCustomType{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestProtoTypeVerboseEqual(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedProtoType(popr, false)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &ProtoType{}
|
|
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
|
|
panic(err)
|
|
}
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
}
|
|
}
|
|
func TestNidOptNativeFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptNative(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNinOptNativeFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptNative(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNidRepNativeFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepNative(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNinRepNativeFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepNative(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNidRepPackedNativeFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepPackedNative(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNinRepPackedNativeFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepPackedNative(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNidOptStructFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptStruct(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNinOptStructFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptStruct(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNidRepStructFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepStruct(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNinRepStructFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepStruct(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNidEmbeddedStructFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidEmbeddedStruct(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNinEmbeddedStructFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinEmbeddedStruct(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNidNestedStructFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidNestedStruct(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNinNestedStructFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinNestedStruct(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNidOptCustomFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptCustom(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestCustomDashFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomDash(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNinOptCustomFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptCustom(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNidRepCustomFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepCustom(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNinRepCustomFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepCustom(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNinOptNativeUnionFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptNativeUnion(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNinOptStructUnionFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptStructUnion(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNinEmbeddedStructUnionFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinEmbeddedStructUnion(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNinNestedStructUnionFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinNestedStructUnion(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestTreeFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedTree(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestOrBranchFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOrBranch(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestAndBranchFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedAndBranch(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestLeafFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedLeaf(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestDeepTreeFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedDeepTree(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestADeepBranchFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedADeepBranch(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestAndDeepBranchFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedAndDeepBranch(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestDeepLeafFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedDeepLeaf(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNilFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNil(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNidOptEnumFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptEnum(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNinOptEnumFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptEnum(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNidRepEnumFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepEnum(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNinRepEnumFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepEnum(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestAnotherNinOptEnumFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedAnotherNinOptEnum(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestTimerFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedTimer(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNestedDefinitionFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNestedDefinition(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNestedDefinition_NestedMessageFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNestedDefinition_NestedMessage(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNestedDefinition_NestedMessage_NestedNestedMsgFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNestedDefinition_NestedMessage_NestedNestedMsg(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNestedScopeFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNestedScope(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestCustomContainerFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomContainer(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestCustomNameNidOptNativeFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNidOptNative(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestCustomNameNinOptNativeFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNinOptNative(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestCustomNameNinRepNativeFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNinRepNative(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestCustomNameNinStructFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNinStruct(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestCustomNameCustomTypeFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameCustomType(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestCustomNameNinEmbeddedStructUnionFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNinEmbeddedStructUnion(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestCustomNameEnumFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameEnum(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestUnrecognizedFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognized(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithInnerFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognizedWithInner(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithInner_InnerFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognizedWithInner_Inner(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithEmbedFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognizedWithEmbed(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithEmbed_EmbeddedFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognizedWithEmbed_Embedded(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNodeFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNode(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNonByteCustomTypeFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNonByteCustomType(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNidOptNonByteCustomTypeFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptNonByteCustomType(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNinOptNonByteCustomTypeFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptNonByteCustomType(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNidRepNonByteCustomTypeFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepNonByteCustomType(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNinRepNonByteCustomTypeFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepNonByteCustomType(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestProtoTypeFace(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedProtoType(popr, true)
|
|
msg := p.TestProto()
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNidOptNativeGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptNative(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNinOptNativeGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptNative(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNidRepNativeGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepNative(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNinRepNativeGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepNative(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNidRepPackedNativeGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepPackedNative(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNinRepPackedNativeGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepPackedNative(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNidOptStructGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptStruct(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNinOptStructGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptStruct(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNidRepStructGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepStruct(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNinRepStructGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepStruct(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNidEmbeddedStructGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidEmbeddedStruct(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNinEmbeddedStructGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinEmbeddedStruct(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNidNestedStructGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidNestedStruct(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNinNestedStructGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinNestedStruct(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNidOptCustomGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptCustom(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestCustomDashGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomDash(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNinOptCustomGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptCustom(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNidRepCustomGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepCustom(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNinRepCustomGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepCustom(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNinOptNativeUnionGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptNativeUnion(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNinOptStructUnionGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptStructUnion(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNinEmbeddedStructUnionGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinEmbeddedStructUnion(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNinNestedStructUnionGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinNestedStructUnion(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestTreeGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedTree(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestOrBranchGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOrBranch(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestAndBranchGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedAndBranch(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestLeafGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedLeaf(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestDeepTreeGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedDeepTree(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestADeepBranchGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedADeepBranch(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestAndDeepBranchGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedAndDeepBranch(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestDeepLeafGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedDeepLeaf(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNilGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNil(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNidOptEnumGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptEnum(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNinOptEnumGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptEnum(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNidRepEnumGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepEnum(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNinRepEnumGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepEnum(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNinOptEnumDefaultGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptEnumDefault(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestAnotherNinOptEnumGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedAnotherNinOptEnum(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestAnotherNinOptEnumDefaultGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedAnotherNinOptEnumDefault(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestTimerGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedTimer(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestMyExtendableGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedMyExtendable(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestOtherExtenableGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOtherExtenable(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNestedDefinitionGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNestedDefinition(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNestedDefinition_NestedMessageGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNestedDefinition_NestedMessage(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNestedDefinition_NestedMessage_NestedNestedMsgGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNestedDefinition_NestedMessage_NestedNestedMsg(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNestedScopeGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNestedScope(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNinOptNativeDefaultGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptNativeDefault(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestCustomContainerGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomContainer(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestCustomNameNidOptNativeGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNidOptNative(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestCustomNameNinOptNativeGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNinOptNative(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestCustomNameNinRepNativeGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNinRepNative(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestCustomNameNinStructGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNinStruct(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestCustomNameCustomTypeGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameCustomType(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestCustomNameNinEmbeddedStructUnionGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNinEmbeddedStructUnion(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestCustomNameEnumGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameEnum(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNoExtensionsMapGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNoExtensionsMap(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestUnrecognizedGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognized(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithInnerGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognizedWithInner(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithInner_InnerGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognizedWithInner_Inner(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithEmbedGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognizedWithEmbed(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithEmbed_EmbeddedGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognizedWithEmbed_Embedded(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNodeGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNode(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNonByteCustomTypeGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNonByteCustomType(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNidOptNonByteCustomTypeGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptNonByteCustomType(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNinOptNonByteCustomTypeGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptNonByteCustomType(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNidRepNonByteCustomTypeGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepNonByteCustomType(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNinRepNonByteCustomTypeGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepNonByteCustomType(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestProtoTypeGoString(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedProtoType(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := go_parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestNidOptNativeSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptNative(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidOptNativeSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidOptNative, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNidOptNative(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinOptNativeSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptNative(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinOptNativeSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinOptNative, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNinOptNative(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidRepNativeSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepNative(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidRepNativeSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidRepNative, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNidRepNative(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinRepNativeSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepNative(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinRepNativeSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinRepNative, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNinRepNative(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidRepPackedNativeSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepPackedNative(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidRepPackedNativeSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidRepPackedNative, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNidRepPackedNative(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinRepPackedNativeSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepPackedNative(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinRepPackedNativeSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinRepPackedNative, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNinRepPackedNative(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidOptStructSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptStruct(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidOptStructSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidOptStruct, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNidOptStruct(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinOptStructSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptStruct(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinOptStructSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinOptStruct, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNinOptStruct(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidRepStructSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepStruct(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidRepStructSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidRepStruct, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNidRepStruct(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinRepStructSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepStruct(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinRepStructSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinRepStruct, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNinRepStruct(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidEmbeddedStructSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidEmbeddedStruct(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidEmbeddedStructSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidEmbeddedStruct, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNidEmbeddedStruct(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinEmbeddedStructSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinEmbeddedStruct(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinEmbeddedStructSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinEmbeddedStruct, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNinEmbeddedStruct(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidNestedStructSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidNestedStruct(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidNestedStructSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidNestedStruct, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNidNestedStruct(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinNestedStructSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinNestedStruct(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinNestedStructSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinNestedStruct, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNinNestedStruct(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidOptCustomSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptCustom(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidOptCustomSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidOptCustom, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNidOptCustom(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestCustomDashSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomDash(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkCustomDashSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*CustomDash, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedCustomDash(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinOptCustomSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptCustom(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinOptCustomSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinOptCustom, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNinOptCustom(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidRepCustomSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepCustom(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidRepCustomSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidRepCustom, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNidRepCustom(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinRepCustomSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepCustom(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinRepCustomSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinRepCustom, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNinRepCustom(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinOptNativeUnionSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptNativeUnion(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinOptNativeUnionSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinOptNativeUnion, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNinOptNativeUnion(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinOptStructUnionSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptStructUnion(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinOptStructUnionSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinOptStructUnion, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNinOptStructUnion(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinEmbeddedStructUnionSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinEmbeddedStructUnion(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinEmbeddedStructUnionSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinEmbeddedStructUnion, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNinEmbeddedStructUnion(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinNestedStructUnionSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinNestedStructUnion(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinNestedStructUnionSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinNestedStructUnion, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNinNestedStructUnion(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestTreeSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedTree(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkTreeSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*Tree, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedTree(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestOrBranchSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedOrBranch(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkOrBranchSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*OrBranch, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedOrBranch(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestAndBranchSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedAndBranch(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkAndBranchSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*AndBranch, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedAndBranch(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestLeafSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedLeaf(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkLeafSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*Leaf, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedLeaf(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestDeepTreeSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedDeepTree(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkDeepTreeSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*DeepTree, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedDeepTree(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestADeepBranchSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedADeepBranch(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkADeepBranchSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*ADeepBranch, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedADeepBranch(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestAndDeepBranchSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedAndDeepBranch(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkAndDeepBranchSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*AndDeepBranch, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedAndDeepBranch(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestDeepLeafSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedDeepLeaf(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkDeepLeafSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*DeepLeaf, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedDeepLeaf(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNilSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNil(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNilSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*Nil, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNil(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidOptEnumSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptEnum(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidOptEnumSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidOptEnum, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNidOptEnum(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinOptEnumSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptEnum(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinOptEnumSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinOptEnum, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNinOptEnum(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidRepEnumSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepEnum(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidRepEnumSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidRepEnum, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNidRepEnum(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinRepEnumSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepEnum(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinRepEnumSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinRepEnum, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNinRepEnum(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinOptEnumDefaultSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptEnumDefault(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinOptEnumDefaultSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinOptEnumDefault, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNinOptEnumDefault(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestAnotherNinOptEnumSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedAnotherNinOptEnum(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkAnotherNinOptEnumSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*AnotherNinOptEnum, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedAnotherNinOptEnum(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestAnotherNinOptEnumDefaultSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedAnotherNinOptEnumDefault(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkAnotherNinOptEnumDefaultSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*AnotherNinOptEnumDefault, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedAnotherNinOptEnumDefault(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestTimerSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedTimer(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkTimerSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*Timer, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedTimer(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestMyExtendableSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedMyExtendable(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkMyExtendableSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*MyExtendable, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedMyExtendable(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestOtherExtenableSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedOtherExtenable(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkOtherExtenableSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*OtherExtenable, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedOtherExtenable(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNestedDefinitionSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNestedDefinition(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNestedDefinitionSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NestedDefinition, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNestedDefinition(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNestedDefinition_NestedMessageSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNestedDefinition_NestedMessage(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNestedDefinition_NestedMessageSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NestedDefinition_NestedMessage, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNestedDefinition_NestedMessage(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNestedDefinition_NestedMessage_NestedNestedMsgSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNestedDefinition_NestedMessage_NestedNestedMsg(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNestedDefinition_NestedMessage_NestedNestedMsgSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NestedDefinition_NestedMessage_NestedNestedMsg, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNestedDefinition_NestedMessage_NestedNestedMsg(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNestedScopeSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNestedScope(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNestedScopeSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NestedScope, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNestedScope(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinOptNativeDefaultSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptNativeDefault(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinOptNativeDefaultSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinOptNativeDefault, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNinOptNativeDefault(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestCustomContainerSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomContainer(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkCustomContainerSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*CustomContainer, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedCustomContainer(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestCustomNameNidOptNativeSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNidOptNative(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkCustomNameNidOptNativeSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*CustomNameNidOptNative, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedCustomNameNidOptNative(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestCustomNameNinOptNativeSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNinOptNative(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkCustomNameNinOptNativeSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*CustomNameNinOptNative, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedCustomNameNinOptNative(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestCustomNameNinRepNativeSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNinRepNative(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkCustomNameNinRepNativeSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*CustomNameNinRepNative, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedCustomNameNinRepNative(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestCustomNameNinStructSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNinStruct(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkCustomNameNinStructSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*CustomNameNinStruct, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedCustomNameNinStruct(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestCustomNameCustomTypeSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameCustomType(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkCustomNameCustomTypeSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*CustomNameCustomType, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedCustomNameCustomType(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestCustomNameNinEmbeddedStructUnionSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameNinEmbeddedStructUnion(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkCustomNameNinEmbeddedStructUnionSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*CustomNameNinEmbeddedStructUnion, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedCustomNameNinEmbeddedStructUnion(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestCustomNameEnumSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedCustomNameEnum(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkCustomNameEnumSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*CustomNameEnum, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedCustomNameEnum(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNoExtensionsMapSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNoExtensionsMap(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNoExtensionsMapSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NoExtensionsMap, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNoExtensionsMap(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestUnrecognizedSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognized(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkUnrecognizedSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*Unrecognized, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedUnrecognized(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestUnrecognizedWithInnerSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognizedWithInner(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkUnrecognizedWithInnerSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*UnrecognizedWithInner, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedUnrecognizedWithInner(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestUnrecognizedWithInner_InnerSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognizedWithInner_Inner(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkUnrecognizedWithInner_InnerSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*UnrecognizedWithInner_Inner, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedUnrecognizedWithInner_Inner(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestUnrecognizedWithEmbedSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognizedWithEmbed(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkUnrecognizedWithEmbedSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*UnrecognizedWithEmbed, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedUnrecognizedWithEmbed(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestUnrecognizedWithEmbed_EmbeddedSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedUnrecognizedWithEmbed_Embedded(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkUnrecognizedWithEmbed_EmbeddedSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*UnrecognizedWithEmbed_Embedded, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedUnrecognizedWithEmbed_Embedded(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNodeSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNode(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNodeSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*Node, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNode(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNonByteCustomTypeSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNonByteCustomType(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNonByteCustomTypeSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NonByteCustomType, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNonByteCustomType(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidOptNonByteCustomTypeSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidOptNonByteCustomType(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidOptNonByteCustomTypeSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidOptNonByteCustomType, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNidOptNonByteCustomType(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinOptNonByteCustomTypeSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinOptNonByteCustomType(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinOptNonByteCustomTypeSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinOptNonByteCustomType, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNinOptNonByteCustomType(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidRepNonByteCustomTypeSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNidRepNonByteCustomType(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNidRepNonByteCustomTypeSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NidRepNonByteCustomType, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNidRepNonByteCustomType(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNinRepNonByteCustomTypeSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedNinRepNonByteCustomType(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkNinRepNonByteCustomTypeSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*NinRepNonByteCustomType, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedNinRepNonByteCustomType(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestProtoTypeSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := math_rand.New(math_rand.NewSource(seed))
|
|
p := NewPopulatedProtoType(popr, true)
|
|
size2 := github_com_gogo_protobuf_proto.Size(p)
|
|
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
size := p.Size()
|
|
if len(dAtA) != size {
|
|
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
|
|
}
|
|
if size2 != size {
|
|
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
|
|
}
|
|
size3 := github_com_gogo_protobuf_proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func BenchmarkProtoTypeSize(b *testing.B) {
|
|
popr := math_rand.New(math_rand.NewSource(616))
|
|
total := 0
|
|
pops := make([]*ProtoType, 1000)
|
|
for i := 0; i < 1000; i++ {
|
|
pops[i] = NewPopulatedProtoType(popr, false)
|
|
}
|
|
b.ResetTimer()
|
|
for i := 0; i < b.N; i++ {
|
|
total += pops[i%1000].Size()
|
|
}
|
|
b.SetBytes(int64(total / b.N))
|
|
}
|
|
|
|
func TestNidOptNativeStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptNative(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNinOptNativeStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptNative(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNidRepNativeStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepNative(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNinRepNativeStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepNative(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNidRepPackedNativeStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepPackedNative(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNinRepPackedNativeStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepPackedNative(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNidOptStructStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptStruct(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNinOptStructStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptStruct(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNidRepStructStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepStruct(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNinRepStructStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepStruct(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNidEmbeddedStructStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidEmbeddedStruct(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNinEmbeddedStructStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinEmbeddedStruct(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNidNestedStructStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidNestedStruct(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNinNestedStructStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinNestedStruct(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNidOptCustomStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptCustom(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestCustomDashStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomDash(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNinOptCustomStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptCustom(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNidRepCustomStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepCustom(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNinRepCustomStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepCustom(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNinOptNativeUnionStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptNativeUnion(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNinOptStructUnionStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptStructUnion(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNinEmbeddedStructUnionStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinEmbeddedStructUnion(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNinNestedStructUnionStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinNestedStructUnion(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestTreeStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedTree(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestOrBranchStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOrBranch(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestAndBranchStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedAndBranch(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestLeafStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedLeaf(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestDeepTreeStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedDeepTree(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestADeepBranchStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedADeepBranch(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestAndDeepBranchStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedAndDeepBranch(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestDeepLeafStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedDeepLeaf(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNilStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNil(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNidOptEnumStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptEnum(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNinOptEnumStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptEnum(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNidRepEnumStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepEnum(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNinRepEnumStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepEnum(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNinOptEnumDefaultStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptEnumDefault(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestAnotherNinOptEnumStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedAnotherNinOptEnum(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestAnotherNinOptEnumDefaultStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedAnotherNinOptEnumDefault(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestTimerStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedTimer(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestMyExtendableStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedMyExtendable(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestOtherExtenableStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOtherExtenable(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNestedDefinitionStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNestedDefinition(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNestedDefinition_NestedMessageStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNestedDefinition_NestedMessage(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNestedDefinition_NestedMessage_NestedNestedMsgStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNestedDefinition_NestedMessage_NestedNestedMsg(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNestedScopeStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNestedScope(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNinOptNativeDefaultStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptNativeDefault(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestCustomContainerStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomContainer(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestCustomNameNidOptNativeStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNidOptNative(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestCustomNameNinOptNativeStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNinOptNative(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestCustomNameNinRepNativeStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNinRepNative(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestCustomNameNinStructStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNinStruct(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestCustomNameCustomTypeStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameCustomType(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestCustomNameNinEmbeddedStructUnionStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNinEmbeddedStructUnion(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestCustomNameEnumStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameEnum(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNoExtensionsMapStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNoExtensionsMap(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestUnrecognizedStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognized(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithInnerStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognizedWithInner(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithInner_InnerStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognizedWithInner_Inner(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithEmbedStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognizedWithEmbed(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestUnrecognizedWithEmbed_EmbeddedStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnrecognizedWithEmbed_Embedded(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNodeStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNode(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNonByteCustomTypeStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNonByteCustomType(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNidOptNonByteCustomTypeStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidOptNonByteCustomType(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNinOptNonByteCustomTypeStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptNonByteCustomType(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNidRepNonByteCustomTypeStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNidRepNonByteCustomType(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNinRepNonByteCustomTypeStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinRepNonByteCustomType(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestProtoTypeStringer(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedProtoType(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestNinOptNativeUnionOnlyOne(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptNativeUnion(popr, true)
|
|
v := p.GetValue()
|
|
msg := &NinOptNativeUnion{}
|
|
if !msg.SetValue(v) {
|
|
t.Fatalf("OnlyOne: Could not set Value")
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !OnlyOne Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNinOptStructUnionOnlyOne(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinOptStructUnion(popr, true)
|
|
v := p.GetValue()
|
|
msg := &NinOptStructUnion{}
|
|
if !msg.SetValue(v) {
|
|
t.Fatalf("OnlyOne: Could not set Value")
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !OnlyOne Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNinEmbeddedStructUnionOnlyOne(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinEmbeddedStructUnion(popr, true)
|
|
v := p.GetValue()
|
|
msg := &NinEmbeddedStructUnion{}
|
|
if !msg.SetValue(v) {
|
|
t.Fatalf("OnlyOne: Could not set Value")
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !OnlyOne Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestNinNestedStructUnionOnlyOne(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedNinNestedStructUnion(popr, true)
|
|
v := p.GetValue()
|
|
msg := &NinNestedStructUnion{}
|
|
if !msg.SetValue(v) {
|
|
t.Fatalf("OnlyOne: Could not set Value")
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !OnlyOne Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestTreeOnlyOne(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedTree(popr, true)
|
|
v := p.GetValue()
|
|
msg := &Tree{}
|
|
if !msg.SetValue(v) {
|
|
t.Fatalf("OnlyOne: Could not set Value")
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !OnlyOne Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestDeepTreeOnlyOne(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedDeepTree(popr, true)
|
|
v := p.GetValue()
|
|
msg := &DeepTree{}
|
|
if !msg.SetValue(v) {
|
|
t.Fatalf("OnlyOne: Could not set Value")
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !OnlyOne Equal %#v", msg, p)
|
|
}
|
|
}
|
|
func TestCustomNameNinEmbeddedStructUnionOnlyOne(t *testing.T) {
|
|
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedCustomNameNinEmbeddedStructUnion(popr, true)
|
|
v := p.GetValue()
|
|
msg := &CustomNameNinEmbeddedStructUnion{}
|
|
if !msg.SetValue(v) {
|
|
t.Fatalf("OnlyOne: Could not set Value")
|
|
}
|
|
if !p.Equal(msg) {
|
|
t.Fatalf("%#v !OnlyOne Equal %#v", msg, p)
|
|
}
|
|
}
|
|
|
|
//These tests are generated by github.com/gogo/protobuf/plugin/testgen
|