Beispiel #1
0
func TestPBNodeProtoCompactText(t *testing.T) {
	popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
	p := NewPopulatedPBNode(popr, true)
	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 := p.VerboseEqual(msg); err != nil {
		t.Fatalf("%#v !VerboseProto %#v, since %v", msg, p, err)
	}
	if !p.Equal(msg) {
		t.Fatalf("%#v !Proto %#v", msg, p)
	}
}
Beispiel #2
0
func (m *Exchange) String() string { return proto.CompactTextString(m) }
Beispiel #3
0
func (m *Propose) String() string { return proto.CompactTextString(m) }
Beispiel #4
0
func (m *Message_Wantlist_Entry) String() string { return proto.CompactTextString(m) }
Beispiel #5
0
func (m *Message) String() string { return proto.CompactTextString(m) }
Beispiel #6
0
func (m *Record) String() string { return proto.CompactTextString(m) }
Beispiel #7
0
func (m *Identify) String() string { return proto.CompactTextString(m) }
Beispiel #8
0
func TestCompactText(t *testing.T) {
	s := proto.CompactTextString(newTestMessage())
	if s != compactText {
		t.Errorf("Got:\n===\n%v===\nExpected:\n===\n%v\n===\n", s, compactText)
	}
}