|
|
@ -0,0 +1,531 @@ |
|
|
|
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
|
|
|
// source: rpc/grpc/types.proto
|
|
|
|
|
|
|
|
/* |
|
|
|
Package core_grpc is a generated protocol buffer package. |
|
|
|
|
|
|
|
It is generated from these files: |
|
|
|
rpc/grpc/types.proto |
|
|
|
|
|
|
|
It has these top-level messages: |
|
|
|
RequestPing |
|
|
|
RequestBroadcastTx |
|
|
|
ResponsePing |
|
|
|
ResponseBroadcastTx |
|
|
|
*/ |
|
|
|
package core_grpc |
|
|
|
|
|
|
|
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 golang_proto "github.com/golang/protobuf/proto" |
|
|
|
import fmt "fmt" |
|
|
|
import math "math" |
|
|
|
import _ "github.com/gogo/protobuf/gogoproto" |
|
|
|
import _ "github.com/tendermint/tendermint/abci/types" |
|
|
|
|
|
|
|
// Reference imports to suppress errors if they are not otherwise used.
|
|
|
|
var _ = proto.Marshal |
|
|
|
var _ = golang_proto.Marshal |
|
|
|
var _ = fmt.Errorf |
|
|
|
var _ = math.Inf |
|
|
|
|
|
|
|
func TestRequestPingProto(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedRequestPing(popr, false) |
|
|
|
dAtA, err := proto.Marshal(p) |
|
|
|
if err != nil { |
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err) |
|
|
|
} |
|
|
|
msg := &RequestPing{} |
|
|
|
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 !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 TestRequestPingMarshalTo(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedRequestPing(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 := &RequestPing{} |
|
|
|
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 !p.Equal(msg) { |
|
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func TestRequestBroadcastTxProto(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedRequestBroadcastTx(popr, false) |
|
|
|
dAtA, err := proto.Marshal(p) |
|
|
|
if err != nil { |
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err) |
|
|
|
} |
|
|
|
msg := &RequestBroadcastTx{} |
|
|
|
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 !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 TestRequestBroadcastTxMarshalTo(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedRequestBroadcastTx(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 := &RequestBroadcastTx{} |
|
|
|
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 !p.Equal(msg) { |
|
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func TestResponsePingProto(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedResponsePing(popr, false) |
|
|
|
dAtA, err := proto.Marshal(p) |
|
|
|
if err != nil { |
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err) |
|
|
|
} |
|
|
|
msg := &ResponsePing{} |
|
|
|
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 !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 TestResponsePingMarshalTo(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedResponsePing(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 := &ResponsePing{} |
|
|
|
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 !p.Equal(msg) { |
|
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func TestResponseBroadcastTxProto(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedResponseBroadcastTx(popr, false) |
|
|
|
dAtA, err := proto.Marshal(p) |
|
|
|
if err != nil { |
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err) |
|
|
|
} |
|
|
|
msg := &ResponseBroadcastTx{} |
|
|
|
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 !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 TestResponseBroadcastTxMarshalTo(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedResponseBroadcastTx(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 := &ResponseBroadcastTx{} |
|
|
|
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 !p.Equal(msg) { |
|
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func TestRequestPingJSON(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedRequestPing(popr, true) |
|
|
|
marshaler := jsonpb.Marshaler{} |
|
|
|
jsondata, err := marshaler.MarshalToString(p) |
|
|
|
if err != nil { |
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err) |
|
|
|
} |
|
|
|
msg := &RequestPing{} |
|
|
|
err = jsonpb.UnmarshalString(jsondata, msg) |
|
|
|
if err != nil { |
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err) |
|
|
|
} |
|
|
|
if !p.Equal(msg) { |
|
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) |
|
|
|
} |
|
|
|
} |
|
|
|
func TestRequestBroadcastTxJSON(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedRequestBroadcastTx(popr, true) |
|
|
|
marshaler := jsonpb.Marshaler{} |
|
|
|
jsondata, err := marshaler.MarshalToString(p) |
|
|
|
if err != nil { |
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err) |
|
|
|
} |
|
|
|
msg := &RequestBroadcastTx{} |
|
|
|
err = jsonpb.UnmarshalString(jsondata, msg) |
|
|
|
if err != nil { |
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err) |
|
|
|
} |
|
|
|
if !p.Equal(msg) { |
|
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) |
|
|
|
} |
|
|
|
} |
|
|
|
func TestResponsePingJSON(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedResponsePing(popr, true) |
|
|
|
marshaler := jsonpb.Marshaler{} |
|
|
|
jsondata, err := marshaler.MarshalToString(p) |
|
|
|
if err != nil { |
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err) |
|
|
|
} |
|
|
|
msg := &ResponsePing{} |
|
|
|
err = jsonpb.UnmarshalString(jsondata, msg) |
|
|
|
if err != nil { |
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err) |
|
|
|
} |
|
|
|
if !p.Equal(msg) { |
|
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) |
|
|
|
} |
|
|
|
} |
|
|
|
func TestResponseBroadcastTxJSON(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedResponseBroadcastTx(popr, true) |
|
|
|
marshaler := jsonpb.Marshaler{} |
|
|
|
jsondata, err := marshaler.MarshalToString(p) |
|
|
|
if err != nil { |
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err) |
|
|
|
} |
|
|
|
msg := &ResponseBroadcastTx{} |
|
|
|
err = jsonpb.UnmarshalString(jsondata, msg) |
|
|
|
if err != nil { |
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err) |
|
|
|
} |
|
|
|
if !p.Equal(msg) { |
|
|
|
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) |
|
|
|
} |
|
|
|
} |
|
|
|
func TestRequestPingProtoText(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedRequestPing(popr, true) |
|
|
|
dAtA := proto.MarshalTextString(p) |
|
|
|
msg := &RequestPing{} |
|
|
|
if err := proto.UnmarshalText(dAtA, msg); err != nil { |
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err) |
|
|
|
} |
|
|
|
if !p.Equal(msg) { |
|
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func TestRequestPingProtoCompactText(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedRequestPing(popr, true) |
|
|
|
dAtA := proto.CompactTextString(p) |
|
|
|
msg := &RequestPing{} |
|
|
|
if err := proto.UnmarshalText(dAtA, msg); err != nil { |
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err) |
|
|
|
} |
|
|
|
if !p.Equal(msg) { |
|
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func TestRequestBroadcastTxProtoText(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedRequestBroadcastTx(popr, true) |
|
|
|
dAtA := proto.MarshalTextString(p) |
|
|
|
msg := &RequestBroadcastTx{} |
|
|
|
if err := proto.UnmarshalText(dAtA, msg); err != nil { |
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err) |
|
|
|
} |
|
|
|
if !p.Equal(msg) { |
|
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func TestRequestBroadcastTxProtoCompactText(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedRequestBroadcastTx(popr, true) |
|
|
|
dAtA := proto.CompactTextString(p) |
|
|
|
msg := &RequestBroadcastTx{} |
|
|
|
if err := proto.UnmarshalText(dAtA, msg); err != nil { |
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err) |
|
|
|
} |
|
|
|
if !p.Equal(msg) { |
|
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func TestResponsePingProtoText(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedResponsePing(popr, true) |
|
|
|
dAtA := proto.MarshalTextString(p) |
|
|
|
msg := &ResponsePing{} |
|
|
|
if err := proto.UnmarshalText(dAtA, msg); err != nil { |
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err) |
|
|
|
} |
|
|
|
if !p.Equal(msg) { |
|
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func TestResponsePingProtoCompactText(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedResponsePing(popr, true) |
|
|
|
dAtA := proto.CompactTextString(p) |
|
|
|
msg := &ResponsePing{} |
|
|
|
if err := proto.UnmarshalText(dAtA, msg); err != nil { |
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err) |
|
|
|
} |
|
|
|
if !p.Equal(msg) { |
|
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func TestResponseBroadcastTxProtoText(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedResponseBroadcastTx(popr, true) |
|
|
|
dAtA := proto.MarshalTextString(p) |
|
|
|
msg := &ResponseBroadcastTx{} |
|
|
|
if err := proto.UnmarshalText(dAtA, msg); err != nil { |
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err) |
|
|
|
} |
|
|
|
if !p.Equal(msg) { |
|
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func TestResponseBroadcastTxProtoCompactText(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedResponseBroadcastTx(popr, true) |
|
|
|
dAtA := proto.CompactTextString(p) |
|
|
|
msg := &ResponseBroadcastTx{} |
|
|
|
if err := proto.UnmarshalText(dAtA, msg); err != nil { |
|
|
|
t.Fatalf("seed = %d, err = %v", seed, err) |
|
|
|
} |
|
|
|
if !p.Equal(msg) { |
|
|
|
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func TestRequestPingSize(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedRequestPing(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 TestRequestBroadcastTxSize(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedRequestBroadcastTx(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 TestResponsePingSize(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedResponsePing(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 TestResponseBroadcastTxSize(t *testing.T) { |
|
|
|
seed := time.Now().UnixNano() |
|
|
|
popr := rand.New(rand.NewSource(seed)) |
|
|
|
p := NewPopulatedResponseBroadcastTx(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) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//These tests are generated by github.com/gogo/protobuf/plugin/testgen
|