mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-13 00:36:28 +00:00
916ec63af6
This is a new revision of the discovery server. Relevant changes and non-changes: - Protocol towards clients is unchanged. - Recommended large scale design is still to be deployed nehind nginx (I tested, and it's still a lot faster at terminating TLS). - Database backend is leveldb again, only. It scales enough, is easy to setup, and we don't need any backend to take care of. - Server supports replication. This is a simple TCP channel - protect it with a firewall when deploying over the internet. (We deploy this within the same datacenter, and with firewall.) Any incoming client announces are sent over the replication channel(s) to other peer discosrvs. Incoming replication changes are applied to the database as if they came from clients, but without the TLS/certificate overhead. - Metrics are exposed using the prometheus library, when enabled. - The database values and replication protocol is protobuf, because JSON was quite CPU intensive when I tried that and benchmarked it. - The "Retry-After" value for failed lookups gets slowly increased from a default of 120 seconds, by 5 seconds for each failed lookup, independently by each discosrv. This lowers the query load over time for clients that are never seen. The Retry-After maxes out at 3600 after a couple of weeks of this increase. The number of failed lookups is stored in the database, now and then (avoiding making each lookup a database put). All in all this means clients can be pointed towards a cluster using just multiple A / AAAA records to gain both load sharing and redundancy (if one is down, clients will talk to the remaining ones). GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4648
1881 lines
50 KiB
Go
1881 lines
50 KiB
Go
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
|
// source: unrecognized.proto
|
|
|
|
/*
|
|
Package unrecognized is a generated protocol buffer package.
|
|
|
|
It is generated from these files:
|
|
unrecognized.proto
|
|
|
|
It has these top-level messages:
|
|
A
|
|
B
|
|
D
|
|
C
|
|
U
|
|
UnoM
|
|
OldA
|
|
OldB
|
|
OldC
|
|
OldU
|
|
OldUnoM
|
|
*/
|
|
package unrecognized
|
|
|
|
import testing "testing"
|
|
import rand "math/rand"
|
|
import time "time"
|
|
import proto "github.com/gogo/protobuf/proto"
|
|
import jsonpb "github.com/gogo/protobuf/jsonpb"
|
|
import fmt "fmt"
|
|
import parser "go/parser"
|
|
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 TestAProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedA(popr, false)
|
|
dAtA, err := proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &A{}
|
|
if err := 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
|
|
_ = proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func TestAMarshalTo(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedA(popr, false)
|
|
size := p.Size()
|
|
dAtA := make([]byte, size)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
_, err := p.MarshalTo(dAtA)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &A{}
|
|
if err := proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
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)
|
|
}
|
|
}
|
|
|
|
func TestBProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedB(popr, false)
|
|
dAtA, err := proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &B{}
|
|
if err := 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
|
|
_ = proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func TestBMarshalTo(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedB(popr, false)
|
|
size := p.Size()
|
|
dAtA := make([]byte, size)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
_, err := p.MarshalTo(dAtA)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &B{}
|
|
if err := proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
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)
|
|
}
|
|
}
|
|
|
|
func TestDProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedD(popr, false)
|
|
dAtA, err := proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &D{}
|
|
if err := 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
|
|
_ = proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func TestDMarshalTo(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedD(popr, false)
|
|
size := p.Size()
|
|
dAtA := make([]byte, size)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
_, err := p.MarshalTo(dAtA)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &D{}
|
|
if err := proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
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)
|
|
}
|
|
}
|
|
|
|
func TestCProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedC(popr, false)
|
|
dAtA, err := proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &C{}
|
|
if err := 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
|
|
_ = proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func TestCMarshalTo(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedC(popr, false)
|
|
size := p.Size()
|
|
dAtA := make([]byte, size)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
_, err := p.MarshalTo(dAtA)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &C{}
|
|
if err := proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
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)
|
|
}
|
|
}
|
|
|
|
func TestUProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedU(popr, false)
|
|
dAtA, err := proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &U{}
|
|
if err := 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
|
|
_ = proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func TestUMarshalTo(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedU(popr, false)
|
|
size := p.Size()
|
|
dAtA := make([]byte, size)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
_, err := p.MarshalTo(dAtA)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &U{}
|
|
if err := proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
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)
|
|
}
|
|
}
|
|
|
|
func TestUnoMProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedUnoM(popr, false)
|
|
dAtA, err := proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &UnoM{}
|
|
if err := 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
|
|
_ = proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func TestOldAProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldA(popr, false)
|
|
dAtA, err := proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &OldA{}
|
|
if err := 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
|
|
_ = proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func TestOldAMarshalTo(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldA(popr, false)
|
|
size := p.Size()
|
|
dAtA := make([]byte, size)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
_, err := p.MarshalTo(dAtA)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &OldA{}
|
|
if err := proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
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)
|
|
}
|
|
}
|
|
|
|
func TestOldBProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldB(popr, false)
|
|
dAtA, err := proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &OldB{}
|
|
if err := 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
|
|
_ = proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func TestOldBMarshalTo(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldB(popr, false)
|
|
size := p.Size()
|
|
dAtA := make([]byte, size)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
_, err := p.MarshalTo(dAtA)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &OldB{}
|
|
if err := proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
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)
|
|
}
|
|
}
|
|
|
|
func TestOldCProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldC(popr, false)
|
|
dAtA, err := proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &OldC{}
|
|
if err := 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
|
|
_ = proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func TestOldCMarshalTo(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldC(popr, false)
|
|
size := p.Size()
|
|
dAtA := make([]byte, size)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
_, err := p.MarshalTo(dAtA)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &OldC{}
|
|
if err := proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
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)
|
|
}
|
|
}
|
|
|
|
func TestOldUProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldU(popr, false)
|
|
dAtA, err := proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &OldU{}
|
|
if err := 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
|
|
_ = proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func TestOldUMarshalTo(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldU(popr, false)
|
|
size := p.Size()
|
|
dAtA := make([]byte, size)
|
|
for i := range dAtA {
|
|
dAtA[i] = byte(popr.Intn(256))
|
|
}
|
|
_, err := p.MarshalTo(dAtA)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &OldU{}
|
|
if err := proto.Unmarshal(dAtA, msg); err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
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)
|
|
}
|
|
}
|
|
|
|
func TestOldUnoMProto(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldUnoM(popr, false)
|
|
dAtA, err := proto.Marshal(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &OldUnoM{}
|
|
if err := 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
|
|
_ = proto.Unmarshal(littlefuzz, msg)
|
|
}
|
|
}
|
|
|
|
func TestAJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedA(popr, true)
|
|
marshaler := jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &A{}
|
|
err = 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 TestBJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedB(popr, true)
|
|
marshaler := jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &B{}
|
|
err = 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 TestDJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedD(popr, true)
|
|
marshaler := jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &D{}
|
|
err = 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 TestCJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedC(popr, true)
|
|
marshaler := jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &C{}
|
|
err = 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 TestUJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedU(popr, true)
|
|
marshaler := jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &U{}
|
|
err = 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 TestUnoMJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedUnoM(popr, true)
|
|
marshaler := jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &UnoM{}
|
|
err = 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 TestOldAJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldA(popr, true)
|
|
marshaler := jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &OldA{}
|
|
err = 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 TestOldBJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldB(popr, true)
|
|
marshaler := jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &OldB{}
|
|
err = 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 TestOldCJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldC(popr, true)
|
|
marshaler := jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &OldC{}
|
|
err = 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 TestOldUJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldU(popr, true)
|
|
marshaler := jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &OldU{}
|
|
err = 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 TestOldUnoMJSON(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldUnoM(popr, true)
|
|
marshaler := jsonpb.Marshaler{}
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
if err != nil {
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
}
|
|
msg := &OldUnoM{}
|
|
err = 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 TestAProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedA(popr, true)
|
|
dAtA := proto.MarshalTextString(p)
|
|
msg := &A{}
|
|
if err := 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 TestAProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedA(popr, true)
|
|
dAtA := proto.CompactTextString(p)
|
|
msg := &A{}
|
|
if err := 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 TestBProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedB(popr, true)
|
|
dAtA := proto.MarshalTextString(p)
|
|
msg := &B{}
|
|
if err := 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 TestBProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedB(popr, true)
|
|
dAtA := proto.CompactTextString(p)
|
|
msg := &B{}
|
|
if err := 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 TestDProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedD(popr, true)
|
|
dAtA := proto.MarshalTextString(p)
|
|
msg := &D{}
|
|
if err := 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 TestDProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedD(popr, true)
|
|
dAtA := proto.CompactTextString(p)
|
|
msg := &D{}
|
|
if err := 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 TestCProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedC(popr, true)
|
|
dAtA := proto.MarshalTextString(p)
|
|
msg := &C{}
|
|
if err := 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 TestCProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedC(popr, true)
|
|
dAtA := proto.CompactTextString(p)
|
|
msg := &C{}
|
|
if err := 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 TestUProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedU(popr, true)
|
|
dAtA := proto.MarshalTextString(p)
|
|
msg := &U{}
|
|
if err := 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 TestUProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedU(popr, true)
|
|
dAtA := proto.CompactTextString(p)
|
|
msg := &U{}
|
|
if err := 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 TestUnoMProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedUnoM(popr, true)
|
|
dAtA := proto.MarshalTextString(p)
|
|
msg := &UnoM{}
|
|
if err := 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 TestUnoMProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedUnoM(popr, true)
|
|
dAtA := proto.CompactTextString(p)
|
|
msg := &UnoM{}
|
|
if err := 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 TestOldAProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldA(popr, true)
|
|
dAtA := proto.MarshalTextString(p)
|
|
msg := &OldA{}
|
|
if err := 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 TestOldAProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldA(popr, true)
|
|
dAtA := proto.CompactTextString(p)
|
|
msg := &OldA{}
|
|
if err := 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 TestOldBProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldB(popr, true)
|
|
dAtA := proto.MarshalTextString(p)
|
|
msg := &OldB{}
|
|
if err := 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 TestOldBProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldB(popr, true)
|
|
dAtA := proto.CompactTextString(p)
|
|
msg := &OldB{}
|
|
if err := 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 TestOldCProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldC(popr, true)
|
|
dAtA := proto.MarshalTextString(p)
|
|
msg := &OldC{}
|
|
if err := 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 TestOldCProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldC(popr, true)
|
|
dAtA := proto.CompactTextString(p)
|
|
msg := &OldC{}
|
|
if err := 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 TestOldUProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldU(popr, true)
|
|
dAtA := proto.MarshalTextString(p)
|
|
msg := &OldU{}
|
|
if err := 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 TestOldUProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldU(popr, true)
|
|
dAtA := proto.CompactTextString(p)
|
|
msg := &OldU{}
|
|
if err := 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 TestOldUnoMProtoText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldUnoM(popr, true)
|
|
dAtA := proto.MarshalTextString(p)
|
|
msg := &OldUnoM{}
|
|
if err := 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 TestOldUnoMProtoCompactText(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldUnoM(popr, true)
|
|
dAtA := proto.CompactTextString(p)
|
|
msg := &OldUnoM{}
|
|
if err := 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 TestUnrecognizedDescription(t *testing.T) {
|
|
UnrecognizedDescription()
|
|
}
|
|
func TestAVerboseEqual(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedA(popr, false)
|
|
dAtA, err := proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &A{}
|
|
if err := 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 TestBVerboseEqual(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedB(popr, false)
|
|
dAtA, err := proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &B{}
|
|
if err := 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 TestDVerboseEqual(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedD(popr, false)
|
|
dAtA, err := proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &D{}
|
|
if err := 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 TestCVerboseEqual(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedC(popr, false)
|
|
dAtA, err := proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &C{}
|
|
if err := 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 TestUVerboseEqual(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedU(popr, false)
|
|
dAtA, err := proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &U{}
|
|
if err := 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 TestUnoMVerboseEqual(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnoM(popr, false)
|
|
dAtA, err := proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &UnoM{}
|
|
if err := 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 TestOldAVerboseEqual(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOldA(popr, false)
|
|
dAtA, err := proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &OldA{}
|
|
if err := 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 TestOldBVerboseEqual(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOldB(popr, false)
|
|
dAtA, err := proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &OldB{}
|
|
if err := 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 TestOldCVerboseEqual(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOldC(popr, false)
|
|
dAtA, err := proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &OldC{}
|
|
if err := 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 TestOldUVerboseEqual(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOldU(popr, false)
|
|
dAtA, err := proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &OldU{}
|
|
if err := 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 TestOldUnoMVerboseEqual(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOldUnoM(popr, false)
|
|
dAtA, err := proto.Marshal(p)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
msg := &OldUnoM{}
|
|
if err := 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 TestAGoString(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedA(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestBGoString(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedB(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestDGoString(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedD(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestCGoString(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedC(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestUGoString(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedU(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestUnoMGoString(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnoM(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestOldAGoString(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOldA(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestOldBGoString(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOldB(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestOldCGoString(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOldC(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestOldUGoString(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOldU(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestOldUnoMGoString(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOldUnoM(popr, false)
|
|
s1 := p.GoString()
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
}
|
|
_, err := parser.ParseExpr(s1)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
func TestASize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedA(popr, true)
|
|
size2 := proto.Size(p)
|
|
dAtA, err := 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 := proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func TestBSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedB(popr, true)
|
|
size2 := proto.Size(p)
|
|
dAtA, err := 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 := proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func TestDSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedD(popr, true)
|
|
size2 := proto.Size(p)
|
|
dAtA, err := 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 := proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func TestCSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedC(popr, true)
|
|
size2 := proto.Size(p)
|
|
dAtA, err := 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 := proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func TestUSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedU(popr, true)
|
|
size2 := proto.Size(p)
|
|
dAtA, err := 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 := proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func TestOldASize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldA(popr, true)
|
|
size2 := proto.Size(p)
|
|
dAtA, err := 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 := proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func TestOldBSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldB(popr, true)
|
|
size2 := proto.Size(p)
|
|
dAtA, err := 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 := proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func TestOldCSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldC(popr, true)
|
|
size2 := proto.Size(p)
|
|
dAtA, err := 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 := proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func TestOldUSize(t *testing.T) {
|
|
seed := time.Now().UnixNano()
|
|
popr := rand.New(rand.NewSource(seed))
|
|
p := NewPopulatedOldU(popr, true)
|
|
size2 := proto.Size(p)
|
|
dAtA, err := 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 := proto.Size(p)
|
|
if size3 != size {
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
}
|
|
}
|
|
|
|
func TestAStringer(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedA(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestBStringer(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedB(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestDStringer(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedD(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestCStringer(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedC(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestUStringer(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedU(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestUnoMStringer(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedUnoM(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestOldAStringer(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOldA(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestOldBStringer(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOldB(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestOldCStringer(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOldC(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestOldUStringer(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOldU(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
func TestOldUnoMStringer(t *testing.T) {
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
|
p := NewPopulatedOldUnoM(popr, false)
|
|
s1 := p.String()
|
|
s2 := fmt.Sprintf("%v", p)
|
|
if s1 != s2 {
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
}
|
|
}
|
|
|
|
//These tests are generated by github.com/gogo/protobuf/plugin/testgen
|