2018-03-06 10:32:47 -05:00
|
|
|
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
|
|
|
// source: combos/marshaler/map.proto
|
|
|
|
|
|
|
|
/*
|
|
|
|
Package mapdefaults is a generated protocol buffer package.
|
|
|
|
|
|
|
|
It is generated from these files:
|
|
|
|
combos/marshaler/map.proto
|
|
|
|
|
|
|
|
It has these top-level messages:
|
|
|
|
MapTest
|
|
|
|
FakeMap
|
|
|
|
FakeMapEntry
|
|
|
|
*/
|
|
|
|
package mapdefaults
|
|
|
|
|
|
|
|
import testing "testing"
|
2018-03-06 10:41:43 -05:00
|
|
|
import rand "math/rand"
|
2018-03-06 10:32:47 -05:00
|
|
|
import time "time"
|
|
|
|
import proto "github.com/gogo/protobuf/proto"
|
2018-03-06 10:41:43 -05:00
|
|
|
import jsonpb "github.com/gogo/protobuf/jsonpb"
|
|
|
|
import fmt "fmt"
|
|
|
|
import parser "go/parser"
|
2018-03-06 10:32:47 -05:00
|
|
|
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 TestMapTestProto(t *testing.T) {
|
|
|
|
seed := time.Now().UnixNano()
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(seed))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedMapTest(popr, false)
|
2018-03-06 10:41:43 -05:00
|
|
|
dAtA, err := proto.Marshal(p)
|
2018-03-06 10:32:47 -05:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
|
|
}
|
|
|
|
msg := &MapTest{}
|
2018-03-06 10:41:43 -05:00
|
|
|
if err := proto.Unmarshal(dAtA, msg); err != nil {
|
2018-03-06 10:32:47 -05:00
|
|
|
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
|
2018-03-06 10:41:43 -05:00
|
|
|
_ = proto.Unmarshal(littlefuzz, msg)
|
2018-03-06 10:32:47 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestMapTestMarshalTo(t *testing.T) {
|
|
|
|
seed := time.Now().UnixNano()
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(seed))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedMapTest(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 := &MapTest{}
|
2018-03-06 10:41:43 -05:00
|
|
|
if err := proto.Unmarshal(dAtA, msg); err != nil {
|
2018-03-06 10:32:47 -05:00
|
|
|
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 TestFakeMapProto(t *testing.T) {
|
|
|
|
seed := time.Now().UnixNano()
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(seed))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedFakeMap(popr, false)
|
2018-03-06 10:41:43 -05:00
|
|
|
dAtA, err := proto.Marshal(p)
|
2018-03-06 10:32:47 -05:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
|
|
}
|
|
|
|
msg := &FakeMap{}
|
2018-03-06 10:41:43 -05:00
|
|
|
if err := proto.Unmarshal(dAtA, msg); err != nil {
|
2018-03-06 10:32:47 -05:00
|
|
|
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
|
2018-03-06 10:41:43 -05:00
|
|
|
_ = proto.Unmarshal(littlefuzz, msg)
|
2018-03-06 10:32:47 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestFakeMapMarshalTo(t *testing.T) {
|
|
|
|
seed := time.Now().UnixNano()
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(seed))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedFakeMap(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 := &FakeMap{}
|
2018-03-06 10:41:43 -05:00
|
|
|
if err := proto.Unmarshal(dAtA, msg); err != nil {
|
2018-03-06 10:32:47 -05:00
|
|
|
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 TestFakeMapEntryProto(t *testing.T) {
|
|
|
|
seed := time.Now().UnixNano()
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(seed))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedFakeMapEntry(popr, false)
|
2018-03-06 10:41:43 -05:00
|
|
|
dAtA, err := proto.Marshal(p)
|
2018-03-06 10:32:47 -05:00
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
|
|
}
|
|
|
|
msg := &FakeMapEntry{}
|
2018-03-06 10:41:43 -05:00
|
|
|
if err := proto.Unmarshal(dAtA, msg); err != nil {
|
2018-03-06 10:32:47 -05:00
|
|
|
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
|
2018-03-06 10:41:43 -05:00
|
|
|
_ = proto.Unmarshal(littlefuzz, msg)
|
2018-03-06 10:32:47 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestFakeMapEntryMarshalTo(t *testing.T) {
|
|
|
|
seed := time.Now().UnixNano()
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(seed))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedFakeMapEntry(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 := &FakeMapEntry{}
|
2018-03-06 10:41:43 -05:00
|
|
|
if err := proto.Unmarshal(dAtA, msg); err != nil {
|
2018-03-06 10:32:47 -05:00
|
|
|
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 TestMapTestJSON(t *testing.T) {
|
|
|
|
seed := time.Now().UnixNano()
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(seed))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedMapTest(popr, true)
|
2018-03-06 10:41:43 -05:00
|
|
|
marshaler := jsonpb.Marshaler{}
|
2018-03-06 10:32:47 -05:00
|
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
|
|
}
|
|
|
|
msg := &MapTest{}
|
2018-03-06 10:41:43 -05:00
|
|
|
err = jsonpb.UnmarshalString(jsondata, msg)
|
2018-03-06 10:32:47 -05:00
|
|
|
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 TestFakeMapJSON(t *testing.T) {
|
|
|
|
seed := time.Now().UnixNano()
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(seed))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedFakeMap(popr, true)
|
2018-03-06 10:41:43 -05:00
|
|
|
marshaler := jsonpb.Marshaler{}
|
2018-03-06 10:32:47 -05:00
|
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
|
|
}
|
|
|
|
msg := &FakeMap{}
|
2018-03-06 10:41:43 -05:00
|
|
|
err = jsonpb.UnmarshalString(jsondata, msg)
|
2018-03-06 10:32:47 -05:00
|
|
|
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 TestFakeMapEntryJSON(t *testing.T) {
|
|
|
|
seed := time.Now().UnixNano()
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(seed))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedFakeMapEntry(popr, true)
|
2018-03-06 10:41:43 -05:00
|
|
|
marshaler := jsonpb.Marshaler{}
|
2018-03-06 10:32:47 -05:00
|
|
|
jsondata, err := marshaler.MarshalToString(p)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err)
|
|
|
|
}
|
|
|
|
msg := &FakeMapEntry{}
|
2018-03-06 10:41:43 -05:00
|
|
|
err = jsonpb.UnmarshalString(jsondata, msg)
|
2018-03-06 10:32:47 -05:00
|
|
|
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 TestMapTestProtoText(t *testing.T) {
|
|
|
|
seed := time.Now().UnixNano()
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(seed))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedMapTest(popr, true)
|
2018-03-06 10:41:43 -05:00
|
|
|
dAtA := proto.MarshalTextString(p)
|
2018-03-06 10:32:47 -05:00
|
|
|
msg := &MapTest{}
|
2018-03-06 10:41:43 -05:00
|
|
|
if err := proto.UnmarshalText(dAtA, msg); err != nil {
|
2018-03-06 10:32:47 -05:00
|
|
|
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 TestMapTestProtoCompactText(t *testing.T) {
|
|
|
|
seed := time.Now().UnixNano()
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(seed))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedMapTest(popr, true)
|
2018-03-06 10:41:43 -05:00
|
|
|
dAtA := proto.CompactTextString(p)
|
2018-03-06 10:32:47 -05:00
|
|
|
msg := &MapTest{}
|
2018-03-06 10:41:43 -05:00
|
|
|
if err := proto.UnmarshalText(dAtA, msg); err != nil {
|
2018-03-06 10:32:47 -05:00
|
|
|
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 TestFakeMapProtoText(t *testing.T) {
|
|
|
|
seed := time.Now().UnixNano()
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(seed))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedFakeMap(popr, true)
|
2018-03-06 10:41:43 -05:00
|
|
|
dAtA := proto.MarshalTextString(p)
|
2018-03-06 10:32:47 -05:00
|
|
|
msg := &FakeMap{}
|
2018-03-06 10:41:43 -05:00
|
|
|
if err := proto.UnmarshalText(dAtA, msg); err != nil {
|
2018-03-06 10:32:47 -05:00
|
|
|
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 TestFakeMapProtoCompactText(t *testing.T) {
|
|
|
|
seed := time.Now().UnixNano()
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(seed))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedFakeMap(popr, true)
|
2018-03-06 10:41:43 -05:00
|
|
|
dAtA := proto.CompactTextString(p)
|
2018-03-06 10:32:47 -05:00
|
|
|
msg := &FakeMap{}
|
2018-03-06 10:41:43 -05:00
|
|
|
if err := proto.UnmarshalText(dAtA, msg); err != nil {
|
2018-03-06 10:32:47 -05:00
|
|
|
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 TestFakeMapEntryProtoText(t *testing.T) {
|
|
|
|
seed := time.Now().UnixNano()
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(seed))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedFakeMapEntry(popr, true)
|
2018-03-06 10:41:43 -05:00
|
|
|
dAtA := proto.MarshalTextString(p)
|
2018-03-06 10:32:47 -05:00
|
|
|
msg := &FakeMapEntry{}
|
2018-03-06 10:41:43 -05:00
|
|
|
if err := proto.UnmarshalText(dAtA, msg); err != nil {
|
2018-03-06 10:32:47 -05:00
|
|
|
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 TestFakeMapEntryProtoCompactText(t *testing.T) {
|
|
|
|
seed := time.Now().UnixNano()
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(seed))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedFakeMapEntry(popr, true)
|
2018-03-06 10:41:43 -05:00
|
|
|
dAtA := proto.CompactTextString(p)
|
2018-03-06 10:32:47 -05:00
|
|
|
msg := &FakeMapEntry{}
|
2018-03-06 10:41:43 -05:00
|
|
|
if err := proto.UnmarshalText(dAtA, msg); err != nil {
|
2018-03-06 10:32:47 -05:00
|
|
|
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 TestMapDescription(t *testing.T) {
|
|
|
|
MapDescription()
|
|
|
|
}
|
|
|
|
func TestMapTestVerboseEqual(t *testing.T) {
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedMapTest(popr, false)
|
2018-03-06 10:41:43 -05:00
|
|
|
dAtA, err := proto.Marshal(p)
|
2018-03-06 10:32:47 -05:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
msg := &MapTest{}
|
2018-03-06 10:41:43 -05:00
|
|
|
if err := proto.Unmarshal(dAtA, msg); err != nil {
|
2018-03-06 10:32:47 -05:00
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func TestFakeMapVerboseEqual(t *testing.T) {
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedFakeMap(popr, false)
|
2018-03-06 10:41:43 -05:00
|
|
|
dAtA, err := proto.Marshal(p)
|
2018-03-06 10:32:47 -05:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
msg := &FakeMap{}
|
2018-03-06 10:41:43 -05:00
|
|
|
if err := proto.Unmarshal(dAtA, msg); err != nil {
|
2018-03-06 10:32:47 -05:00
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func TestFakeMapEntryVerboseEqual(t *testing.T) {
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedFakeMapEntry(popr, false)
|
2018-03-06 10:41:43 -05:00
|
|
|
dAtA, err := proto.Marshal(p)
|
2018-03-06 10:32:47 -05:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
msg := &FakeMapEntry{}
|
2018-03-06 10:41:43 -05:00
|
|
|
if err := proto.Unmarshal(dAtA, msg); err != nil {
|
2018-03-06 10:32:47 -05:00
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
if err := p.VerboseEqual(msg); err != nil {
|
|
|
|
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func TestMapTestGoString(t *testing.T) {
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedMapTest(popr, false)
|
|
|
|
s1 := p.GoString()
|
|
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
|
|
if s1 != s2 {
|
|
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
|
|
}
|
2018-03-06 10:41:43 -05:00
|
|
|
_, err := parser.ParseExpr(s1)
|
2018-03-06 10:32:47 -05:00
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func TestFakeMapGoString(t *testing.T) {
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedFakeMap(popr, false)
|
|
|
|
s1 := p.GoString()
|
|
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
|
|
if s1 != s2 {
|
|
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
|
|
}
|
2018-03-06 10:41:43 -05:00
|
|
|
_, err := parser.ParseExpr(s1)
|
2018-03-06 10:32:47 -05:00
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func TestFakeMapEntryGoString(t *testing.T) {
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedFakeMapEntry(popr, false)
|
|
|
|
s1 := p.GoString()
|
|
|
|
s2 := fmt.Sprintf("%#v", p)
|
|
|
|
if s1 != s2 {
|
|
|
|
t.Fatalf("GoString want %v got %v", s1, s2)
|
|
|
|
}
|
2018-03-06 10:41:43 -05:00
|
|
|
_, err := parser.ParseExpr(s1)
|
2018-03-06 10:32:47 -05:00
|
|
|
if err != nil {
|
|
|
|
t.Fatal(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func TestMapTestSize(t *testing.T) {
|
|
|
|
seed := time.Now().UnixNano()
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(seed))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedMapTest(popr, true)
|
2018-03-06 10:41:43 -05:00
|
|
|
size2 := proto.Size(p)
|
|
|
|
dAtA, err := proto.Marshal(p)
|
2018-03-06 10:32:47 -05:00
|
|
|
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)
|
|
|
|
}
|
2018-03-06 10:41:43 -05:00
|
|
|
size3 := proto.Size(p)
|
2018-03-06 10:32:47 -05:00
|
|
|
if size3 != size {
|
|
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestFakeMapSize(t *testing.T) {
|
|
|
|
seed := time.Now().UnixNano()
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(seed))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedFakeMap(popr, true)
|
2018-03-06 10:41:43 -05:00
|
|
|
size2 := proto.Size(p)
|
|
|
|
dAtA, err := proto.Marshal(p)
|
2018-03-06 10:32:47 -05:00
|
|
|
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)
|
|
|
|
}
|
2018-03-06 10:41:43 -05:00
|
|
|
size3 := proto.Size(p)
|
2018-03-06 10:32:47 -05:00
|
|
|
if size3 != size {
|
|
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestFakeMapEntrySize(t *testing.T) {
|
|
|
|
seed := time.Now().UnixNano()
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(seed))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedFakeMapEntry(popr, true)
|
2018-03-06 10:41:43 -05:00
|
|
|
size2 := proto.Size(p)
|
|
|
|
dAtA, err := proto.Marshal(p)
|
2018-03-06 10:32:47 -05:00
|
|
|
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)
|
|
|
|
}
|
2018-03-06 10:41:43 -05:00
|
|
|
size3 := proto.Size(p)
|
2018-03-06 10:32:47 -05:00
|
|
|
if size3 != size {
|
|
|
|
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestMapTestStringer(t *testing.T) {
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedMapTest(popr, false)
|
|
|
|
s1 := p.String()
|
|
|
|
s2 := fmt.Sprintf("%v", p)
|
|
|
|
if s1 != s2 {
|
|
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func TestFakeMapStringer(t *testing.T) {
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedFakeMap(popr, false)
|
|
|
|
s1 := p.String()
|
|
|
|
s2 := fmt.Sprintf("%v", p)
|
|
|
|
if s1 != s2 {
|
|
|
|
t.Fatalf("String want %v got %v", s1, s2)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func TestFakeMapEntryStringer(t *testing.T) {
|
2018-03-06 10:41:43 -05:00
|
|
|
popr := rand.New(rand.NewSource(time.Now().UnixNano()))
|
2018-03-06 10:32:47 -05:00
|
|
|
p := NewPopulatedFakeMapEntry(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
|