Commit a56cbf98 authored by Jakub Sztandera's avatar Jakub Sztandera

gx publish 1.1.31

parent 1cc06b0c
1.1.30: QmQvMsV5aPyd7eMd3U1hvAUhZEupG3rXbVZn7ppU5RE6bt
1.1.31: QmaaGCdoNe5juy9QxdZ2grartLXkXH7jS6zaU27AmxsJeT
......@@ -39,21 +39,21 @@
},
{
"author": "hsanjuan",
"hash": "QmYZwey1thDTynSrvd6qQkX24UpTka6TFhQ2v569UpoqxD",
"hash": "QmSz8kAe2JCKp2dWSG8gHSWnwSmne8YfRXTeK5HBmc9L7t",
"name": "go-ipfs-exchange-offline",
"version": "0.1.5"
"version": "0.1.6"
},
{
"author": "whyrusleeping",
"hash": "QmdxUuburamoF6zF9qjeQC4WYcWGbWuRmdLacMEsW8ioD8",
"hash": "QmddjPSGZb3ieihSseFeCfVRpZzcqczPNsD2DvarSwnjJB",
"name": "gogo-protobuf",
"version": "0.0.0"
"version": "1.2.1"
},
{
"author": "why",
"hash": "QmZuPasxd7fSgtzRzCL7Z8J8QwDJML2fgBUExRbQCqb4BT",
"hash": "QmUnzGFx7TSofhfrtyaJKzhP6sx5j5QfF76BFCVQa65mJr",
"name": "go-blockservice",
"version": "1.1.23"
"version": "1.1.24"
}
],
"gxVersion": "0.12.1",
......@@ -61,6 +61,6 @@
"license": "",
"name": "go-merkledag",
"releaseCmd": "git commit -a -m \"gx publish $VERSION\"",
"version": "1.1.30"
"version": "1.1.31"
}
This diff is collapsed.
package merkledag.pb;
import "code.google.com/p/gogoprotobuf/gogoproto/gogo.proto";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option (gogoproto.gostring_all) = true;
option (gogoproto.equal_all) = true;
......
// Code generated by protoc-gen-gogo.
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: merkledag.proto
// DO NOT EDIT!
/*
Package merkledag_pb is a generated protocol buffer package.
It is generated from these files:
merkledag.proto
It has these top-level messages:
PBLink
PBNode
*/
package merkledag_pb
import testing "testing"
import math_rand "math/rand"
import time "time"
import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
import encoding_json "encoding/json"
import fmt "fmt"
import go_parser "go/parser"
import (
fmt "fmt"
_ "github.com/gogo/protobuf/gogoproto"
github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb"
github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
proto "github.com/gogo/protobuf/proto"
go_parser "go/parser"
math "math"
math_rand "math/rand"
testing "testing"
time "time"
)
// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf
func TestPBLinkProto(t *testing.T) {
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
seed := time.Now().UnixNano()
popr := math_rand.New(math_rand.NewSource(seed))
p := NewPopulatedPBLink(popr, false)
data, err := github_com_gogo_protobuf_proto.Marshal(p)
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
if err != nil {
panic(err)
t.Fatalf("seed = %d, err = %v", seed, err)
}
msg := &PBLink{}
if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil {
panic(err)
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
t.Fatalf("seed = %d, err = %v", seed, err)
}
for i := range data {
data[i] = byte(popr.Intn(256))
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("%#v !VerboseProto %#v, since %v", msg, p, err)
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
}
if !p.Equal(msg) {
t.Fatalf("%#v !Proto %#v", msg, p)
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
}
if len(littlefuzz) > 0 {
fuzzamount := 100
for i := 0; i < fuzzamount; i++ {
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
}
// shouldn't panic
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
}
}
func TestPBLinkMarshalTo(t *testing.T) {
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
seed := time.Now().UnixNano()
popr := math_rand.New(math_rand.NewSource(seed))
p := NewPopulatedPBLink(popr, false)
size := p.Size()
data := make([]byte, size)
for i := range data {
data[i] = byte(popr.Intn(256))
dAtA := make([]byte, size)
for i := range dAtA {
dAtA[i] = byte(popr.Intn(256))
}
_, err := p.MarshalTo(data)
_, err := p.MarshalTo(dAtA)
if err != nil {
panic(err)
t.Fatalf("seed = %d, err = %v", seed, err)
}
msg := &PBLink{}
if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil {
panic(err)
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
t.Fatalf("seed = %d, err = %v", seed, err)
}
for i := range data {
data[i] = byte(popr.Intn(256))
for i := range dAtA {
dAtA[i] = byte(popr.Intn(256))
}
if err := p.VerboseEqual(msg); err != nil {
t.Fatalf("%#v !VerboseProto %#v, since %v", msg, p, err)
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
}
if !p.Equal(msg) {
t.Fatalf("%#v !Proto %#v", msg, p)
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
}
}
......@@ -80,11 +92,11 @@ func BenchmarkPBLinkProtoMarshal(b *testing.B) {
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
if err != nil {
panic(err)
}
total += len(data)
total += len(dAtA)
}
b.SetBytes(int64(total / b.N))
}
......@@ -94,11 +106,11 @@ func BenchmarkPBLinkProtoUnmarshal(b *testing.B) {
total := 0
datas := make([][]byte, 10000)
for i := 0; i < 10000; i++ {
data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedPBLink(popr, false))
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedPBLink(popr, false))
if err != nil {
panic(err)
}
datas[i] = data
datas[i] = dAtA
}
msg := &PBLink{}
b.ResetTimer()
......@@ -112,51 +124,64 @@ func BenchmarkPBLinkProtoUnmarshal(b *testing.B) {
}
func TestPBNodeProto(t *testing.T) {
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
seed := time.Now().UnixNano()
popr := math_rand.New(math_rand.NewSource(seed))
p := NewPopulatedPBNode(popr, false)
data, err := github_com_gogo_protobuf_proto.Marshal(p)
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
if err != nil {
panic(err)
t.Fatalf("seed = %d, err = %v", seed, err)
}
msg := &PBNode{}
if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil {
panic(err)
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
t.Fatalf("seed = %d, err = %v", seed, err)
}
for i := range data {
data[i] = byte(popr.Intn(256))
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("%#v !VerboseProto %#v, since %v", msg, p, err)
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
}
if !p.Equal(msg) {
t.Fatalf("%#v !Proto %#v", msg, p)
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
}
if len(littlefuzz) > 0 {
fuzzamount := 100
for i := 0; i < fuzzamount; i++ {
littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
}
// shouldn't panic
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
}
}
func TestPBNodeMarshalTo(t *testing.T) {
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
seed := time.Now().UnixNano()
popr := math_rand.New(math_rand.NewSource(seed))
p := NewPopulatedPBNode(popr, false)
size := p.Size()
data := make([]byte, size)
for i := range data {
data[i] = byte(popr.Intn(256))
dAtA := make([]byte, size)
for i := range dAtA {
dAtA[i] = byte(popr.Intn(256))
}
_, err := p.MarshalTo(data)
_, err := p.MarshalTo(dAtA)
if err != nil {
panic(err)
t.Fatalf("seed = %d, err = %v", seed, err)
}
msg := &PBNode{}
if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil {
panic(err)
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
t.Fatalf("seed = %d, err = %v", seed, err)
}
for i := range data {
data[i] = byte(popr.Intn(256))
for i := range dAtA {
dAtA[i] = byte(popr.Intn(256))
}
if err := p.VerboseEqual(msg); err != nil {
t.Fatalf("%#v !VerboseProto %#v, since %v", msg, p, err)
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
}
if !p.Equal(msg) {
t.Fatalf("%#v !Proto %#v", msg, p)
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
}
}
......@@ -169,11 +194,11 @@ func BenchmarkPBNodeProtoMarshal(b *testing.B) {
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
data, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
if err != nil {
panic(err)
}
total += len(data)
total += len(dAtA)
}
b.SetBytes(int64(total / b.N))
}
......@@ -183,11 +208,11 @@ func BenchmarkPBNodeProtoUnmarshal(b *testing.B) {
total := 0
datas := make([][]byte, 10000)
for i := 0; i < 10000; i++ {
data, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedPBNode(popr, false))
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedPBNode(popr, false))
if err != nil {
panic(err)
}
datas[i] = data
datas[i] = dAtA
}
msg := &PBNode{}
b.ResetTimer()
......@@ -201,143 +226,190 @@ func BenchmarkPBNodeProtoUnmarshal(b *testing.B) {
}
func TestPBLinkJSON(t *testing.T) {
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
seed := time.Now().UnixNano()
popr := math_rand.New(math_rand.NewSource(seed))
p := NewPopulatedPBLink(popr, true)
jsondata, err := encoding_json.Marshal(p)
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
jsondata, err := marshaler.MarshalToString(p)
if err != nil {
panic(err)
t.Fatalf("seed = %d, err = %v", seed, err)
}
msg := &PBLink{}
err = encoding_json.Unmarshal(jsondata, msg)
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
if err != nil {
panic(err)
t.Fatalf("seed = %d, err = %v", seed, err)
}
if err := p.VerboseEqual(msg); err != nil {
t.Fatalf("%#v !VerboseProto %#v, since %v", msg, p, err)
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
}
if !p.Equal(msg) {
t.Fatalf("%#v !Json Equal %#v", msg, p)
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
}
}
func TestPBNodeJSON(t *testing.T) {
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
seed := time.Now().UnixNano()
popr := math_rand.New(math_rand.NewSource(seed))
p := NewPopulatedPBNode(popr, true)
jsondata, err := encoding_json.Marshal(p)
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
jsondata, err := marshaler.MarshalToString(p)
if err != nil {
panic(err)
t.Fatalf("seed = %d, err = %v", seed, err)
}
msg := &PBNode{}
err = encoding_json.Unmarshal(jsondata, msg)
err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
if err != nil {
panic(err)
t.Fatalf("seed = %d, err = %v", seed, err)
}
if err := p.VerboseEqual(msg); err != nil {
t.Fatalf("%#v !VerboseProto %#v, since %v", msg, p, err)
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
}
if !p.Equal(msg) {
t.Fatalf("%#v !Json Equal %#v", msg, p)
t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
}
}
func TestPBLinkProtoText(t *testing.T) {
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
seed := time.Now().UnixNano()
popr := math_rand.New(math_rand.NewSource(seed))
p := NewPopulatedPBLink(popr, true)
data := github_com_gogo_protobuf_proto.MarshalTextString(p)
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
msg := &PBLink{}
if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil {
panic(err)
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
t.Fatalf("seed = %d, err = %v", seed, err)
}
if err := p.VerboseEqual(msg); err != nil {
t.Fatalf("%#v !VerboseProto %#v, since %v", msg, p, err)
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
}
if !p.Equal(msg) {
t.Fatalf("%#v !Proto %#v", msg, p)
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
}
}
func TestPBLinkProtoCompactText(t *testing.T) {
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
seed := time.Now().UnixNano()
popr := math_rand.New(math_rand.NewSource(seed))
p := NewPopulatedPBLink(popr, true)
data := github_com_gogo_protobuf_proto.CompactTextString(p)
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
msg := &PBLink{}
if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil {
panic(err)
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
t.Fatalf("seed = %d, err = %v", seed, err)
}
if err := p.VerboseEqual(msg); err != nil {
t.Fatalf("%#v !VerboseProto %#v, since %v", msg, p, err)
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
}
if !p.Equal(msg) {
t.Fatalf("%#v !Proto %#v", msg, p)
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
}
}
func TestPBNodeProtoText(t *testing.T) {
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
seed := time.Now().UnixNano()
popr := math_rand.New(math_rand.NewSource(seed))
p := NewPopulatedPBNode(popr, true)
data := github_com_gogo_protobuf_proto.MarshalTextString(p)
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
msg := &PBNode{}
if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil {
panic(err)
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
t.Fatalf("seed = %d, err = %v", seed, err)
}
if err := p.VerboseEqual(msg); err != nil {
t.Fatalf("%#v !VerboseProto %#v, since %v", msg, p, err)
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
}
if !p.Equal(msg) {
t.Fatalf("%#v !Proto %#v", msg, p)
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
}
}
func TestPBNodeProtoCompactText(t *testing.T) {
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
seed := time.Now().UnixNano()
popr := math_rand.New(math_rand.NewSource(seed))
p := NewPopulatedPBNode(popr, true)
data := github_com_gogo_protobuf_proto.CompactTextString(p)
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
msg := &PBNode{}
if err := github_com_gogo_protobuf_proto.UnmarshalText(data, msg); err != nil {
panic(err)
if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
t.Fatalf("seed = %d, err = %v", seed, err)
}
if err := p.VerboseEqual(msg); err != nil {
t.Fatalf("%#v !VerboseProto %#v, since %v", msg, p, err)
t.Fatalf("seed = %d, %#v !VerboseProto %#v, since %v", seed, msg, p, err)
}
if !p.Equal(msg) {
t.Fatalf("%#v !Proto %#v", msg, p)
t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
}
}
func TestPBLinkStringer(t *testing.T) {
func TestPBLinkVerboseEqual(t *testing.T) {
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
p := NewPopulatedPBLink(popr, false)
s1 := p.String()
s2 := fmt.Sprintf("%v", p)
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
if err != nil {
panic(err)
}
msg := &PBLink{}
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
panic(err)
}
if err := p.VerboseEqual(msg); err != nil {
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
}
}
func TestPBNodeVerboseEqual(t *testing.T) {
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
p := NewPopulatedPBNode(popr, false)
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
if err != nil {
panic(err)
}
msg := &PBNode{}
if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
panic(err)
}
if err := p.VerboseEqual(msg); err != nil {
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
}
}
func TestPBLinkGoString(t *testing.T) {
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
p := NewPopulatedPBLink(popr, false)
s1 := p.GoString()
s2 := fmt.Sprintf("%#v", p)
if s1 != s2 {
t.Fatalf("String want %v got %v", s1, s2)
t.Fatalf("GoString want %v got %v", s1, s2)
}
_, err := go_parser.ParseExpr(s1)
if err != nil {
t.Fatal(err)
}
}
func TestPBNodeStringer(t *testing.T) {
func TestPBNodeGoString(t *testing.T) {
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
p := NewPopulatedPBNode(popr, false)
s1 := p.String()
s2 := fmt.Sprintf("%v", p)
s1 := p.GoString()
s2 := fmt.Sprintf("%#v", p)
if s1 != s2 {
t.Fatalf("String want %v got %v", s1, s2)
t.Fatalf("GoString want %v got %v", s1, s2)
}
_, err := go_parser.ParseExpr(s1)
if err != nil {
t.Fatal(err)
}
}
func TestPBLinkSize(t *testing.T) {
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
seed := time.Now().UnixNano()
popr := math_rand.New(math_rand.NewSource(seed))
p := NewPopulatedPBLink(popr, true)
size2 := github_com_gogo_protobuf_proto.Size(p)
data, err := github_com_gogo_protobuf_proto.Marshal(p)
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
if err != nil {
panic(err)
t.Fatalf("seed = %d, err = %v", seed, err)
}
size := p.Size()
if len(data) != size {
t.Fatalf("size %v != marshalled size %v", size, len(data))
if len(dAtA) != size {
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
}
if size2 != size {
t.Fatalf("size %v != before marshal proto.Size %v", size, size2)
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
}
size3 := github_com_gogo_protobuf_proto.Size(p)
if size3 != size {
t.Fatalf("size %v != after marshal proto.Size %v", size, size3)
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
}
}
......@@ -356,23 +428,24 @@ func BenchmarkPBLinkSize(b *testing.B) {
}
func TestPBNodeSize(t *testing.T) {
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
seed := time.Now().UnixNano()
popr := math_rand.New(math_rand.NewSource(seed))
p := NewPopulatedPBNode(popr, true)
size2 := github_com_gogo_protobuf_proto.Size(p)
data, err := github_com_gogo_protobuf_proto.Marshal(p)
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
if err != nil {
panic(err)
t.Fatalf("seed = %d, err = %v", seed, err)
}
size := p.Size()
if len(data) != size {
t.Fatalf("size %v != marshalled size %v", size, len(data))
if len(dAtA) != size {
t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
}
if size2 != size {
t.Fatalf("size %v != before marshal proto.Size %v", size, size2)
t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
}
size3 := github_com_gogo_protobuf_proto.Size(p)
if size3 != size {
t.Fatalf("size %v != after marshal proto.Size %v", size, size3)
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
}
}
......@@ -390,60 +463,22 @@ func BenchmarkPBNodeSize(b *testing.B) {
b.SetBytes(int64(total / b.N))
}
func TestPBLinkGoString(t *testing.T) {
func TestPBLinkStringer(t *testing.T) {
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
p := NewPopulatedPBLink(popr, false)
s1 := p.GoString()
s2 := fmt.Sprintf("%#v", p)
s1 := p.String()
s2 := fmt.Sprintf("%v", p)
if s1 != s2 {
t.Fatalf("GoString want %v got %v", s1, s2)
}
_, err := go_parser.ParseExpr(s1)
if err != nil {
panic(err)
t.Fatalf("String want %v got %v", s1, s2)
}
}
func TestPBNodeGoString(t *testing.T) {
func TestPBNodeStringer(t *testing.T) {
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
p := NewPopulatedPBNode(popr, false)
s1 := p.GoString()
s2 := fmt.Sprintf("%#v", p)
s1 := p.String()
s2 := fmt.Sprintf("%v", p)
if s1 != s2 {
t.Fatalf("GoString want %v got %v", s1, s2)
}
_, err := go_parser.ParseExpr(s1)
if err != nil {
panic(err)
}
}
func TestPBLinkVerboseEqual(t *testing.T) {
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
p := NewPopulatedPBLink(popr, false)
data, err := github_com_gogo_protobuf_proto.Marshal(p)
if err != nil {
panic(err)
}
msg := &PBLink{}
if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil {
panic(err)
}
if err := p.VerboseEqual(msg); err != nil {
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
}
}
func TestPBNodeVerboseEqual(t *testing.T) {
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
p := NewPopulatedPBNode(popr, false)
data, err := github_com_gogo_protobuf_proto.Marshal(p)
if err != nil {
panic(err)
}
msg := &PBNode{}
if err := github_com_gogo_protobuf_proto.Unmarshal(data, msg); err != nil {
panic(err)
}
if err := p.VerboseEqual(msg); err != nil {
t.Fatalf("%#v !VerboseEqual %#v, since %v", msg, p, err)
t.Fatalf("String want %v got %v", s1, s2)
}
}
......
package merkledag_pb
import (
bytes "bytes"
"testing"
)
func TestStability(t *testing.T) {
correct := []byte("\x12\x87\x01\n;\x81\x869\xacH\xa4Ư\xa2\xf1X\x1a\x8b\x95%\xe2\x0f\xdah\x92\u007f+/\xf86\xf75x\xdb\x0f\xa5L)\xf7\xfd\x92\x8d\x92\xcaC\xf1\x93\xde\xe4\u007fY\x15I\xf5\x97\xa8\x11\xc8\xfag\xab\x03\x1e\xbd\x12B|CMw`mHq{>?|vd{0F7>8<B;SUcg1E|NU:>m[C`HSg3UcXmGs-qp-z6{Kc.tGX->H07\x18\xeaئ\xd0\b\x129\x121LZ3,V9jnmk^veYEV71EMLt9;6]}b<OBKeL+0ceE8.SenYYxr,\x18\xc1\x05\x127\n/Z\xb5R\x9dp@t\xafJ\xc8\xc0\xf5\xa4o\tn\xe8GzwT0\x03\x8f\xc0\x0e\xac\x03\xafM\xdc\xd3%\xbd+11\x064\x8a\b\xb8d\"\xf5ݬ\x18\xf5\x8d\xd7\xc7\r\x12b\n<\xaf\xbdm\xdc\b\x0f\x1d\xfd\xc9ĭ%oGV F\xfc@T\xf5\x9b[\xe5F^u\xe6\xe0\xaa`\xc8\xeb.\xe5\xd4\xcd&P\xa8\x1c\xce\xe3U\a\xa1\x1a7\x90q\xc7Q\xf7\x1f\xdf\r\xfe\xb3\xfb\xc8\x12\x1cBe<DTg1rDhlUHMppHvO8n\\C.Go^T\x18\x82\x8b\xd1\xce\x0f\x12f\nY\n\x87\x16\xa9(\xe7ͺ\xeaɿ%\x00\x98IE\xcc\xe5\xdaLo\xb4\x82\x9d\xbbf\x9faD@\xf7\x19.\x14\xea_\xbaI,\x95V\xd7@\x88\xa9\x13.J\\\x13\xcc\x15\x9a\xa6\xebJ\x0e\x9b\x96<\xad\xd1n\x9c-\xba\xfd\xce&\xc7\x18\xbc\xdc\x0f\xa7ԭ\x15^\xeb̹Fq\xe3\xdd\xfbK\x99\x12\x03Xyv\x18\xb3Ր\xb3\r\x12}\nI\x89\xdf\xff\x84\r\xaeʨ\x9b\x8e\xf21\xf6\xf2~\x13\xda\xeb\xe2\xed\xcd\xed\x9f\u007fz\xa1\x83N\xda\x01\xe35A \x10\xa6\x11|u\\*{N\x18)\xae\xc7\xc5\x06\xc1d\a\xcc\x17\xb0\x8f\xd5\xd2\xe3Pj\x9aH\x04\xa3\xba{\"\xd1\x15\x12*Y6m[-JhYc}LWlNU533k`>nkU2e7GXmqisoCPV0C+ni\x18Ա\xfe\x8b\f\x12u\n'\xf2#\xc1\xc0nQ\xf9\xb5\x19\x80\xcd\xf8\x06k1\xf6#\x84\x1c\xb6\xbf\xeaY\x9b\xd8O\x84\x04\xdbKq\xe4\xae\xf2\xd6\xe9*\x16B\x12D[gVeg4=t}EGSu82+dmgvQ+Tr>_sLUJ|iZ[P2y2T67ilvEikK}\\iru?IF?mVS[Mv9KG8+\x18\x92\xa0\xf9\xa1\n\n\x11\v\x06ѣ\x80nH\x12\x00\xa7\xd2w͝")
n := new(PBNode)
err := n.Unmarshal(correct)
if err != nil {
t.Fatal(err)
}
d, err := n.Marshal()
if err != nil {
t.Fatal(err)
}
if !bytes.Equal(d, correct) {
t.Logf("%q", d)
t.Fatal("protobuf not stable")
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment