mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-14 02:43:36 +00:00
added vendors
This commit is contained in:
1
vendor/github.com/gogo/protobuf/test/.gitignore
generated
vendored
Normal file
1
vendor/github.com/gogo/protobuf/test/.gitignore
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.dat
|
39
vendor/github.com/gogo/protobuf/test/Makefile
generated
vendored
Normal file
39
vendor/github.com/gogo/protobuf/test/Makefile
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
# Protocol Buffers for Go with Gadgets
|
||||
#
|
||||
# Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
# http://github.com/gogo/protobuf
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
regenerate:
|
||||
go install github.com/gogo/protobuf/protoc-gen-gogo
|
||||
go install github.com/gogo/protobuf/protoc-gen-combo
|
||||
protoc --gogo_out=. --proto_path=../protobuf/:../:../../../../:. thetest.proto
|
||||
protoc-gen-combo --default=false --gogo_out=. --proto_path=../protobuf/:../:../../../../:. thetest.proto
|
||||
cp uuid.go ./combos/both/
|
||||
cp uuid.go ./combos/marshaler/
|
||||
cp uuid.go ./combos/unmarshaler/
|
||||
cp bug_test.go ./combos/both/
|
||||
cp bug_test.go ./combos/marshaler/
|
||||
cp bug_test.go ./combos/unmarshaler/
|
30
vendor/github.com/gogo/protobuf/test/asymetric-issue125/Makefile
generated
vendored
Normal file
30
vendor/github.com/gogo/protobuf/test/asymetric-issue125/Makefile
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
# Protocol Buffers for Go with Gadgets
|
||||
#
|
||||
# Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
# http://github.com/gogo/protobuf
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
regenerate:
|
||||
(protoc --proto_path=../../../../../:../../protobuf/:. --gogo_out=. asym.proto)
|
638
vendor/github.com/gogo/protobuf/test/asymetric-issue125/asym.pb.go
generated
vendored
Normal file
638
vendor/github.com/gogo/protobuf/test/asymetric-issue125/asym.pb.go
generated
vendored
Normal file
@ -0,0 +1,638 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: asym.proto
|
||||
|
||||
package asym
|
||||
|
||||
import proto "github.com/gogo/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "github.com/gogo/protobuf/gogoproto"
|
||||
|
||||
import bytes "bytes"
|
||||
|
||||
import io "io"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type M struct {
|
||||
Arr []MyType `protobuf:"bytes,1,rep,name=arr,customtype=MyType" json:"arr"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *M) Reset() { *m = M{} }
|
||||
func (m *M) String() string { return proto.CompactTextString(m) }
|
||||
func (*M) ProtoMessage() {}
|
||||
func (*M) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_asym_34ee0efbcd9b19e2, []int{0}
|
||||
}
|
||||
func (m *M) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *M) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_M.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalTo(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (dst *M) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_M.Merge(dst, src)
|
||||
}
|
||||
func (m *M) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *M) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_M.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_M proto.InternalMessageInfo
|
||||
|
||||
type MyType struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *MyType) Reset() { *m = MyType{} }
|
||||
func (m *MyType) String() string { return proto.CompactTextString(m) }
|
||||
func (*MyType) ProtoMessage() {}
|
||||
func (*MyType) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_asym_34ee0efbcd9b19e2, []int{1}
|
||||
}
|
||||
func (m *MyType) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MyType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_MyType.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *MyType) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MyType.Merge(dst, src)
|
||||
}
|
||||
func (m *MyType) XXX_Size() int {
|
||||
return xxx_messageInfo_MyType.Size(m)
|
||||
}
|
||||
func (m *MyType) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MyType.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MyType proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*M)(nil), "asym.M")
|
||||
proto.RegisterType((*MyType)(nil), "asym.MyType")
|
||||
}
|
||||
func (this *M) VerboseEqual(that interface{}) error {
|
||||
if that == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that == nil && this != nil")
|
||||
}
|
||||
|
||||
that1, ok := that.(*M)
|
||||
if !ok {
|
||||
that2, ok := that.(M)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return fmt.Errorf("that is not of type *M")
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that is type *M but is nil && this != nil")
|
||||
} else if this == nil {
|
||||
return fmt.Errorf("that is type *M but is not nil && this == nil")
|
||||
}
|
||||
if len(this.Arr) != len(that1.Arr) {
|
||||
return fmt.Errorf("Arr this(%v) Not Equal that(%v)", len(this.Arr), len(that1.Arr))
|
||||
}
|
||||
for i := range this.Arr {
|
||||
if !this.Arr[i].Equal(that1.Arr[i]) {
|
||||
return fmt.Errorf("Arr this[%v](%v) Not Equal that[%v](%v)", i, this.Arr[i], i, that1.Arr[i])
|
||||
}
|
||||
}
|
||||
if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
|
||||
return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *M) Equal(that interface{}) bool {
|
||||
if that == nil {
|
||||
return this == nil
|
||||
}
|
||||
|
||||
that1, ok := that.(*M)
|
||||
if !ok {
|
||||
that2, ok := that.(M)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
return this == nil
|
||||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
if len(this.Arr) != len(that1.Arr) {
|
||||
return false
|
||||
}
|
||||
for i := range this.Arr {
|
||||
if !this.Arr[i].Equal(that1.Arr[i]) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
func (this *MyType) VerboseEqual(that interface{}) error {
|
||||
if that == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that == nil && this != nil")
|
||||
}
|
||||
|
||||
that1, ok := that.(*MyType)
|
||||
if !ok {
|
||||
that2, ok := that.(MyType)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return fmt.Errorf("that is not of type *MyType")
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that is type *MyType but is nil && this != nil")
|
||||
} else if this == nil {
|
||||
return fmt.Errorf("that is type *MyType but is not nil && this == nil")
|
||||
}
|
||||
if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
|
||||
return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *MyType) Equal(that interface{}) bool {
|
||||
if that == nil {
|
||||
return this == nil
|
||||
}
|
||||
|
||||
that1, ok := that.(*MyType)
|
||||
if !ok {
|
||||
that2, ok := that.(MyType)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
return this == nil
|
||||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
func (m *M) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *M) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Arr) > 0 {
|
||||
for _, msg := range m.Arr {
|
||||
dAtA[i] = 0xa
|
||||
i++
|
||||
i = encodeVarintAsym(dAtA, i, uint64(msg.Size()))
|
||||
n, err := msg.MarshalTo(dAtA[i:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
i += n
|
||||
}
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
i += copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func encodeVarintAsym(dAtA []byte, offset int, v uint64) int {
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return offset + 1
|
||||
}
|
||||
func NewPopulatedM(r randyAsym, easy bool) *M {
|
||||
this := &M{}
|
||||
if r.Intn(10) != 0 {
|
||||
v1 := r.Intn(10)
|
||||
this.Arr = make([]MyType, v1)
|
||||
for i := 0; i < v1; i++ {
|
||||
v2 := NewPopulatedMyType(r)
|
||||
this.Arr[i] = *v2
|
||||
}
|
||||
}
|
||||
if !easy && r.Intn(10) != 0 {
|
||||
this.XXX_unrecognized = randUnrecognizedAsym(r, 2)
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
type randyAsym interface {
|
||||
Float32() float32
|
||||
Float64() float64
|
||||
Int63() int64
|
||||
Int31() int32
|
||||
Uint32() uint32
|
||||
Intn(n int) int
|
||||
}
|
||||
|
||||
func randUTF8RuneAsym(r randyAsym) rune {
|
||||
ru := r.Intn(62)
|
||||
if ru < 10 {
|
||||
return rune(ru + 48)
|
||||
} else if ru < 36 {
|
||||
return rune(ru + 55)
|
||||
}
|
||||
return rune(ru + 61)
|
||||
}
|
||||
func randStringAsym(r randyAsym) string {
|
||||
v3 := r.Intn(100)
|
||||
tmps := make([]rune, v3)
|
||||
for i := 0; i < v3; i++ {
|
||||
tmps[i] = randUTF8RuneAsym(r)
|
||||
}
|
||||
return string(tmps)
|
||||
}
|
||||
func randUnrecognizedAsym(r randyAsym, maxFieldNumber int) (dAtA []byte) {
|
||||
l := r.Intn(5)
|
||||
for i := 0; i < l; i++ {
|
||||
wire := r.Intn(4)
|
||||
if wire == 3 {
|
||||
wire = 5
|
||||
}
|
||||
fieldNumber := maxFieldNumber + r.Intn(100)
|
||||
dAtA = randFieldAsym(dAtA, r, fieldNumber, wire)
|
||||
}
|
||||
return dAtA
|
||||
}
|
||||
func randFieldAsym(dAtA []byte, r randyAsym, fieldNumber int, wire int) []byte {
|
||||
key := uint32(fieldNumber)<<3 | uint32(wire)
|
||||
switch wire {
|
||||
case 0:
|
||||
dAtA = encodeVarintPopulateAsym(dAtA, uint64(key))
|
||||
v4 := r.Int63()
|
||||
if r.Intn(2) == 0 {
|
||||
v4 *= -1
|
||||
}
|
||||
dAtA = encodeVarintPopulateAsym(dAtA, uint64(v4))
|
||||
case 1:
|
||||
dAtA = encodeVarintPopulateAsym(dAtA, uint64(key))
|
||||
dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
|
||||
case 2:
|
||||
dAtA = encodeVarintPopulateAsym(dAtA, uint64(key))
|
||||
ll := r.Intn(100)
|
||||
dAtA = encodeVarintPopulateAsym(dAtA, uint64(ll))
|
||||
for j := 0; j < ll; j++ {
|
||||
dAtA = append(dAtA, byte(r.Intn(256)))
|
||||
}
|
||||
default:
|
||||
dAtA = encodeVarintPopulateAsym(dAtA, uint64(key))
|
||||
dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
|
||||
}
|
||||
return dAtA
|
||||
}
|
||||
func encodeVarintPopulateAsym(dAtA []byte, v uint64) []byte {
|
||||
for v >= 1<<7 {
|
||||
dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80))
|
||||
v >>= 7
|
||||
}
|
||||
dAtA = append(dAtA, uint8(v))
|
||||
return dAtA
|
||||
}
|
||||
func (m *M) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.Arr) > 0 {
|
||||
for _, e := range m.Arr {
|
||||
l = e.Size()
|
||||
n += 1 + l + sovAsym(uint64(l))
|
||||
}
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovAsym(x uint64) (n int) {
|
||||
for {
|
||||
n++
|
||||
x >>= 7
|
||||
if x == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
func sozAsym(x uint64) (n int) {
|
||||
return sovAsym(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (m *M) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowAsym
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: M: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: M: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field Arr", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowAsym
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
return ErrInvalidLengthAsym
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
var v MyType
|
||||
m.Arr = append(m.Arr, v)
|
||||
if err := m.Arr[len(m.Arr)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipAsym(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthAsym
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (m *MyType) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowAsym
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: MyType: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MyType: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipAsym(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthAsym
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipAsym(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowAsym
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
wireType := int(wire & 0x7)
|
||||
switch wireType {
|
||||
case 0:
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowAsym
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx++
|
||||
if dAtA[iNdEx-1] < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
return iNdEx, nil
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowAsym
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
length |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
iNdEx += length
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthAsym
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 3:
|
||||
for {
|
||||
var innerWire uint64
|
||||
var start int = iNdEx
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowAsym
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
innerWire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
innerWireType := int(innerWire & 0x7)
|
||||
if innerWireType == 4 {
|
||||
break
|
||||
}
|
||||
next, err := skipAsym(dAtA[start:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
iNdEx = start + next
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 4:
|
||||
return iNdEx, nil
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
return iNdEx, nil
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthAsym = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowAsym = fmt.Errorf("proto: integer overflow")
|
||||
)
|
||||
|
||||
func init() { proto.RegisterFile("asym.proto", fileDescriptor_asym_34ee0efbcd9b19e2) }
|
||||
|
||||
var fileDescriptor_asym_34ee0efbcd9b19e2 = []byte{
|
||||
// 158 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4a, 0x2c, 0xae, 0xcc,
|
||||
0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x01, 0xb1, 0xa5, 0x74, 0xd3, 0x33, 0x4b, 0x32,
|
||||
0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5, 0xc1, 0x92, 0x49, 0xa5,
|
||||
0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0x34, 0x29, 0xa9, 0x72, 0x31, 0xfa, 0x0a, 0x29, 0x70,
|
||||
0x31, 0x27, 0x16, 0x15, 0x49, 0x30, 0x2a, 0x30, 0x6b, 0xf0, 0x38, 0xf1, 0x9d, 0xb8, 0x27, 0xcf,
|
||||
0x70, 0xeb, 0x9e, 0x3c, 0x9b, 0x6f, 0x65, 0x48, 0x65, 0x41, 0x6a, 0x10, 0x48, 0x4a, 0x49, 0x8a,
|
||||
0x0b, 0xca, 0xb5, 0x12, 0xd8, 0xb1, 0x40, 0x9e, 0xe1, 0xc7, 0x02, 0x79, 0x86, 0x8e, 0x85, 0xf2,
|
||||
0x0c, 0x0b, 0x16, 0xca, 0x33, 0x38, 0x49, 0x3c, 0x78, 0x28, 0xc7, 0xf8, 0xe3, 0xa1, 0x1c, 0xe3,
|
||||
0x8a, 0x47, 0x72, 0x8c, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c,
|
||||
0x23, 0x20, 0x00, 0x00, 0xff, 0xff, 0x81, 0x2c, 0x72, 0xc1, 0x9e, 0x00, 0x00, 0x00,
|
||||
}
|
52
vendor/github.com/gogo/protobuf/test/asymetric-issue125/asym.proto
generated
vendored
Normal file
52
vendor/github.com/gogo/protobuf/test/asymetric-issue125/asym.proto
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2015, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package asym;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.equal_all) = true;
|
||||
option (gogoproto.verbose_equal_all) = true;
|
||||
option (gogoproto.marshaler_all) = true;
|
||||
option (gogoproto.sizer_all) = true;
|
||||
option (gogoproto.unmarshaler_all) = true;
|
||||
option (gogoproto.populate_all) = true;
|
||||
// TODO: renable this once https://github.com/gogo/protobuf/issues/388 is fixed: option (gogoproto.testgen_all) = true;
|
||||
|
||||
message M {
|
||||
repeated bytes arr = 1 [(gogoproto.customtype) = "MyType", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message MyType {
|
||||
option (gogoproto.marshaler) = false;
|
||||
option (gogoproto.sizer) = false;
|
||||
option (gogoproto.populate) = false;
|
||||
option (gogoproto.testgen) = false;
|
||||
}
|
40
vendor/github.com/gogo/protobuf/test/asymetric-issue125/asym_test.go
generated
vendored
Normal file
40
vendor/github.com/gogo/protobuf/test/asymetric-issue125/asym_test.go
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package asym
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestAsym(t *testing.T) {
|
||||
m := &M{Arr: []MyType{{}, {}}}
|
||||
if err := m.VerboseEqual(m); err != nil {
|
||||
t.Fatalf("should be equal: %v", err)
|
||||
}
|
||||
}
|
65
vendor/github.com/gogo/protobuf/test/asymetric-issue125/pop.go
generated
vendored
Normal file
65
vendor/github.com/gogo/protobuf/test/asymetric-issue125/pop.go
generated
vendored
Normal file
@ -0,0 +1,65 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package asym
|
||||
|
||||
func NewPopulatedMyType(r randyAsym) *MyType {
|
||||
this := &MyType{}
|
||||
return this
|
||||
}
|
||||
|
||||
// TODO: rename this to Marshal once https://github.com/gogo/protobuf/issues/388 is fixed
|
||||
func (m MyType) DisabledMarshal() (data []byte, err error) {
|
||||
size := m.Size()
|
||||
data = make([]byte, size)
|
||||
n, err := m.MarshalTo(data)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return data[:n], nil
|
||||
}
|
||||
|
||||
func (m *MyType) MarshalTo(data []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.XXX_unrecognized != nil {
|
||||
i += copy(data[i:], m.XXX_unrecognized)
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func (m *MyType) Size() (n int) {
|
||||
var l int
|
||||
_ = l
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
252
vendor/github.com/gogo/protobuf/test/bug_test.go
generated
vendored
Normal file
252
vendor/github.com/gogo/protobuf/test/bug_test.go
generated
vendored
Normal file
@ -0,0 +1,252 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"math/rand"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
)
|
||||
|
||||
//http://code.google.com/p/goprotobuf/issues/detail?id=39
|
||||
func TestBugUint32VarintSize(t *testing.T) {
|
||||
temp := uint32(math.MaxUint32)
|
||||
n := &NinOptNative{}
|
||||
n.Field5 = &temp
|
||||
data, err := proto.Marshal(n)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if len(data) != 6 {
|
||||
t.Fatalf("data should be length 6, but its %#v", data)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBugZeroLengthSliceSize(t *testing.T) {
|
||||
n := &NinRepPackedNative{
|
||||
Field8: []int64{},
|
||||
}
|
||||
size := n.Size()
|
||||
data, err := proto.Marshal(n)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if len(data) != size {
|
||||
t.Fatalf("expected %v, but got %v", len(data), size)
|
||||
}
|
||||
}
|
||||
|
||||
//http://code.google.com/p/goprotobuf/issues/detail?id=40
|
||||
func TestBugPackedProtoSize(t *testing.T) {
|
||||
n := &NinRepPackedNative{
|
||||
Field4: []int64{172960727389894724, 2360337516664475010, 860833876131988189, 9068073014890763245, 7794843386260381831, 4023536436053141786, 8992311247496919020, 4330096163611305776, 4490411416244976467, 7873947349172707443, 2754969595834279669, 1360667855926938684, 4771480785172657389, 4875578924966668055, 8070579869808877481, 9128179594766551001, 4630419407064527516, 863844540220372892, 8208727650143073487, 7086117356301045838, 7779695211931506151, 5493835345187563535, 9119767633370806007, 9054342025895349248, 1887303228838508438, 7624573031734528281, 1874668389749611225, 3517684643468970593, 6677697606628877758, 7293473953189936168, 444475066704085538, 8594971141363049302, 1146643249094989673, 733393306232853371, 7721178528893916886, 7784452000911004429, 6436373110242711440, 6897422461738321237, 8772249155667732778, 6211871464311393541, 3061903718310406883, 7845488913176136641, 8342255034663902574, 3443058984649725748, 8410801047334832902, 7496541071517841153, 4305416923521577765, 7814967600020476457, 8671843803465481186, 3490266370361096855, 1447425664719091336, 653218597262334239, 8306243902880091940, 7851896059762409081, 5936760560798954978, 5755724498441478025, 7022701569985035966, 3707709584811468220, 529069456924666920, 7986469043681522462, 3092513330689518836, 5103541550470476202, 3577384161242626406, 3733428084624703294, 8388690542440473117, 3262468785346149388, 8788358556558007570, 5476276940198542020, 7277903243119461239, 5065861426928605020, 7533460976202697734, 1749213838654236956, 557497603941617931, 5496307611456481108, 6444547750062831720, 6992758776744205596, 7356719693428537399, 2896328872476734507, 381447079530132038, 598300737753233118, 3687980626612697715, 7240924191084283349, 8172414415307971170, 4847024388701257185, 2081764168600256551, 3394217778539123488, 6244660626429310923, 8301712215675381614, 5360615125359461174, 8410140945829785773, 3152963269026381373, 6197275282781459633, 4419829061407546410, 6262035523070047537, 2837207483933463885, 2158105736666826128, 8150764172235490711},
|
||||
Field7: []int32{249451845, 1409974015, 393609128, 435232428, 1817529040, 91769006, 861170933, 1556185603, 1568580279, 1236375273, 512276621, 693633711, 967580535, 1950715977, 853431462, 1362390253, 159591204, 111900629, 322985263, 279671129, 1592548430, 465651370, 733849989, 1172059400, 1574824441, 263541092, 1271612397, 1520584358, 467078791, 117698716, 1098255064, 2054264846, 1766452305, 1267576395, 1557505617, 1187833560, 956187431, 1970977586, 1160235159, 1610259028, 489585797, 459139078, 566263183, 954319278, 1545018565, 1753946743, 948214318, 422878159, 883926576, 1424009347, 824732372, 1290433180, 80297942, 417294230, 1402647904, 2078392782, 220505045, 787368129, 463781454, 293083578, 808156928, 293976361},
|
||||
Field9: []uint32{0xaa4976e8, 0x3da8cc4c, 0x8c470d83, 0x344d964e, 0x5b90925, 0xa4c4d34e, 0x666eff19, 0xc238e552, 0x9be53bb6, 0x56364245, 0x33ee079d, 0x96bf0ede, 0x7941b74f, 0xdb07cb47, 0x6d76d827, 0x9b211d5d, 0x2798adb6, 0xe48b0c3b, 0x87061b21, 0x48f4e4d2, 0x3e5d5c12, 0x5ee91288, 0x336d4f35, 0xe1d44941, 0xc065548d, 0x2953d73f, 0x873af451, 0xfc769db, 0x9f1bf8da, 0x9baafdfc, 0xf1d3d770, 0x5bb5d2b4, 0xc2c67c48, 0x6845c4c1, 0xa48f32b0, 0xbb04bb70, 0xa5b1ca36, 0x8d98356a, 0x2171f654, 0x5ae279b0, 0x6c4a3d6b, 0x4fff5468, 0xcf9bf851, 0x68513614, 0xdbecd9b0, 0x9553ed3c, 0xa494a736, 0x42205438, 0xbf8e5caa, 0xd3283c6, 0x76d20788, 0x9179826f, 0x96b24f85, 0xbc2eacf4, 0xe4afae0b, 0x4bca85cb, 0x35e63b5b, 0xd7ccee0c, 0x2b506bb9, 0xe78e9f44, 0x9ad232f1, 0x99a37335, 0xa5d6ffc8},
|
||||
Field11: []uint64{0x53c01ebc, 0x4fb85ba6, 0x8805eea1, 0xb20ec896, 0x93b63410, 0xec7c9492, 0x50765a28, 0x19592106, 0x2ecc59b3, 0x39cd474f, 0xe4c9e47, 0x444f48c5, 0xe7731d32, 0xf3f43975, 0x603caedd, 0xbb05a1af, 0xa808e34e, 0x88580b07, 0x4c96bbd1, 0x730b4ab9, 0xed126e2b, 0x6db48205, 0x154ba1b9, 0xc26bfb6a, 0x389aa052, 0x869d966c, 0x7c86b366, 0xcc8edbcd, 0xfa8d6dad, 0xcf5857d9, 0x2d9cda0f, 0x1218a0b8, 0x41bf997, 0xf0ca65ac, 0xa610d4b9, 0x8d362e28, 0xb7212d87, 0x8e0fe109, 0xbee041d9, 0x759be2f6, 0x35fef4f3, 0xaeacdb71, 0x10888852, 0xf4e28117, 0xe2a14812, 0x73b748dc, 0xd1c3c6b2, 0xfef41bf0, 0xc9b43b62, 0x810e4faa, 0xcaa41c06, 0x1893fe0d, 0xedc7c850, 0xd12b9eaa, 0x467ee1a9, 0xbe84756b, 0xda7b1680, 0xdc069ffe, 0xf1e7e9f9, 0xb3d95370, 0xa92b77df, 0x5693ac41, 0xd04b7287, 0x27aebf15, 0x837b316e, 0x4dbe2263, 0xbab70c67, 0x547dab21, 0x3c346c1f, 0xb8ef0e4e, 0xfe2d03ce, 0xe1d75955, 0xfec1306, 0xba35c23e, 0xb784ed04, 0x2a4e33aa, 0x7e19d09a, 0x3827c1fe, 0xf3a51561, 0xef765e2b, 0xb044256c, 0x62b322be, 0xf34d56be, 0xeb71b369, 0xffe1294f, 0x237fe8d0, 0x77a1473b, 0x239e1196, 0xdd19bf3d, 0x82c91fe1, 0x95361c57, 0xffea3f1b, 0x1a094c84},
|
||||
Field12: []int64{8308420747267165049, 3664160795077875961, 7868970059161834817, 7237335984251173739, 5254748003907196506, 3362259627111837480, 430460752854552122, 5119635556501066533, 1277716037866233522, 9185775384759813768, 833932430882717888, 7986528304451297640, 6792233378368656337, 2074207091120609721, 1788723326198279432, 7756514594746453657, 2283775964901597324, 3061497730110517191, 7733947890656120277, 626967303632386244, 7822928600388582821, 3489658753000061230, 168869995163005961, 248814782163480763, 477885608911386247, 4198422415674133867, 3379354662797976109, 9925112544736939, 1486335136459138480, 4561560414032850671, 1010864164014091267, 186722821683803084, 5106357936724819318, 1298160820191228988, 4675403242419953145, 7130634540106489752, 7101280006672440929, 7176058292431955718, 9109875054097770321, 6810974877085322872, 4736707874303993641, 8993135362721382187, 6857881554990254283, 3704748883307461680, 1099360832887634994, 5207691918707192633, 5984721695043995243},
|
||||
}
|
||||
size := proto.Size(n)
|
||||
data, err := proto.Marshal(n)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if len(data) != size {
|
||||
t.Fatalf("expected %v, but got %v diff is %v", len(data), size, len(data)-size)
|
||||
}
|
||||
}
|
||||
|
||||
func testSize(m interface {
|
||||
proto.Message
|
||||
Size() int
|
||||
}, desc string, expected int) ([]byte, error) {
|
||||
data, err := proto.Marshal(m)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
protoSize := proto.Size(m)
|
||||
mSize := m.Size()
|
||||
lenData := len(data)
|
||||
if protoSize != mSize || protoSize != lenData || mSize != lenData {
|
||||
return nil, fmt.Errorf("%s proto.Size(m){%d} != m.Size(){%d} != len(data){%d}", desc, protoSize, mSize, lenData)
|
||||
}
|
||||
if got := protoSize; got != expected {
|
||||
return nil, fmt.Errorf("%s proto.Size(m) got %d expected %d", desc, got, expected)
|
||||
}
|
||||
if got := mSize; got != expected {
|
||||
return nil, fmt.Errorf("%s m.Size() got %d expected %d", desc, got, expected)
|
||||
}
|
||||
if got := lenData; got != expected {
|
||||
return nil, fmt.Errorf("%s len(data) got %d expected %d", desc, got, expected)
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
func TestInt32Int64Compatibility(t *testing.T) {
|
||||
|
||||
//test nullable int32 and int64
|
||||
|
||||
data1, err := testSize(&NinOptNative{
|
||||
Field3: proto.Int32(-1),
|
||||
}, "nullable", 11)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
//change marshaled data1 to unmarshal into 4th field which is an int64
|
||||
data1[0] = uint8(uint32(4 /*fieldNumber*/)<<3 | uint32(0 /*wireType*/))
|
||||
u1 := &NinOptNative{}
|
||||
if err = proto.Unmarshal(data1, u1); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if !u1.Equal(&NinOptNative{
|
||||
Field4: proto.Int64(-1),
|
||||
}) {
|
||||
t.Error("nullable unmarshaled int32 is not the same int64")
|
||||
}
|
||||
|
||||
//test non-nullable int32 and int64
|
||||
|
||||
data2, err := testSize(&NidOptNative{
|
||||
Field3: -1,
|
||||
}, "non nullable", 67)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
//change marshaled data2 to unmarshal into 4th field which is an int64
|
||||
field3 := uint8(uint32(3 /*fieldNumber*/)<<3 | uint32(0 /*wireType*/))
|
||||
field4 := uint8(uint32(4 /*fieldNumber*/)<<3 | uint32(0 /*wireType*/))
|
||||
for i, c := range data2 {
|
||||
if c == field4 {
|
||||
data2[i] = field3
|
||||
} else if c == field3 {
|
||||
data2[i] = field4
|
||||
}
|
||||
}
|
||||
u2 := &NidOptNative{}
|
||||
if err = proto.Unmarshal(data2, u2); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if !u2.Equal(&NidOptNative{
|
||||
Field4: -1,
|
||||
}) {
|
||||
t.Error("non nullable unmarshaled int32 is not the same int64")
|
||||
}
|
||||
|
||||
//test packed repeated int32 and int64
|
||||
|
||||
m4 := &NinRepPackedNative{
|
||||
Field3: []int32{-1},
|
||||
}
|
||||
data4, err := testSize(m4, "packed", 12)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
u4 := &NinRepPackedNative{}
|
||||
if err := proto.Unmarshal(data4, u4); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if err := u4.VerboseEqual(m4); err != nil {
|
||||
t.Fatalf("%#v", u4)
|
||||
}
|
||||
|
||||
//test repeated int32 and int64
|
||||
|
||||
if _, err := testSize(&NinRepNative{
|
||||
Field3: []int32{-1},
|
||||
}, "repeated", 11); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
t.Logf("tested all")
|
||||
}
|
||||
|
||||
func TestRepeatedExtensionsMsgsIssue161(t *testing.T) {
|
||||
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
rep := 10
|
||||
nins := make([]*NinOptNative, rep)
|
||||
for i := range nins {
|
||||
nins[i] = NewPopulatedNinOptNative(r, true)
|
||||
}
|
||||
input := &MyExtendable{}
|
||||
if err := proto.SetExtension(input, E_FieldE, nins); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
data, err := proto.Marshal(input)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
output := &MyExtendable{}
|
||||
if err := proto.Unmarshal(data, output); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !input.Equal(output) {
|
||||
t.Fatalf("want %#v but got %#v", input, output)
|
||||
}
|
||||
data2, err2 := proto.Marshal(output)
|
||||
if err2 != nil {
|
||||
t.Fatal(err2)
|
||||
}
|
||||
if len(data) != len(data2) {
|
||||
t.Fatal("expected equal length buffers")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRepeatedExtensionsFieldsIssue161(t *testing.T) {
|
||||
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
rep := 10
|
||||
ints := make([]int64, rep)
|
||||
for i := range ints {
|
||||
ints[i] = r.Int63()
|
||||
}
|
||||
input := &MyExtendable{}
|
||||
if err := proto.SetExtension(input, E_FieldD, ints); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
data, err := proto.Marshal(input)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
output := &MyExtendable{}
|
||||
if err := proto.Unmarshal(data, output); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !input.Equal(output) {
|
||||
t.Fatalf("want %#v but got %#v", input, output)
|
||||
}
|
||||
data2, err2 := proto.Marshal(output)
|
||||
if err2 != nil {
|
||||
t.Fatal(err2)
|
||||
}
|
||||
if len(data) != len(data2) {
|
||||
t.Fatal("expected equal length buffers")
|
||||
}
|
||||
}
|
30
vendor/github.com/gogo/protobuf/test/cachedsize/Makefile
generated
vendored
Normal file
30
vendor/github.com/gogo/protobuf/test/cachedsize/Makefile
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
# Protocol Buffers for Go with Gadgets
|
||||
#
|
||||
# Copyright (c) 2018, The GoGo Authors. All rights reserved.
|
||||
# http://github.com/gogo/protobuf
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
regenerate:
|
||||
(protoc --proto_path=../../../../../:../../protobuf/:. --gogo_out=. cachedsize.proto)
|
282
vendor/github.com/gogo/protobuf/test/cachedsize/cachedsize.pb.go
generated
vendored
Normal file
282
vendor/github.com/gogo/protobuf/test/cachedsize/cachedsize.pb.go
generated
vendored
Normal file
@ -0,0 +1,282 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: cachedsize.proto
|
||||
|
||||
package cachedsize
|
||||
|
||||
import proto "github.com/gogo/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "github.com/gogo/protobuf/gogoproto"
|
||||
|
||||
import bytes "bytes"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type Foo struct {
|
||||
Field1 *Bar `protobuf:"bytes,1,opt,name=field1" json:"field1,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Foo) Reset() { *m = Foo{} }
|
||||
func (m *Foo) String() string { return proto.CompactTextString(m) }
|
||||
func (*Foo) ProtoMessage() {}
|
||||
func (*Foo) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_cachedsize_3c7c595320e5882b, []int{0}
|
||||
}
|
||||
func (m *Foo) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Foo.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Foo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Foo.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Foo) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Foo.Merge(dst, src)
|
||||
}
|
||||
func (m *Foo) XXX_Size() int {
|
||||
return xxx_messageInfo_Foo.Size(m)
|
||||
}
|
||||
func (m *Foo) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Foo.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Foo proto.InternalMessageInfo
|
||||
|
||||
func (m *Foo) GetField1() *Bar {
|
||||
if m != nil {
|
||||
return m.Field1
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Bar struct {
|
||||
Field2 bool `protobuf:"varint,1,opt,name=field2" json:"field2"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Bar) Reset() { *m = Bar{} }
|
||||
func (m *Bar) String() string { return proto.CompactTextString(m) }
|
||||
func (*Bar) ProtoMessage() {}
|
||||
func (*Bar) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_cachedsize_3c7c595320e5882b, []int{1}
|
||||
}
|
||||
func (m *Bar) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Bar.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Bar) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Bar.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Bar) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Bar.Merge(dst, src)
|
||||
}
|
||||
func (m *Bar) XXX_Size() int {
|
||||
return xxx_messageInfo_Bar.Size(m)
|
||||
}
|
||||
func (m *Bar) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Bar.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Bar proto.InternalMessageInfo
|
||||
|
||||
func (m *Bar) GetField2() bool {
|
||||
if m != nil {
|
||||
return m.Field2
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Foo)(nil), "cachedsize.Foo")
|
||||
proto.RegisterType((*Bar)(nil), "cachedsize.Bar")
|
||||
}
|
||||
func (this *Foo) VerboseEqual(that interface{}) error {
|
||||
if that == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that == nil && this != nil")
|
||||
}
|
||||
|
||||
that1, ok := that.(*Foo)
|
||||
if !ok {
|
||||
that2, ok := that.(Foo)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return fmt.Errorf("that is not of type *Foo")
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that is type *Foo but is nil && this != nil")
|
||||
} else if this == nil {
|
||||
return fmt.Errorf("that is type *Foo but is not nil && this == nil")
|
||||
}
|
||||
if !this.Field1.Equal(that1.Field1) {
|
||||
return fmt.Errorf("Field1 this(%v) Not Equal that(%v)", this.Field1, that1.Field1)
|
||||
}
|
||||
if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
|
||||
return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *Foo) Equal(that interface{}) bool {
|
||||
if that == nil {
|
||||
return this == nil
|
||||
}
|
||||
|
||||
that1, ok := that.(*Foo)
|
||||
if !ok {
|
||||
that2, ok := that.(Foo)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
return this == nil
|
||||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
if !this.Field1.Equal(that1.Field1) {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
func (this *Bar) VerboseEqual(that interface{}) error {
|
||||
if that == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that == nil && this != nil")
|
||||
}
|
||||
|
||||
that1, ok := that.(*Bar)
|
||||
if !ok {
|
||||
that2, ok := that.(Bar)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return fmt.Errorf("that is not of type *Bar")
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that is type *Bar but is nil && this != nil")
|
||||
} else if this == nil {
|
||||
return fmt.Errorf("that is type *Bar but is not nil && this == nil")
|
||||
}
|
||||
if this.Field2 != that1.Field2 {
|
||||
return fmt.Errorf("Field2 this(%v) Not Equal that(%v)", this.Field2, that1.Field2)
|
||||
}
|
||||
if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
|
||||
return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *Bar) Equal(that interface{}) bool {
|
||||
if that == nil {
|
||||
return this == nil
|
||||
}
|
||||
|
||||
that1, ok := that.(*Bar)
|
||||
if !ok {
|
||||
that2, ok := that.(Bar)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
return this == nil
|
||||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
if this.Field2 != that1.Field2 {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
func (m *Foo) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.Field1 != nil {
|
||||
l = m.Field1.Size()
|
||||
n += 1 + l + sovCachedsize(uint64(l))
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *Bar) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
n += 2
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovCachedsize(x uint64) (n int) {
|
||||
for {
|
||||
n++
|
||||
x >>= 7
|
||||
if x == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
func sozCachedsize(x uint64) (n int) {
|
||||
return sovCachedsize(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("cachedsize.proto", fileDescriptor_cachedsize_3c7c595320e5882b) }
|
||||
|
||||
var fileDescriptor_cachedsize_3c7c595320e5882b = []byte{
|
||||
// 162 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x48, 0x4e, 0x4c, 0xce,
|
||||
0x48, 0x4d, 0x29, 0xce, 0xac, 0x4a, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x42, 0x88,
|
||||
0x48, 0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xa7,
|
||||
0xe7, 0xeb, 0x83, 0x95, 0x24, 0x95, 0xa6, 0x81, 0x79, 0x60, 0x0e, 0x98, 0x05, 0xd1, 0xaa, 0xa4,
|
||||
0xc7, 0xc5, 0xec, 0x96, 0x9f, 0x2f, 0xa4, 0xce, 0xc5, 0x96, 0x96, 0x99, 0x9a, 0x93, 0x62, 0x28,
|
||||
0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x6d, 0xc4, 0xaf, 0x87, 0x64, 0x89, 0x53, 0x62, 0x51, 0x10, 0x54,
|
||||
0x5a, 0x49, 0x99, 0x8b, 0xd9, 0x29, 0xb1, 0x48, 0x48, 0x06, 0xaa, 0xde, 0x08, 0xac, 0x9e, 0xc3,
|
||||
0x89, 0xe5, 0xc4, 0x3d, 0x79, 0x06, 0xa8, 0x22, 0x23, 0x27, 0x89, 0x07, 0x0f, 0xe5, 0x18, 0x57,
|
||||
0x3c, 0x92, 0x63, 0x3c, 0xf1, 0x48, 0x8e, 0xe1, 0xc2, 0x23, 0x39, 0x86, 0x07, 0x8f, 0xe4, 0x18,
|
||||
0x3f, 0x3c, 0x92, 0x63, 0x04, 0x04, 0x00, 0x00, 0xff, 0xff, 0x95, 0xd6, 0x7b, 0xf2, 0xbc, 0x00,
|
||||
0x00, 0x00,
|
||||
}
|
48
vendor/github.com/gogo/protobuf/test/cachedsize/cachedsize.proto
generated
vendored
Normal file
48
vendor/github.com/gogo/protobuf/test/cachedsize/cachedsize.proto
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2018, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
package cachedsize;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.verbose_equal_all) = true;
|
||||
option (gogoproto.equal_all) = true;
|
||||
option (gogoproto.unmarshaler_all) = false;
|
||||
option (gogoproto.marshaler_all) = false;
|
||||
option (gogoproto.sizer_all) = true;
|
||||
|
||||
option (gogoproto.enum_stringer_all) = true;
|
||||
|
||||
message Foo {
|
||||
optional Bar field1 = 1;
|
||||
}
|
||||
|
||||
message Bar {
|
||||
optional bool field2 = 1 [(gogoproto.nullable) = false];
|
||||
}
|
51
vendor/github.com/gogo/protobuf/test/cachedsize/cachedsize_test.go
generated
vendored
Normal file
51
vendor/github.com/gogo/protobuf/test/cachedsize/cachedsize_test.go
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2018, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package cachedsize
|
||||
|
||||
import (
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCachedSize(t *testing.T) {
|
||||
in := &Foo{Field1: &Bar{Field2: true}}
|
||||
|
||||
data, err := proto.Marshal(in)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
out := &Foo{}
|
||||
err = proto.Unmarshal(data, out)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := in.VerboseEqual(out); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
32
vendor/github.com/gogo/protobuf/test/casttype/Makefile
generated
vendored
Normal file
32
vendor/github.com/gogo/protobuf/test/casttype/Makefile
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
# Protocol Buffers for Go with Gadgets
|
||||
#
|
||||
# Copyright (c) 2015, The GoGo Authors. All rights reserved.
|
||||
# http://github.com/gogo/protobuf
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
regenerate:
|
||||
go install github.com/gogo/protobuf/protoc-gen-combo
|
||||
go install github.com/gogo/protobuf/protoc-gen-gogo
|
||||
protoc-gen-combo --gogo_out=. --version="3.0.0" --proto_path=../../protobuf/:../../../../../:. casttype.proto
|
80
vendor/github.com/gogo/protobuf/test/casttype/casttype.proto
generated
vendored
Normal file
80
vendor/github.com/gogo/protobuf/test/casttype/casttype.proto
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2015, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package casttype;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.goproto_stringer_all) = false;
|
||||
option (gogoproto.goproto_enum_prefix_all) = false;
|
||||
option (gogoproto.goproto_getters_all) = false;
|
||||
|
||||
option (gogoproto.equal_all) = true;
|
||||
option (gogoproto.verbose_equal_all) = true;
|
||||
option (gogoproto.stringer_all) = true;
|
||||
option (gogoproto.gostring_all) = true;
|
||||
option (gogoproto.face_all) = true;
|
||||
option (gogoproto.description_all) = true;
|
||||
|
||||
option (gogoproto.testgen_all) = true;
|
||||
option (gogoproto.populate_all) = true;
|
||||
option (gogoproto.benchgen_all) = true;
|
||||
option (gogoproto.unmarshaler_all) = false;
|
||||
option (gogoproto.marshaler_all) = false;
|
||||
option (gogoproto.sizer_all) = true;
|
||||
|
||||
option (gogoproto.goproto_enum_stringer_all) = false;
|
||||
option (gogoproto.enum_stringer_all) = true;
|
||||
|
||||
option (gogoproto.unsafe_marshaler_all) = false;
|
||||
option (gogoproto.unsafe_unmarshaler_all) = false;
|
||||
|
||||
message Castaway {
|
||||
optional int64 Int32Ptr = 1 [(gogoproto.casttype) = "int32"];
|
||||
optional int64 Int32 = 2 [(gogoproto.casttype) = "int32", (gogoproto.nullable) = false];
|
||||
optional uint64 MyUint64Ptr = 3 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyUint64Type"];
|
||||
optional uint64 MyUint64 = 4 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyUint64Type", (gogoproto.nullable) = false];
|
||||
optional float MyFloat32Ptr = 5 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyFloat32Type"];
|
||||
optional float MyFloat32 = 6 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyFloat32Type", (gogoproto.nullable) = false];
|
||||
optional double MyFloat64Ptr = 7 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyFloat64Type"];
|
||||
optional double MyFloat64 = 8 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyFloat64Type", (gogoproto.nullable) = false];
|
||||
optional bytes MyBytes = 9 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.Bytes"];
|
||||
optional bytes NormalBytes = 10;
|
||||
repeated uint64 MyUint64s = 11 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyUint64Type"];
|
||||
map<string,uint64> MyMap = 12 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyMapType"];
|
||||
map<string,uint64> MyCustomMap = 13 [(gogoproto.castkey) = "github.com/gogo/protobuf/test/casttype.MyStringType", (gogoproto.castvalue) = "github.com/gogo/protobuf/test/casttype.MyUint64Type"];
|
||||
map<int32,Wilson> MyNullableMap = 14 [(gogoproto.castkey) = "github.com/gogo/protobuf/test/casttype.MyInt32Type"];
|
||||
map<int32,Wilson> MyEmbeddedMap = 15 [(gogoproto.castkey) = "github.com/gogo/protobuf/test/casttype.MyInt32Type", (gogoproto.nullable) = false];
|
||||
optional string String = 16 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyStringType"];
|
||||
}
|
||||
|
||||
message Wilson {
|
||||
optional int64 Int64 = 1;
|
||||
}
|
2615
vendor/github.com/gogo/protobuf/test/casttype/combos/both/casttype.pb.go
generated
vendored
Normal file
2615
vendor/github.com/gogo/protobuf/test/casttype/combos/both/casttype.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
80
vendor/github.com/gogo/protobuf/test/casttype/combos/both/casttype.proto
generated
vendored
Normal file
80
vendor/github.com/gogo/protobuf/test/casttype/combos/both/casttype.proto
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2015, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package casttype;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.goproto_stringer_all) = false;
|
||||
option (gogoproto.goproto_enum_prefix_all) = false;
|
||||
option (gogoproto.goproto_getters_all) = false;
|
||||
|
||||
option (gogoproto.equal_all) = true;
|
||||
option (gogoproto.verbose_equal_all) = true;
|
||||
option (gogoproto.stringer_all) = true;
|
||||
option (gogoproto.gostring_all) = true;
|
||||
option (gogoproto.face_all) = true;
|
||||
option (gogoproto.description_all) = true;
|
||||
|
||||
option (gogoproto.testgen_all) = true;
|
||||
option (gogoproto.populate_all) = true;
|
||||
option (gogoproto.benchgen_all) = true;
|
||||
option (gogoproto.unmarshaler_all) = true;
|
||||
option (gogoproto.marshaler_all) = true;
|
||||
option (gogoproto.sizer_all) = true;
|
||||
|
||||
option (gogoproto.goproto_enum_stringer_all) = false;
|
||||
option (gogoproto.enum_stringer_all) = true;
|
||||
|
||||
option (gogoproto.unsafe_marshaler_all) = false;
|
||||
option (gogoproto.unsafe_unmarshaler_all) = false;
|
||||
|
||||
message Castaway {
|
||||
optional int64 Int32Ptr = 1 [(gogoproto.casttype) = "int32"];
|
||||
optional int64 Int32 = 2 [(gogoproto.casttype) = "int32", (gogoproto.nullable) = false];
|
||||
optional uint64 MyUint64Ptr = 3 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyUint64Type"];
|
||||
optional uint64 MyUint64 = 4 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyUint64Type", (gogoproto.nullable) = false];
|
||||
optional float MyFloat32Ptr = 5 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyFloat32Type"];
|
||||
optional float MyFloat32 = 6 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyFloat32Type", (gogoproto.nullable) = false];
|
||||
optional double MyFloat64Ptr = 7 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyFloat64Type"];
|
||||
optional double MyFloat64 = 8 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyFloat64Type", (gogoproto.nullable) = false];
|
||||
optional bytes MyBytes = 9 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.Bytes"];
|
||||
optional bytes NormalBytes = 10;
|
||||
repeated uint64 MyUint64s = 11 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyUint64Type"];
|
||||
map<string,uint64> MyMap = 12 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyMapType"];
|
||||
map<string,uint64> MyCustomMap = 13 [(gogoproto.castkey) = "github.com/gogo/protobuf/test/casttype.MyStringType", (gogoproto.castvalue) = "github.com/gogo/protobuf/test/casttype.MyUint64Type"];
|
||||
map<int32,Wilson> MyNullableMap = 14 [(gogoproto.castkey) = "github.com/gogo/protobuf/test/casttype.MyInt32Type"];
|
||||
map<int32,Wilson> MyEmbeddedMap = 15 [(gogoproto.castkey) = "github.com/gogo/protobuf/test/casttype.MyInt32Type", (gogoproto.nullable) = false];
|
||||
optional string String = 16 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyStringType"];
|
||||
}
|
||||
|
||||
message Wilson {
|
||||
optional int64 Int64 = 1;
|
||||
}
|
502
vendor/github.com/gogo/protobuf/test/casttype/combos/both/casttypepb_test.go
generated
vendored
Normal file
502
vendor/github.com/gogo/protobuf/test/casttype/combos/both/casttypepb_test.go
generated
vendored
Normal file
@ -0,0 +1,502 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: combos/both/casttype.proto
|
||||
|
||||
package casttype
|
||||
|
||||
import testing "testing"
|
||||
import math_rand "math/rand"
|
||||
import time "time"
|
||||
import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
|
||||
import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb"
|
||||
import fmt "fmt"
|
||||
import go_parser "go/parser"
|
||||
import proto "github.com/gogo/protobuf/proto"
|
||||
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 TestCastawayProto(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
if err := github_com_gogo_protobuf_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
|
||||
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCastawayMarshalTo(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(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 := &Castaway{}
|
||||
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))
|
||||
}
|
||||
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 BenchmarkCastawayProtoMarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Castaway, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
pops[i] = NewPopulatedCastaway(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
total += len(dAtA)
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func BenchmarkCastawayProtoUnmarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
datas := make([][]byte, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedCastaway(popr, false))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
datas[i] = dAtA
|
||||
}
|
||||
msg := &Castaway{}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += len(datas[i%10000])
|
||||
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestWilsonProto(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
if err := github_com_gogo_protobuf_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
|
||||
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWilsonMarshalTo(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(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 := &Wilson{}
|
||||
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))
|
||||
}
|
||||
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 BenchmarkWilsonProtoMarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Wilson, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
pops[i] = NewPopulatedWilson(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
total += len(dAtA)
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func BenchmarkWilsonProtoUnmarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
datas := make([][]byte, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedWilson(popr, false))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
datas[i] = dAtA
|
||||
}
|
||||
msg := &Wilson{}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += len(datas[i%10000])
|
||||
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestCastawayJSON(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
||||
jsondata, err := marshaler.MarshalToString(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
err = github_com_gogo_protobuf_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 TestWilsonJSON(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
||||
jsondata, err := marshaler.MarshalToString(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
err = github_com_gogo_protobuf_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 TestCastawayProtoText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
||||
msg := &Castaway{}
|
||||
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("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 TestCastawayProtoCompactText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
||||
msg := &Castaway{}
|
||||
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("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 TestWilsonProtoText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
||||
msg := &Wilson{}
|
||||
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("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 TestWilsonProtoCompactText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
||||
msg := &Wilson{}
|
||||
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("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 TestCasttypeDescription(t *testing.T) {
|
||||
CasttypeDescription()
|
||||
}
|
||||
func TestCastawayVerboseEqual(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
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 TestWilsonVerboseEqual(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
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 TestCastawayFace(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
msg := p.TestProto()
|
||||
if !p.Equal(msg) {
|
||||
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
||||
}
|
||||
}
|
||||
func TestWilsonFace(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
msg := p.TestProto()
|
||||
if !p.Equal(msg) {
|
||||
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
||||
}
|
||||
}
|
||||
func TestCastawayGoString(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
s1 := p.GoString()
|
||||
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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
func TestWilsonGoString(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
s1 := p.GoString()
|
||||
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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
func TestCastawaySize(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
size2 := github_com_gogo_protobuf_proto.Size(p)
|
||||
dAtA, err := github_com_gogo_protobuf_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 := github_com_gogo_protobuf_proto.Size(p)
|
||||
if size3 != size {
|
||||
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkCastawaySize(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Castaway, 1000)
|
||||
for i := 0; i < 1000; i++ {
|
||||
pops[i] = NewPopulatedCastaway(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += pops[i%1000].Size()
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestWilsonSize(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
size2 := github_com_gogo_protobuf_proto.Size(p)
|
||||
dAtA, err := github_com_gogo_protobuf_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 := github_com_gogo_protobuf_proto.Size(p)
|
||||
if size3 != size {
|
||||
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkWilsonSize(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Wilson, 1000)
|
||||
for i := 0; i < 1000; i++ {
|
||||
pops[i] = NewPopulatedWilson(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += pops[i%1000].Size()
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestCastawayStringer(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
s1 := p.String()
|
||||
s2 := fmt.Sprintf("%v", p)
|
||||
if s1 != s2 {
|
||||
t.Fatalf("String want %v got %v", s1, s2)
|
||||
}
|
||||
}
|
||||
func TestWilsonStringer(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(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
|
1660
vendor/github.com/gogo/protobuf/test/casttype/combos/marshaler/casttype.pb.go
generated
vendored
Normal file
1660
vendor/github.com/gogo/protobuf/test/casttype/combos/marshaler/casttype.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
80
vendor/github.com/gogo/protobuf/test/casttype/combos/marshaler/casttype.proto
generated
vendored
Normal file
80
vendor/github.com/gogo/protobuf/test/casttype/combos/marshaler/casttype.proto
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2015, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package casttype;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.goproto_stringer_all) = false;
|
||||
option (gogoproto.goproto_enum_prefix_all) = false;
|
||||
option (gogoproto.goproto_getters_all) = false;
|
||||
|
||||
option (gogoproto.equal_all) = true;
|
||||
option (gogoproto.verbose_equal_all) = true;
|
||||
option (gogoproto.stringer_all) = true;
|
||||
option (gogoproto.gostring_all) = true;
|
||||
option (gogoproto.face_all) = true;
|
||||
option (gogoproto.description_all) = true;
|
||||
|
||||
option (gogoproto.testgen_all) = true;
|
||||
option (gogoproto.populate_all) = true;
|
||||
option (gogoproto.benchgen_all) = true;
|
||||
option (gogoproto.unmarshaler_all) = false;
|
||||
option (gogoproto.marshaler_all) = true;
|
||||
option (gogoproto.sizer_all) = true;
|
||||
|
||||
option (gogoproto.goproto_enum_stringer_all) = false;
|
||||
option (gogoproto.enum_stringer_all) = true;
|
||||
|
||||
option (gogoproto.unsafe_marshaler_all) = false;
|
||||
option (gogoproto.unsafe_unmarshaler_all) = false;
|
||||
|
||||
message Castaway {
|
||||
optional int64 Int32Ptr = 1 [(gogoproto.casttype) = "int32"];
|
||||
optional int64 Int32 = 2 [(gogoproto.casttype) = "int32", (gogoproto.nullable) = false];
|
||||
optional uint64 MyUint64Ptr = 3 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyUint64Type"];
|
||||
optional uint64 MyUint64 = 4 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyUint64Type", (gogoproto.nullable) = false];
|
||||
optional float MyFloat32Ptr = 5 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyFloat32Type"];
|
||||
optional float MyFloat32 = 6 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyFloat32Type", (gogoproto.nullable) = false];
|
||||
optional double MyFloat64Ptr = 7 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyFloat64Type"];
|
||||
optional double MyFloat64 = 8 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyFloat64Type", (gogoproto.nullable) = false];
|
||||
optional bytes MyBytes = 9 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.Bytes"];
|
||||
optional bytes NormalBytes = 10;
|
||||
repeated uint64 MyUint64s = 11 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyUint64Type"];
|
||||
map<string,uint64> MyMap = 12 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyMapType"];
|
||||
map<string,uint64> MyCustomMap = 13 [(gogoproto.castkey) = "github.com/gogo/protobuf/test/casttype.MyStringType", (gogoproto.castvalue) = "github.com/gogo/protobuf/test/casttype.MyUint64Type"];
|
||||
map<int32,Wilson> MyNullableMap = 14 [(gogoproto.castkey) = "github.com/gogo/protobuf/test/casttype.MyInt32Type"];
|
||||
map<int32,Wilson> MyEmbeddedMap = 15 [(gogoproto.castkey) = "github.com/gogo/protobuf/test/casttype.MyInt32Type", (gogoproto.nullable) = false];
|
||||
optional string String = 16 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyStringType"];
|
||||
}
|
||||
|
||||
message Wilson {
|
||||
optional int64 Int64 = 1;
|
||||
}
|
502
vendor/github.com/gogo/protobuf/test/casttype/combos/marshaler/casttypepb_test.go
generated
vendored
Normal file
502
vendor/github.com/gogo/protobuf/test/casttype/combos/marshaler/casttypepb_test.go
generated
vendored
Normal file
@ -0,0 +1,502 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: combos/marshaler/casttype.proto
|
||||
|
||||
package casttype
|
||||
|
||||
import testing "testing"
|
||||
import math_rand "math/rand"
|
||||
import time "time"
|
||||
import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
|
||||
import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb"
|
||||
import fmt "fmt"
|
||||
import go_parser "go/parser"
|
||||
import proto "github.com/gogo/protobuf/proto"
|
||||
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 TestCastawayProto(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
if err := github_com_gogo_protobuf_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
|
||||
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCastawayMarshalTo(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(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 := &Castaway{}
|
||||
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))
|
||||
}
|
||||
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 BenchmarkCastawayProtoMarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Castaway, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
pops[i] = NewPopulatedCastaway(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
total += len(dAtA)
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func BenchmarkCastawayProtoUnmarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
datas := make([][]byte, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedCastaway(popr, false))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
datas[i] = dAtA
|
||||
}
|
||||
msg := &Castaway{}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += len(datas[i%10000])
|
||||
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestWilsonProto(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
if err := github_com_gogo_protobuf_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
|
||||
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWilsonMarshalTo(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(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 := &Wilson{}
|
||||
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))
|
||||
}
|
||||
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 BenchmarkWilsonProtoMarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Wilson, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
pops[i] = NewPopulatedWilson(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
total += len(dAtA)
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func BenchmarkWilsonProtoUnmarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
datas := make([][]byte, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedWilson(popr, false))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
datas[i] = dAtA
|
||||
}
|
||||
msg := &Wilson{}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += len(datas[i%10000])
|
||||
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestCastawayJSON(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
||||
jsondata, err := marshaler.MarshalToString(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
err = github_com_gogo_protobuf_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 TestWilsonJSON(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
||||
jsondata, err := marshaler.MarshalToString(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
err = github_com_gogo_protobuf_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 TestCastawayProtoText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
||||
msg := &Castaway{}
|
||||
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("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 TestCastawayProtoCompactText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
||||
msg := &Castaway{}
|
||||
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("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 TestWilsonProtoText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
||||
msg := &Wilson{}
|
||||
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("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 TestWilsonProtoCompactText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
||||
msg := &Wilson{}
|
||||
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("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 TestCasttypeDescription(t *testing.T) {
|
||||
CasttypeDescription()
|
||||
}
|
||||
func TestCastawayVerboseEqual(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
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 TestWilsonVerboseEqual(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
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 TestCastawayFace(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
msg := p.TestProto()
|
||||
if !p.Equal(msg) {
|
||||
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
||||
}
|
||||
}
|
||||
func TestWilsonFace(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
msg := p.TestProto()
|
||||
if !p.Equal(msg) {
|
||||
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
||||
}
|
||||
}
|
||||
func TestCastawayGoString(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
s1 := p.GoString()
|
||||
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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
func TestWilsonGoString(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
s1 := p.GoString()
|
||||
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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
func TestCastawaySize(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
size2 := github_com_gogo_protobuf_proto.Size(p)
|
||||
dAtA, err := github_com_gogo_protobuf_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 := github_com_gogo_protobuf_proto.Size(p)
|
||||
if size3 != size {
|
||||
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkCastawaySize(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Castaway, 1000)
|
||||
for i := 0; i < 1000; i++ {
|
||||
pops[i] = NewPopulatedCastaway(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += pops[i%1000].Size()
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestWilsonSize(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
size2 := github_com_gogo_protobuf_proto.Size(p)
|
||||
dAtA, err := github_com_gogo_protobuf_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 := github_com_gogo_protobuf_proto.Size(p)
|
||||
if size3 != size {
|
||||
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkWilsonSize(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Wilson, 1000)
|
||||
for i := 0; i < 1000; i++ {
|
||||
pops[i] = NewPopulatedWilson(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += pops[i%1000].Size()
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestCastawayStringer(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
s1 := p.String()
|
||||
s2 := fmt.Sprintf("%v", p)
|
||||
if s1 != s2 {
|
||||
t.Fatalf("String want %v got %v", s1, s2)
|
||||
}
|
||||
}
|
||||
func TestWilsonStringer(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(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
|
1437
vendor/github.com/gogo/protobuf/test/casttype/combos/neither/casttype.pb.go
generated
vendored
Normal file
1437
vendor/github.com/gogo/protobuf/test/casttype/combos/neither/casttype.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
80
vendor/github.com/gogo/protobuf/test/casttype/combos/neither/casttype.proto
generated
vendored
Normal file
80
vendor/github.com/gogo/protobuf/test/casttype/combos/neither/casttype.proto
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2015, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package casttype;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.goproto_stringer_all) = false;
|
||||
option (gogoproto.goproto_enum_prefix_all) = false;
|
||||
option (gogoproto.goproto_getters_all) = false;
|
||||
|
||||
option (gogoproto.equal_all) = true;
|
||||
option (gogoproto.verbose_equal_all) = true;
|
||||
option (gogoproto.stringer_all) = true;
|
||||
option (gogoproto.gostring_all) = true;
|
||||
option (gogoproto.face_all) = true;
|
||||
option (gogoproto.description_all) = true;
|
||||
|
||||
option (gogoproto.testgen_all) = true;
|
||||
option (gogoproto.populate_all) = true;
|
||||
option (gogoproto.benchgen_all) = true;
|
||||
option (gogoproto.unmarshaler_all) = false;
|
||||
option (gogoproto.marshaler_all) = false;
|
||||
option (gogoproto.sizer_all) = true;
|
||||
|
||||
option (gogoproto.goproto_enum_stringer_all) = false;
|
||||
option (gogoproto.enum_stringer_all) = true;
|
||||
|
||||
option (gogoproto.unsafe_marshaler_all) = false;
|
||||
option (gogoproto.unsafe_unmarshaler_all) = false;
|
||||
|
||||
message Castaway {
|
||||
optional int64 Int32Ptr = 1 [(gogoproto.casttype) = "int32"];
|
||||
optional int64 Int32 = 2 [(gogoproto.casttype) = "int32", (gogoproto.nullable) = false];
|
||||
optional uint64 MyUint64Ptr = 3 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyUint64Type"];
|
||||
optional uint64 MyUint64 = 4 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyUint64Type", (gogoproto.nullable) = false];
|
||||
optional float MyFloat32Ptr = 5 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyFloat32Type"];
|
||||
optional float MyFloat32 = 6 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyFloat32Type", (gogoproto.nullable) = false];
|
||||
optional double MyFloat64Ptr = 7 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyFloat64Type"];
|
||||
optional double MyFloat64 = 8 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyFloat64Type", (gogoproto.nullable) = false];
|
||||
optional bytes MyBytes = 9 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.Bytes"];
|
||||
optional bytes NormalBytes = 10;
|
||||
repeated uint64 MyUint64s = 11 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyUint64Type"];
|
||||
map<string,uint64> MyMap = 12 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyMapType"];
|
||||
map<string,uint64> MyCustomMap = 13 [(gogoproto.castkey) = "github.com/gogo/protobuf/test/casttype.MyStringType", (gogoproto.castvalue) = "github.com/gogo/protobuf/test/casttype.MyUint64Type"];
|
||||
map<int32,Wilson> MyNullableMap = 14 [(gogoproto.castkey) = "github.com/gogo/protobuf/test/casttype.MyInt32Type"];
|
||||
map<int32,Wilson> MyEmbeddedMap = 15 [(gogoproto.castkey) = "github.com/gogo/protobuf/test/casttype.MyInt32Type", (gogoproto.nullable) = false];
|
||||
optional string String = 16 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyStringType"];
|
||||
}
|
||||
|
||||
message Wilson {
|
||||
optional int64 Int64 = 1;
|
||||
}
|
446
vendor/github.com/gogo/protobuf/test/casttype/combos/neither/casttypepb_test.go
generated
vendored
Normal file
446
vendor/github.com/gogo/protobuf/test/casttype/combos/neither/casttypepb_test.go
generated
vendored
Normal file
@ -0,0 +1,446 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: combos/neither/casttype.proto
|
||||
|
||||
package casttype
|
||||
|
||||
import testing "testing"
|
||||
import math_rand "math/rand"
|
||||
import time "time"
|
||||
import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
|
||||
import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb"
|
||||
import fmt "fmt"
|
||||
import go_parser "go/parser"
|
||||
import proto "github.com/gogo/protobuf/proto"
|
||||
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 TestCastawayProto(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
if err := github_com_gogo_protobuf_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
|
||||
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkCastawayProtoMarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Castaway, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
pops[i] = NewPopulatedCastaway(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
total += len(dAtA)
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func BenchmarkCastawayProtoUnmarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
datas := make([][]byte, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedCastaway(popr, false))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
datas[i] = dAtA
|
||||
}
|
||||
msg := &Castaway{}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += len(datas[i%10000])
|
||||
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestWilsonProto(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
if err := github_com_gogo_protobuf_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
|
||||
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkWilsonProtoMarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Wilson, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
pops[i] = NewPopulatedWilson(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
total += len(dAtA)
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func BenchmarkWilsonProtoUnmarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
datas := make([][]byte, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedWilson(popr, false))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
datas[i] = dAtA
|
||||
}
|
||||
msg := &Wilson{}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += len(datas[i%10000])
|
||||
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestCastawayJSON(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
||||
jsondata, err := marshaler.MarshalToString(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
err = github_com_gogo_protobuf_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 TestWilsonJSON(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
||||
jsondata, err := marshaler.MarshalToString(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
err = github_com_gogo_protobuf_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 TestCastawayProtoText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
||||
msg := &Castaway{}
|
||||
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("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 TestCastawayProtoCompactText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
||||
msg := &Castaway{}
|
||||
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("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 TestWilsonProtoText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
||||
msg := &Wilson{}
|
||||
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("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 TestWilsonProtoCompactText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
||||
msg := &Wilson{}
|
||||
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("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 TestCasttypeDescription(t *testing.T) {
|
||||
CasttypeDescription()
|
||||
}
|
||||
func TestCastawayVerboseEqual(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
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 TestWilsonVerboseEqual(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
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 TestCastawayFace(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
msg := p.TestProto()
|
||||
if !p.Equal(msg) {
|
||||
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
||||
}
|
||||
}
|
||||
func TestWilsonFace(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
msg := p.TestProto()
|
||||
if !p.Equal(msg) {
|
||||
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
||||
}
|
||||
}
|
||||
func TestCastawayGoString(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
s1 := p.GoString()
|
||||
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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
func TestWilsonGoString(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
s1 := p.GoString()
|
||||
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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
func TestCastawaySize(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
size2 := github_com_gogo_protobuf_proto.Size(p)
|
||||
dAtA, err := github_com_gogo_protobuf_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 := github_com_gogo_protobuf_proto.Size(p)
|
||||
if size3 != size {
|
||||
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkCastawaySize(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Castaway, 1000)
|
||||
for i := 0; i < 1000; i++ {
|
||||
pops[i] = NewPopulatedCastaway(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += pops[i%1000].Size()
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestWilsonSize(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
size2 := github_com_gogo_protobuf_proto.Size(p)
|
||||
dAtA, err := github_com_gogo_protobuf_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 := github_com_gogo_protobuf_proto.Size(p)
|
||||
if size3 != size {
|
||||
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkWilsonSize(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Wilson, 1000)
|
||||
for i := 0; i < 1000; i++ {
|
||||
pops[i] = NewPopulatedWilson(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += pops[i%1000].Size()
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestCastawayStringer(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
s1 := p.String()
|
||||
s2 := fmt.Sprintf("%v", p)
|
||||
if s1 != s2 {
|
||||
t.Fatalf("String want %v got %v", s1, s2)
|
||||
}
|
||||
}
|
||||
func TestWilsonStringer(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(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
|
2393
vendor/github.com/gogo/protobuf/test/casttype/combos/unmarshaler/casttype.pb.go
generated
vendored
Normal file
2393
vendor/github.com/gogo/protobuf/test/casttype/combos/unmarshaler/casttype.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
80
vendor/github.com/gogo/protobuf/test/casttype/combos/unmarshaler/casttype.proto
generated
vendored
Normal file
80
vendor/github.com/gogo/protobuf/test/casttype/combos/unmarshaler/casttype.proto
generated
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2015, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package casttype;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.goproto_stringer_all) = false;
|
||||
option (gogoproto.goproto_enum_prefix_all) = false;
|
||||
option (gogoproto.goproto_getters_all) = false;
|
||||
|
||||
option (gogoproto.equal_all) = true;
|
||||
option (gogoproto.verbose_equal_all) = true;
|
||||
option (gogoproto.stringer_all) = true;
|
||||
option (gogoproto.gostring_all) = true;
|
||||
option (gogoproto.face_all) = true;
|
||||
option (gogoproto.description_all) = true;
|
||||
|
||||
option (gogoproto.testgen_all) = true;
|
||||
option (gogoproto.populate_all) = true;
|
||||
option (gogoproto.benchgen_all) = true;
|
||||
option (gogoproto.unmarshaler_all) = true;
|
||||
option (gogoproto.marshaler_all) = false;
|
||||
option (gogoproto.sizer_all) = true;
|
||||
|
||||
option (gogoproto.goproto_enum_stringer_all) = false;
|
||||
option (gogoproto.enum_stringer_all) = true;
|
||||
|
||||
option (gogoproto.unsafe_marshaler_all) = false;
|
||||
option (gogoproto.unsafe_unmarshaler_all) = false;
|
||||
|
||||
message Castaway {
|
||||
optional int64 Int32Ptr = 1 [(gogoproto.casttype) = "int32"];
|
||||
optional int64 Int32 = 2 [(gogoproto.casttype) = "int32", (gogoproto.nullable) = false];
|
||||
optional uint64 MyUint64Ptr = 3 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyUint64Type"];
|
||||
optional uint64 MyUint64 = 4 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyUint64Type", (gogoproto.nullable) = false];
|
||||
optional float MyFloat32Ptr = 5 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyFloat32Type"];
|
||||
optional float MyFloat32 = 6 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyFloat32Type", (gogoproto.nullable) = false];
|
||||
optional double MyFloat64Ptr = 7 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyFloat64Type"];
|
||||
optional double MyFloat64 = 8 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyFloat64Type", (gogoproto.nullable) = false];
|
||||
optional bytes MyBytes = 9 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.Bytes"];
|
||||
optional bytes NormalBytes = 10;
|
||||
repeated uint64 MyUint64s = 11 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyUint64Type"];
|
||||
map<string,uint64> MyMap = 12 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyMapType"];
|
||||
map<string,uint64> MyCustomMap = 13 [(gogoproto.castkey) = "github.com/gogo/protobuf/test/casttype.MyStringType", (gogoproto.castvalue) = "github.com/gogo/protobuf/test/casttype.MyUint64Type"];
|
||||
map<int32,Wilson> MyNullableMap = 14 [(gogoproto.castkey) = "github.com/gogo/protobuf/test/casttype.MyInt32Type"];
|
||||
map<int32,Wilson> MyEmbeddedMap = 15 [(gogoproto.castkey) = "github.com/gogo/protobuf/test/casttype.MyInt32Type", (gogoproto.nullable) = false];
|
||||
optional string String = 16 [(gogoproto.casttype) = "github.com/gogo/protobuf/test/casttype.MyStringType"];
|
||||
}
|
||||
|
||||
message Wilson {
|
||||
optional int64 Int64 = 1;
|
||||
}
|
446
vendor/github.com/gogo/protobuf/test/casttype/combos/unmarshaler/casttypepb_test.go
generated
vendored
Normal file
446
vendor/github.com/gogo/protobuf/test/casttype/combos/unmarshaler/casttypepb_test.go
generated
vendored
Normal file
@ -0,0 +1,446 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: combos/unmarshaler/casttype.proto
|
||||
|
||||
package casttype
|
||||
|
||||
import testing "testing"
|
||||
import math_rand "math/rand"
|
||||
import time "time"
|
||||
import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
|
||||
import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb"
|
||||
import fmt "fmt"
|
||||
import go_parser "go/parser"
|
||||
import proto "github.com/gogo/protobuf/proto"
|
||||
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 TestCastawayProto(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
if err := github_com_gogo_protobuf_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
|
||||
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkCastawayProtoMarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Castaway, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
pops[i] = NewPopulatedCastaway(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
total += len(dAtA)
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func BenchmarkCastawayProtoUnmarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
datas := make([][]byte, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedCastaway(popr, false))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
datas[i] = dAtA
|
||||
}
|
||||
msg := &Castaway{}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += len(datas[i%10000])
|
||||
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestWilsonProto(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
if err := github_com_gogo_protobuf_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
|
||||
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkWilsonProtoMarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Wilson, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
pops[i] = NewPopulatedWilson(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
total += len(dAtA)
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func BenchmarkWilsonProtoUnmarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
datas := make([][]byte, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedWilson(popr, false))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
datas[i] = dAtA
|
||||
}
|
||||
msg := &Wilson{}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += len(datas[i%10000])
|
||||
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestCastawayJSON(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
||||
jsondata, err := marshaler.MarshalToString(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
err = github_com_gogo_protobuf_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 TestWilsonJSON(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
||||
jsondata, err := marshaler.MarshalToString(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
err = github_com_gogo_protobuf_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 TestCastawayProtoText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
||||
msg := &Castaway{}
|
||||
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("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 TestCastawayProtoCompactText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
||||
msg := &Castaway{}
|
||||
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("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 TestWilsonProtoText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
||||
msg := &Wilson{}
|
||||
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("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 TestWilsonProtoCompactText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
||||
msg := &Wilson{}
|
||||
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("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 TestCasttypeDescription(t *testing.T) {
|
||||
CasttypeDescription()
|
||||
}
|
||||
func TestCastawayVerboseEqual(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
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 TestWilsonVerboseEqual(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
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 TestCastawayFace(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
msg := p.TestProto()
|
||||
if !p.Equal(msg) {
|
||||
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
||||
}
|
||||
}
|
||||
func TestWilsonFace(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
msg := p.TestProto()
|
||||
if !p.Equal(msg) {
|
||||
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
||||
}
|
||||
}
|
||||
func TestCastawayGoString(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
s1 := p.GoString()
|
||||
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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
func TestWilsonGoString(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
s1 := p.GoString()
|
||||
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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
func TestCastawaySize(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
size2 := github_com_gogo_protobuf_proto.Size(p)
|
||||
dAtA, err := github_com_gogo_protobuf_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 := github_com_gogo_protobuf_proto.Size(p)
|
||||
if size3 != size {
|
||||
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkCastawaySize(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Castaway, 1000)
|
||||
for i := 0; i < 1000; i++ {
|
||||
pops[i] = NewPopulatedCastaway(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += pops[i%1000].Size()
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestWilsonSize(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
size2 := github_com_gogo_protobuf_proto.Size(p)
|
||||
dAtA, err := github_com_gogo_protobuf_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 := github_com_gogo_protobuf_proto.Size(p)
|
||||
if size3 != size {
|
||||
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkWilsonSize(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Wilson, 1000)
|
||||
for i := 0; i < 1000; i++ {
|
||||
pops[i] = NewPopulatedWilson(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += pops[i%1000].Size()
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestCastawayStringer(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
s1 := p.String()
|
||||
s2 := fmt.Sprintf("%v", p)
|
||||
if s1 != s2 {
|
||||
t.Fatalf("String want %v got %v", s1, s2)
|
||||
}
|
||||
}
|
||||
func TestWilsonStringer(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(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
|
59
vendor/github.com/gogo/protobuf/test/casttype/mytypes.go
generated
vendored
Normal file
59
vendor/github.com/gogo/protobuf/test/casttype/mytypes.go
generated
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package casttype
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
type MyInt32Type int32
|
||||
type MyFloat32Type float32
|
||||
|
||||
type MyUint64Type uint64
|
||||
type MyFloat64Type float64
|
||||
|
||||
type Bytes []byte
|
||||
|
||||
func (this Bytes) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal([]byte(this))
|
||||
}
|
||||
|
||||
func (this *Bytes) UnmarshalJSON(data []byte) error {
|
||||
v := new([]byte)
|
||||
err := json.Unmarshal(data, v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*this = *v
|
||||
return nil
|
||||
}
|
||||
|
||||
type MyStringType string
|
||||
|
||||
type MyMapType map[string]uint64
|
40
vendor/github.com/gogo/protobuf/test/castvalue/Makefile
generated
vendored
Normal file
40
vendor/github.com/gogo/protobuf/test/castvalue/Makefile
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
# Protocol Buffers for Go with Gadgets
|
||||
#
|
||||
# Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
# http://github.com/gogo/protobuf
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
regenerate:
|
||||
rm -rf combos
|
||||
go install github.com/gogo/protobuf/protoc-gen-combo
|
||||
go install github.com/gogo/protobuf/protoc-gen-gogo
|
||||
protoc-min-version --version="3.0.0" --gogo_out=. --proto_path=../../protobuf/:../../../../../:. castvalue.proto
|
||||
protoc-gen-combo --default=false --version="3.0.0" --gogo_out=. --proto_path=../../protobuf/:../../../../../:. castvalue.proto
|
||||
cp mytypes.go ./combos/both/ || true
|
||||
cp mytypes.go ./combos/marshaler/ || true
|
||||
cp mytypes.go ./combos/unmarshaler/ || true
|
||||
cp mytypes.go ./combos/unsafeboth/ || true
|
||||
cp mytypes.go ./combos/unsafemarshaler/ || true
|
||||
cp mytypes.go ./combos/unsafeunmarshaler/ || true
|
904
vendor/github.com/gogo/protobuf/test/castvalue/castvalue.pb.go
generated
vendored
Normal file
904
vendor/github.com/gogo/protobuf/test/castvalue/castvalue.pb.go
generated
vendored
Normal file
@ -0,0 +1,904 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: castvalue.proto
|
||||
|
||||
package castvalue
|
||||
|
||||
import proto "github.com/gogo/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "github.com/gogo/protobuf/gogoproto"
|
||||
|
||||
import github_com_gogo_protobuf_protoc_gen_gogo_descriptor "github.com/gogo/protobuf/protoc-gen-gogo/descriptor"
|
||||
import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
|
||||
import compress_gzip "compress/gzip"
|
||||
import bytes "bytes"
|
||||
import io_ioutil "io/ioutil"
|
||||
|
||||
import strings "strings"
|
||||
import reflect "reflect"
|
||||
import github_com_gogo_protobuf_sortkeys "github.com/gogo/protobuf/sortkeys"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type Castaway struct {
|
||||
CastMapValueMessage map[int32]MyWilson `protobuf:"bytes,1,rep,name=CastMapValueMessage,castvalue=MyWilson,castvaluetype=castvalue.Wilson" json:"CastMapValueMessage" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
CastMapValueMessageNullable map[int32]*MyWilson `protobuf:"bytes,2,rep,name=CastMapValueMessageNullable,castvalue=MyWilson,castvaluetype=castvalue.Wilson" json:"CastMapValueMessageNullable,omitempty" protobuf_key:"varint,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Castaway) Reset() { *m = Castaway{} }
|
||||
func (*Castaway) ProtoMessage() {}
|
||||
func (*Castaway) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_castvalue_87404b9a479f5489, []int{0}
|
||||
}
|
||||
func (m *Castaway) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Castaway.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Castaway) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Castaway.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Castaway) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Castaway.Merge(dst, src)
|
||||
}
|
||||
func (m *Castaway) XXX_Size() int {
|
||||
return xxx_messageInfo_Castaway.Size(m)
|
||||
}
|
||||
func (m *Castaway) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Castaway.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Castaway proto.InternalMessageInfo
|
||||
|
||||
type Wilson struct {
|
||||
Int64 *int64 `protobuf:"varint,1,opt,name=Int64" json:"Int64,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Wilson) Reset() { *m = Wilson{} }
|
||||
func (*Wilson) ProtoMessage() {}
|
||||
func (*Wilson) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_castvalue_87404b9a479f5489, []int{1}
|
||||
}
|
||||
func (m *Wilson) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Wilson.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Wilson) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Wilson.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Wilson) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Wilson.Merge(dst, src)
|
||||
}
|
||||
func (m *Wilson) XXX_Size() int {
|
||||
return xxx_messageInfo_Wilson.Size(m)
|
||||
}
|
||||
func (m *Wilson) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Wilson.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Wilson proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Castaway)(nil), "castvalue.Castaway")
|
||||
proto.RegisterMapType((map[int32]MyWilson)(nil), "castvalue.Castaway.CastMapValueMessageEntry")
|
||||
proto.RegisterMapType((map[int32]*MyWilson)(nil), "castvalue.Castaway.CastMapValueMessageNullableEntry")
|
||||
proto.RegisterType((*Wilson)(nil), "castvalue.Wilson")
|
||||
}
|
||||
func (this *Castaway) Description() (desc *github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet) {
|
||||
return CastvalueDescription()
|
||||
}
|
||||
func (this *Wilson) Description() (desc *github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet) {
|
||||
return CastvalueDescription()
|
||||
}
|
||||
func CastvalueDescription() (desc *github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet) {
|
||||
d := &github_com_gogo_protobuf_protoc_gen_gogo_descriptor.FileDescriptorSet{}
|
||||
var gzipped = []byte{
|
||||
// 4004 bytes of a gzipped FileDescriptorSet
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5a, 0x5d, 0x70, 0xdc, 0xd6,
|
||||
0x75, 0x26, 0xf6, 0x87, 0xdc, 0x3d, 0xbb, 0x5c, 0x82, 0x20, 0x2d, 0xad, 0xe8, 0x64, 0x45, 0xd1,
|
||||
0x76, 0x44, 0xdb, 0x09, 0x95, 0x91, 0x25, 0x59, 0x5a, 0x35, 0x71, 0x97, 0xcb, 0x15, 0xb3, 0x2e,
|
||||
0xff, 0x82, 0x25, 0x63, 0xcb, 0x99, 0x0e, 0x06, 0xc4, 0xde, 0x5d, 0x42, 0xc2, 0x02, 0x08, 0x80,
|
||||
0x95, 0x4c, 0x4d, 0x1f, 0xd4, 0x71, 0xda, 0x4e, 0xda, 0xe9, 0x7f, 0x67, 0x9a, 0xb8, 0x8e, 0xdb,
|
||||
0xa4, 0xd3, 0x38, 0x4d, 0xff, 0x92, 0xa6, 0x4d, 0x93, 0xf4, 0x25, 0x7d, 0x48, 0xeb, 0xa7, 0x4e,
|
||||
0xf2, 0xd6, 0x87, 0x4e, 0x6b, 0x31, 0x9e, 0xa9, 0xdb, 0xba, 0x8d, 0xdb, 0xea, 0xc1, 0x33, 0x9e,
|
||||
0xce, 0x74, 0xee, 0x1f, 0x16, 0xc0, 0x2e, 0x09, 0x30, 0x1d, 0x3b, 0x4f, 0x24, 0xce, 0x3d, 0xdf,
|
||||
0x87, 0x73, 0xcf, 0x3d, 0xf7, 0x9c, 0x73, 0x2f, 0x16, 0x7e, 0x78, 0x05, 0xe6, 0xbb, 0x96, 0xd5,
|
||||
0x35, 0xd0, 0x39, 0xdb, 0xb1, 0x3c, 0x6b, 0xb7, 0xdf, 0x39, 0xd7, 0x46, 0xae, 0xe6, 0xe8, 0xb6,
|
||||
0x67, 0x39, 0x4b, 0x44, 0x26, 0x4d, 0x51, 0x8d, 0x25, 0xae, 0xb1, 0xb0, 0x0e, 0xd3, 0xd7, 0x74,
|
||||
0x03, 0xad, 0xf8, 0x8a, 0x2d, 0xe4, 0x49, 0x97, 0x21, 0xd3, 0xd1, 0x0d, 0x54, 0x16, 0xe6, 0xd3,
|
||||
0x8b, 0x85, 0xf3, 0x0f, 0x2f, 0x45, 0x40, 0x4b, 0x61, 0xc4, 0x16, 0x16, 0xcb, 0x04, 0xb1, 0xf0,
|
||||
0x7a, 0x06, 0x66, 0x46, 0x8c, 0x4a, 0x12, 0x64, 0x4c, 0xb5, 0x87, 0x19, 0x85, 0xc5, 0xbc, 0x4c,
|
||||
0xfe, 0x97, 0xca, 0x30, 0x61, 0xab, 0xda, 0x4d, 0xb5, 0x8b, 0xca, 0x29, 0x22, 0xe6, 0x8f, 0x52,
|
||||
0x05, 0xa0, 0x8d, 0x6c, 0x64, 0xb6, 0x91, 0xa9, 0xed, 0x97, 0xd3, 0xf3, 0xe9, 0xc5, 0xbc, 0x1c,
|
||||
0x90, 0x48, 0x8f, 0xc3, 0xb4, 0xdd, 0xdf, 0x35, 0x74, 0x4d, 0x09, 0xa8, 0xc1, 0x7c, 0x7a, 0x31,
|
||||
0x2b, 0x8b, 0x74, 0x60, 0x65, 0xa0, 0x7c, 0x16, 0xa6, 0x6e, 0x23, 0xf5, 0x66, 0x50, 0xb5, 0x40,
|
||||
0x54, 0x4b, 0x58, 0x1c, 0x50, 0xac, 0x43, 0xb1, 0x87, 0x5c, 0x57, 0xed, 0x22, 0xc5, 0xdb, 0xb7,
|
||||
0x51, 0x39, 0x43, 0x66, 0x3f, 0x3f, 0x34, 0xfb, 0xe8, 0xcc, 0x0b, 0x0c, 0xb5, 0xbd, 0x6f, 0x23,
|
||||
0xa9, 0x06, 0x79, 0x64, 0xf6, 0x7b, 0x94, 0x21, 0x7b, 0x88, 0xff, 0x1a, 0x66, 0xbf, 0x17, 0x65,
|
||||
0xc9, 0x61, 0x18, 0xa3, 0x98, 0x70, 0x91, 0x73, 0x4b, 0xd7, 0x50, 0x79, 0x9c, 0x10, 0x9c, 0x1d,
|
||||
0x22, 0x68, 0xd1, 0xf1, 0x28, 0x07, 0xc7, 0x49, 0x75, 0xc8, 0xa3, 0xe7, 0x3d, 0x64, 0xba, 0xba,
|
||||
0x65, 0x96, 0x27, 0x08, 0xc9, 0x23, 0x23, 0x56, 0x11, 0x19, 0xed, 0x28, 0xc5, 0x00, 0x27, 0x5d,
|
||||
0x82, 0x09, 0xcb, 0xf6, 0x74, 0xcb, 0x74, 0xcb, 0xb9, 0x79, 0x61, 0xb1, 0x70, 0xfe, 0x7d, 0x23,
|
||||
0x03, 0x61, 0x93, 0xea, 0xc8, 0x5c, 0x59, 0x6a, 0x82, 0xe8, 0x5a, 0x7d, 0x47, 0x43, 0x8a, 0x66,
|
||||
0xb5, 0x91, 0xa2, 0x9b, 0x1d, 0xab, 0x9c, 0x27, 0x04, 0xa7, 0x87, 0x27, 0x42, 0x14, 0xeb, 0x56,
|
||||
0x1b, 0x35, 0xcd, 0x8e, 0x25, 0x97, 0xdc, 0xd0, 0xb3, 0x74, 0x02, 0xc6, 0xdd, 0x7d, 0xd3, 0x53,
|
||||
0x9f, 0x2f, 0x17, 0x49, 0x84, 0xb0, 0xa7, 0x85, 0x6f, 0x8d, 0xc3, 0x54, 0x92, 0x10, 0xbb, 0x0a,
|
||||
0xd9, 0x0e, 0x9e, 0x65, 0x39, 0x75, 0x1c, 0x1f, 0x50, 0x4c, 0xd8, 0x89, 0xe3, 0x3f, 0xa2, 0x13,
|
||||
0x6b, 0x50, 0x30, 0x91, 0xeb, 0xa1, 0x36, 0x8d, 0x88, 0x74, 0xc2, 0x98, 0x02, 0x0a, 0x1a, 0x0e,
|
||||
0xa9, 0xcc, 0x8f, 0x14, 0x52, 0xcf, 0xc2, 0x94, 0x6f, 0x92, 0xe2, 0xa8, 0x66, 0x97, 0xc7, 0xe6,
|
||||
0xb9, 0x38, 0x4b, 0x96, 0x1a, 0x1c, 0x27, 0x63, 0x98, 0x5c, 0x42, 0xa1, 0x67, 0x69, 0x05, 0xc0,
|
||||
0x32, 0x91, 0xd5, 0x51, 0xda, 0x48, 0x33, 0xca, 0xb9, 0x43, 0xbc, 0xb4, 0x89, 0x55, 0x86, 0xbc,
|
||||
0x64, 0x51, 0xa9, 0x66, 0x48, 0x57, 0x06, 0xa1, 0x36, 0x71, 0x48, 0xa4, 0xac, 0xd3, 0x4d, 0x36,
|
||||
0x14, 0x6d, 0x3b, 0x50, 0x72, 0x10, 0x8e, 0x7b, 0xd4, 0x66, 0x33, 0xcb, 0x13, 0x23, 0x96, 0x62,
|
||||
0x67, 0x26, 0x33, 0x18, 0x9d, 0xd8, 0xa4, 0x13, 0x7c, 0x94, 0x1e, 0x02, 0x5f, 0xa0, 0x90, 0xb0,
|
||||
0x02, 0x92, 0x85, 0x8a, 0x5c, 0xb8, 0xa1, 0xf6, 0xd0, 0xdc, 0x1d, 0x28, 0x85, 0xdd, 0x23, 0xcd,
|
||||
0x42, 0xd6, 0xf5, 0x54, 0xc7, 0x23, 0x51, 0x98, 0x95, 0xe9, 0x83, 0x24, 0x42, 0x1a, 0x99, 0x6d,
|
||||
0x92, 0xe5, 0xb2, 0x32, 0xfe, 0x57, 0xfa, 0xc9, 0xc1, 0x84, 0xd3, 0x64, 0xc2, 0x1f, 0x18, 0x5e,
|
||||
0xd1, 0x10, 0x73, 0x74, 0xde, 0x73, 0x4f, 0xc2, 0x64, 0x68, 0x02, 0x49, 0x5f, 0xbd, 0xf0, 0x33,
|
||||
0xf0, 0xc0, 0x48, 0x6a, 0xe9, 0x59, 0x98, 0xed, 0x9b, 0xba, 0xe9, 0x21, 0xc7, 0x76, 0x10, 0x8e,
|
||||
0x58, 0xfa, 0xaa, 0xf2, 0xbf, 0x4c, 0x1c, 0x12, 0x73, 0x3b, 0x41, 0x6d, 0xca, 0x22, 0xcf, 0xf4,
|
||||
0x87, 0x85, 0x8f, 0xe5, 0x73, 0x6f, 0x4c, 0x88, 0x77, 0xef, 0xde, 0xbd, 0x9b, 0x5a, 0xf8, 0xec,
|
||||
0x38, 0xcc, 0x8e, 0xda, 0x33, 0x23, 0xb7, 0xef, 0x09, 0x18, 0x37, 0xfb, 0xbd, 0x5d, 0xe4, 0x10,
|
||||
0x27, 0x65, 0x65, 0xf6, 0x24, 0xd5, 0x20, 0x6b, 0xa8, 0xbb, 0xc8, 0x28, 0x67, 0xe6, 0x85, 0xc5,
|
||||
0xd2, 0xf9, 0xc7, 0x13, 0xed, 0xca, 0xa5, 0x35, 0x0c, 0x91, 0x29, 0x52, 0xfa, 0x28, 0x64, 0x58,
|
||||
0x8a, 0xc6, 0x0c, 0x8f, 0x25, 0x63, 0xc0, 0x7b, 0x49, 0x26, 0x38, 0xe9, 0x41, 0xc8, 0xe3, 0xbf,
|
||||
0x34, 0x36, 0xc6, 0x89, 0xcd, 0x39, 0x2c, 0xc0, 0x71, 0x21, 0xcd, 0x41, 0x8e, 0x6c, 0x93, 0x36,
|
||||
0xe2, 0xa5, 0xcd, 0x7f, 0xc6, 0x81, 0xd5, 0x46, 0x1d, 0xb5, 0x6f, 0x78, 0xca, 0x2d, 0xd5, 0xe8,
|
||||
0x23, 0x12, 0xf0, 0x79, 0xb9, 0xc8, 0x84, 0x9f, 0xc0, 0x32, 0xe9, 0x34, 0x14, 0xe8, 0xae, 0xd2,
|
||||
0xcd, 0x36, 0x7a, 0x9e, 0x64, 0xcf, 0xac, 0x4c, 0x37, 0x5a, 0x13, 0x4b, 0xf0, 0xeb, 0x6f, 0xb8,
|
||||
0x96, 0xc9, 0x43, 0x93, 0xbc, 0x02, 0x0b, 0xc8, 0xeb, 0x9f, 0x8c, 0x26, 0xee, 0xf7, 0x8f, 0x9e,
|
||||
0x5e, 0x34, 0xa6, 0x16, 0xbe, 0x91, 0x82, 0x0c, 0xc9, 0x17, 0x53, 0x50, 0xd8, 0xbe, 0xbe, 0xd5,
|
||||
0x50, 0x56, 0x36, 0x77, 0x96, 0xd7, 0x1a, 0xa2, 0x20, 0x95, 0x00, 0x88, 0xe0, 0xda, 0xda, 0x66,
|
||||
0x6d, 0x5b, 0x4c, 0xf9, 0xcf, 0xcd, 0x8d, 0xed, 0x4b, 0x17, 0xc4, 0xb4, 0x0f, 0xd8, 0xa1, 0x82,
|
||||
0x4c, 0x50, 0xe1, 0x89, 0xf3, 0x62, 0x56, 0x12, 0xa1, 0x48, 0x09, 0x9a, 0xcf, 0x36, 0x56, 0x2e,
|
||||
0x5d, 0x10, 0xc7, 0xc3, 0x92, 0x27, 0xce, 0x8b, 0x13, 0xd2, 0x24, 0xe4, 0x89, 0x64, 0x79, 0x73,
|
||||
0x73, 0x4d, 0xcc, 0xf9, 0x9c, 0xad, 0x6d, 0xb9, 0xb9, 0xb1, 0x2a, 0xe6, 0x7d, 0xce, 0x55, 0x79,
|
||||
0x73, 0x67, 0x4b, 0x04, 0x9f, 0x61, 0xbd, 0xd1, 0x6a, 0xd5, 0x56, 0x1b, 0x62, 0xc1, 0xd7, 0x58,
|
||||
0xbe, 0xbe, 0xdd, 0x68, 0x89, 0xc5, 0x90, 0x59, 0x4f, 0x9c, 0x17, 0x27, 0xfd, 0x57, 0x34, 0x36,
|
||||
0x76, 0xd6, 0xc5, 0x92, 0x34, 0x0d, 0x93, 0xf4, 0x15, 0xdc, 0x88, 0xa9, 0x88, 0xe8, 0xd2, 0x05,
|
||||
0x51, 0x1c, 0x18, 0x42, 0x59, 0xa6, 0x43, 0x82, 0x4b, 0x17, 0x44, 0x69, 0xa1, 0x0e, 0x59, 0x12,
|
||||
0x5d, 0x92, 0x04, 0xa5, 0xb5, 0xda, 0x72, 0x63, 0x4d, 0xd9, 0xdc, 0xda, 0x6e, 0x6e, 0x6e, 0xd4,
|
||||
0xd6, 0x44, 0x61, 0x20, 0x93, 0x1b, 0x1f, 0xdf, 0x69, 0xca, 0x8d, 0x15, 0x31, 0x15, 0x94, 0x6d,
|
||||
0x35, 0x6a, 0xdb, 0x8d, 0x15, 0x31, 0xbd, 0xa0, 0xc1, 0xec, 0xa8, 0x3c, 0x39, 0x72, 0x67, 0x04,
|
||||
0x96, 0x38, 0x75, 0xc8, 0x12, 0x13, 0xae, 0xa1, 0x25, 0xfe, 0x41, 0x0a, 0x66, 0x46, 0xd4, 0x8a,
|
||||
0x91, 0x2f, 0x79, 0x0a, 0xb2, 0x34, 0x44, 0x69, 0xf5, 0x7c, 0x74, 0x64, 0xd1, 0x21, 0x01, 0x3b,
|
||||
0x54, 0x41, 0x09, 0x2e, 0xd8, 0x41, 0xa4, 0x0f, 0xe9, 0x20, 0x30, 0xc5, 0x50, 0x4e, 0xff, 0xe9,
|
||||
0xa1, 0x9c, 0x4e, 0xcb, 0xde, 0xa5, 0x24, 0x65, 0x8f, 0xc8, 0x8e, 0x97, 0xdb, 0xb3, 0x23, 0x72,
|
||||
0xfb, 0x55, 0x98, 0x1e, 0x22, 0x4a, 0x9c, 0x63, 0x5f, 0x10, 0xa0, 0x7c, 0x98, 0x73, 0x62, 0x32,
|
||||
0x5d, 0x2a, 0x94, 0xe9, 0xae, 0x46, 0x3d, 0x78, 0xe6, 0xf0, 0x45, 0x18, 0x5a, 0xeb, 0x57, 0x04,
|
||||
0x38, 0x31, 0xba, 0x53, 0x1c, 0x69, 0xc3, 0x47, 0x61, 0xbc, 0x87, 0xbc, 0x3d, 0x8b, 0x77, 0x4b,
|
||||
0x1f, 0x18, 0x51, 0x83, 0xf1, 0x70, 0x74, 0xb1, 0x19, 0x2a, 0x58, 0xc4, 0xd3, 0x87, 0xb5, 0x7b,
|
||||
0xd4, 0x9a, 0x21, 0x4b, 0x3f, 0x93, 0x82, 0x07, 0x46, 0x92, 0x8f, 0x34, 0xf4, 0xfd, 0x00, 0xba,
|
||||
0x69, 0xf7, 0x3d, 0xda, 0x11, 0xd1, 0x04, 0x9b, 0x27, 0x12, 0x92, 0xbc, 0x70, 0xf2, 0xec, 0x7b,
|
||||
0xfe, 0x78, 0x9a, 0x8c, 0x03, 0x15, 0x11, 0x85, 0xcb, 0x03, 0x43, 0x33, 0xc4, 0xd0, 0xca, 0x21,
|
||||
0x33, 0x1d, 0x0a, 0xcc, 0x0f, 0x83, 0xa8, 0x19, 0x3a, 0x32, 0x3d, 0xc5, 0xf5, 0x1c, 0xa4, 0xf6,
|
||||
0x74, 0xb3, 0x4b, 0x2a, 0x48, 0xae, 0x9a, 0xed, 0xa8, 0x86, 0x8b, 0xe4, 0x29, 0x3a, 0xdc, 0xe2,
|
||||
0xa3, 0x18, 0x41, 0x02, 0xc8, 0x09, 0x20, 0xc6, 0x43, 0x08, 0x3a, 0xec, 0x23, 0x16, 0xbe, 0x9e,
|
||||
0x83, 0x42, 0xa0, 0xaf, 0x96, 0xce, 0x40, 0xf1, 0x86, 0x7a, 0x4b, 0x55, 0xf8, 0x59, 0x89, 0x7a,
|
||||
0xa2, 0x80, 0x65, 0x5b, 0xec, 0xbc, 0xf4, 0x61, 0x98, 0x25, 0x2a, 0x56, 0xdf, 0x43, 0x8e, 0xa2,
|
||||
0x19, 0xaa, 0xeb, 0x12, 0xa7, 0xe5, 0x88, 0xaa, 0x84, 0xc7, 0x36, 0xf1, 0x50, 0x9d, 0x8f, 0x48,
|
||||
0x17, 0x61, 0x86, 0x20, 0x7a, 0x7d, 0xc3, 0xd3, 0x6d, 0x03, 0x29, 0xf8, 0xf4, 0xe6, 0x92, 0x4a,
|
||||
0xe2, 0x5b, 0x36, 0x8d, 0x35, 0xd6, 0x99, 0x02, 0xb6, 0xc8, 0x95, 0x56, 0xe0, 0xfd, 0x04, 0xd6,
|
||||
0x45, 0x26, 0x72, 0x54, 0x0f, 0x29, 0xe8, 0x53, 0x7d, 0xd5, 0x70, 0x15, 0xd5, 0x6c, 0x2b, 0x7b,
|
||||
0xaa, 0xbb, 0x57, 0x9e, 0xc5, 0x04, 0xcb, 0xa9, 0xb2, 0x20, 0x9f, 0xc2, 0x8a, 0xab, 0x4c, 0xaf,
|
||||
0x41, 0xd4, 0x6a, 0x66, 0xfb, 0x63, 0xaa, 0xbb, 0x27, 0x55, 0xe1, 0x04, 0x61, 0x71, 0x3d, 0x47,
|
||||
0x37, 0xbb, 0x8a, 0xb6, 0x87, 0xb4, 0x9b, 0x4a, 0xdf, 0xeb, 0x5c, 0x2e, 0x3f, 0x18, 0x7c, 0x3f,
|
||||
0xb1, 0xb0, 0x45, 0x74, 0xea, 0x58, 0x65, 0xc7, 0xeb, 0x5c, 0x96, 0x5a, 0x50, 0xc4, 0x8b, 0xd1,
|
||||
0xd3, 0xef, 0x20, 0xa5, 0x63, 0x39, 0xa4, 0x34, 0x96, 0x46, 0xa4, 0xa6, 0x80, 0x07, 0x97, 0x36,
|
||||
0x19, 0x60, 0xdd, 0x6a, 0xa3, 0x6a, 0xb6, 0xb5, 0xd5, 0x68, 0xac, 0xc8, 0x05, 0xce, 0x72, 0xcd,
|
||||
0x72, 0x70, 0x40, 0x75, 0x2d, 0xdf, 0xc1, 0x05, 0x1a, 0x50, 0x5d, 0x8b, 0xbb, 0xf7, 0x22, 0xcc,
|
||||
0x68, 0x1a, 0x9d, 0xb3, 0xae, 0x29, 0xec, 0x8c, 0xe5, 0x96, 0xc5, 0x90, 0xb3, 0x34, 0x6d, 0x95,
|
||||
0x2a, 0xb0, 0x18, 0x77, 0xa5, 0x2b, 0xf0, 0xc0, 0xc0, 0x59, 0x41, 0xe0, 0xf4, 0xd0, 0x2c, 0xa3,
|
||||
0xd0, 0x8b, 0x30, 0x63, 0xef, 0x0f, 0x03, 0xa5, 0xd0, 0x1b, 0xed, 0xfd, 0x28, 0xec, 0x49, 0x98,
|
||||
0xb5, 0xf7, 0xec, 0x61, 0xdc, 0x63, 0x41, 0x9c, 0x64, 0xef, 0xd9, 0x51, 0xe0, 0x23, 0xe4, 0xc0,
|
||||
0xed, 0x20, 0x4d, 0xf5, 0x50, 0xbb, 0x7c, 0x32, 0xa8, 0x1e, 0x18, 0x90, 0xce, 0x81, 0xa8, 0x69,
|
||||
0x0a, 0x32, 0xd5, 0x5d, 0x03, 0x29, 0xaa, 0x83, 0x4c, 0xd5, 0x2d, 0x9f, 0x0e, 0x2a, 0x97, 0x34,
|
||||
0xad, 0x41, 0x46, 0x6b, 0x64, 0x50, 0x7a, 0x0c, 0xa6, 0xad, 0xdd, 0x1b, 0x1a, 0x0d, 0x49, 0xc5,
|
||||
0x76, 0x50, 0x47, 0x7f, 0xbe, 0xfc, 0x30, 0xf1, 0xef, 0x14, 0x1e, 0x20, 0x01, 0xb9, 0x45, 0xc4,
|
||||
0xd2, 0xa3, 0x20, 0x6a, 0xee, 0x9e, 0xea, 0xd8, 0x24, 0x27, 0xbb, 0xb6, 0xaa, 0xa1, 0xf2, 0x23,
|
||||
0x54, 0x95, 0xca, 0x37, 0xb8, 0x18, 0x6f, 0x09, 0xf7, 0xb6, 0xde, 0xf1, 0x38, 0xe3, 0x59, 0xba,
|
||||
0x25, 0x88, 0x8c, 0xb1, 0x2d, 0x82, 0x88, 0x5d, 0x11, 0x7a, 0xf1, 0x22, 0x51, 0x2b, 0xd9, 0x7b,
|
||||
0x76, 0xf0, 0xbd, 0x0f, 0xc1, 0x24, 0xd6, 0x1c, 0xbc, 0xf4, 0x51, 0xda, 0x90, 0xd9, 0x7b, 0x81,
|
||||
0x37, 0xbe, 0x6b, 0xbd, 0xf1, 0x42, 0x15, 0x8a, 0xc1, 0xf8, 0x94, 0xf2, 0x40, 0x23, 0x54, 0x14,
|
||||
0x70, 0xb3, 0x52, 0xdf, 0x5c, 0xc1, 0x6d, 0xc6, 0x73, 0x0d, 0x31, 0x85, 0xdb, 0x9d, 0xb5, 0xe6,
|
||||
0x76, 0x43, 0x91, 0x77, 0x36, 0xb6, 0x9b, 0xeb, 0x0d, 0x31, 0x1d, 0xec, 0xab, 0xbf, 0x9b, 0x82,
|
||||
0x52, 0xf8, 0x88, 0x24, 0xfd, 0x04, 0x9c, 0xe4, 0xf7, 0x19, 0x2e, 0xf2, 0x94, 0xdb, 0xba, 0x43,
|
||||
0xb6, 0x4c, 0x4f, 0xa5, 0xe5, 0xcb, 0x5f, 0xb4, 0x59, 0xa6, 0xd5, 0x42, 0xde, 0x33, 0xba, 0x83,
|
||||
0x37, 0x44, 0x4f, 0xf5, 0xa4, 0x35, 0x38, 0x6d, 0x5a, 0x8a, 0xeb, 0xa9, 0x66, 0x5b, 0x75, 0xda,
|
||||
0xca, 0xe0, 0x26, 0x49, 0x51, 0x35, 0x0d, 0xb9, 0xae, 0x45, 0x4b, 0x95, 0xcf, 0xf2, 0x3e, 0xd3,
|
||||
0x6a, 0x31, 0xe5, 0x41, 0x0e, 0xaf, 0x31, 0xd5, 0x48, 0x80, 0xa5, 0x0f, 0x0b, 0xb0, 0x07, 0x21,
|
||||
0xdf, 0x53, 0x6d, 0x05, 0x99, 0x9e, 0xb3, 0x4f, 0x1a, 0xe3, 0x9c, 0x9c, 0xeb, 0xa9, 0x76, 0x03,
|
||||
0x3f, 0xbf, 0x37, 0xe7, 0x93, 0x7f, 0x4c, 0x43, 0x31, 0xd8, 0x1c, 0xe3, 0xb3, 0x86, 0x46, 0xea,
|
||||
0x88, 0x40, 0x32, 0xcd, 0x43, 0x47, 0xb6, 0xd2, 0x4b, 0x75, 0x5c, 0x60, 0xaa, 0xe3, 0xb4, 0x65,
|
||||
0x95, 0x29, 0x12, 0x17, 0x77, 0x9c, 0x5b, 0x10, 0x6d, 0x11, 0x72, 0x32, 0x7b, 0x92, 0x56, 0x61,
|
||||
0xfc, 0x86, 0x4b, 0xb8, 0xc7, 0x09, 0xf7, 0xc3, 0x47, 0x73, 0x3f, 0xdd, 0x22, 0xe4, 0xf9, 0xa7,
|
||||
0x5b, 0xca, 0xc6, 0xa6, 0xbc, 0x5e, 0x5b, 0x93, 0x19, 0x5c, 0x3a, 0x05, 0x19, 0x43, 0xbd, 0xb3,
|
||||
0x1f, 0x2e, 0x45, 0x44, 0x94, 0xd4, 0xf1, 0xa7, 0x20, 0x73, 0x1b, 0xa9, 0x37, 0xc3, 0x05, 0x80,
|
||||
0x88, 0xde, 0xc5, 0xd0, 0x3f, 0x07, 0x59, 0xe2, 0x2f, 0x09, 0x80, 0x79, 0x4c, 0x1c, 0x93, 0x72,
|
||||
0x90, 0xa9, 0x6f, 0xca, 0x38, 0xfc, 0x45, 0x28, 0x52, 0xa9, 0xb2, 0xd5, 0x6c, 0xd4, 0x1b, 0x62,
|
||||
0x6a, 0xe1, 0x22, 0x8c, 0x53, 0x27, 0xe0, 0xad, 0xe1, 0xbb, 0x41, 0x1c, 0x63, 0x8f, 0x8c, 0x43,
|
||||
0xe0, 0xa3, 0x3b, 0xeb, 0xcb, 0x0d, 0x59, 0x4c, 0x05, 0x97, 0xd7, 0x85, 0x62, 0xb0, 0x2f, 0x7e,
|
||||
0x6f, 0x62, 0xea, 0xdb, 0x02, 0x14, 0x02, 0x7d, 0x2e, 0x6e, 0x50, 0x54, 0xc3, 0xb0, 0x6e, 0x2b,
|
||||
0xaa, 0xa1, 0xab, 0x2e, 0x0b, 0x0a, 0x20, 0xa2, 0x1a, 0x96, 0x24, 0x5d, 0xb4, 0xf7, 0xc4, 0xf8,
|
||||
0x97, 0x05, 0x10, 0xa3, 0x2d, 0x66, 0xc4, 0x40, 0xe1, 0xc7, 0x6a, 0xe0, 0x4b, 0x02, 0x94, 0xc2,
|
||||
0x7d, 0x65, 0xc4, 0xbc, 0x33, 0x3f, 0x56, 0xf3, 0x5e, 0x4b, 0xc1, 0x64, 0xa8, 0x9b, 0x4c, 0x6a,
|
||||
0xdd, 0xa7, 0x60, 0x5a, 0x6f, 0xa3, 0x9e, 0x6d, 0x79, 0xc8, 0xd4, 0xf6, 0x15, 0x03, 0xdd, 0x42,
|
||||
0x46, 0x79, 0x81, 0x24, 0x8a, 0x73, 0x47, 0xf7, 0xab, 0x4b, 0xcd, 0x01, 0x6e, 0x0d, 0xc3, 0xaa,
|
||||
0x33, 0xcd, 0x95, 0xc6, 0xfa, 0xd6, 0xe6, 0x76, 0x63, 0xa3, 0x7e, 0x5d, 0xd9, 0xd9, 0xf8, 0xa9,
|
||||
0x8d, 0xcd, 0x67, 0x36, 0x64, 0x51, 0x8f, 0xa8, 0xbd, 0x8b, 0x5b, 0x7d, 0x0b, 0xc4, 0xa8, 0x51,
|
||||
0xd2, 0x49, 0x18, 0x65, 0x96, 0x38, 0x26, 0xcd, 0xc0, 0xd4, 0xc6, 0xa6, 0xd2, 0x6a, 0xae, 0x34,
|
||||
0x94, 0xc6, 0xb5, 0x6b, 0x8d, 0xfa, 0x76, 0x8b, 0xde, 0x40, 0xf8, 0xda, 0xdb, 0xe1, 0x4d, 0xfd,
|
||||
0x62, 0x1a, 0x66, 0x46, 0x58, 0x22, 0xd5, 0xd8, 0xd9, 0x81, 0x1e, 0x67, 0x3e, 0x94, 0xc4, 0xfa,
|
||||
0x25, 0x5c, 0xf2, 0xb7, 0x54, 0xc7, 0x63, 0x47, 0x8d, 0x47, 0x01, 0x7b, 0xc9, 0xf4, 0xf4, 0x8e,
|
||||
0x8e, 0x1c, 0x76, 0x61, 0x43, 0x0f, 0x14, 0x53, 0x03, 0x39, 0xbd, 0xb3, 0xf9, 0x20, 0x48, 0xb6,
|
||||
0xe5, 0xea, 0x9e, 0x7e, 0x0b, 0x29, 0xba, 0xc9, 0x6f, 0x77, 0xf0, 0x01, 0x23, 0x23, 0x8b, 0x7c,
|
||||
0xa4, 0x69, 0x7a, 0xbe, 0xb6, 0x89, 0xba, 0x6a, 0x44, 0x1b, 0x27, 0xf0, 0xb4, 0x2c, 0xf2, 0x11,
|
||||
0x5f, 0xfb, 0x0c, 0x14, 0xdb, 0x56, 0x1f, 0x77, 0x5d, 0x54, 0x0f, 0xd7, 0x0b, 0x41, 0x2e, 0x50,
|
||||
0x99, 0xaf, 0xc2, 0xfa, 0xe9, 0xc1, 0xb5, 0x52, 0x51, 0x2e, 0x50, 0x19, 0x55, 0x39, 0x0b, 0x53,
|
||||
0x6a, 0xb7, 0xeb, 0x60, 0x72, 0x4e, 0x44, 0x4f, 0x08, 0x25, 0x5f, 0x4c, 0x14, 0xe7, 0x9e, 0x86,
|
||||
0x1c, 0xf7, 0x03, 0x2e, 0xc9, 0xd8, 0x13, 0x8a, 0x4d, 0x8f, 0xbd, 0xa9, 0xc5, 0xbc, 0x9c, 0x33,
|
||||
0xf9, 0xe0, 0x19, 0x28, 0xea, 0xae, 0x32, 0xb8, 0x25, 0x4f, 0xcd, 0xa7, 0x16, 0x73, 0x72, 0x41,
|
||||
0x77, 0xfd, 0x1b, 0xc6, 0x85, 0x57, 0x52, 0x50, 0x0a, 0xdf, 0xf2, 0x4b, 0x2b, 0x90, 0x33, 0x2c,
|
||||
0x4d, 0x25, 0xa1, 0x45, 0x3f, 0x31, 0x2d, 0xc6, 0x7c, 0x18, 0x58, 0x5a, 0x63, 0xfa, 0xb2, 0x8f,
|
||||
0x9c, 0xfb, 0x7b, 0x01, 0x72, 0x5c, 0x2c, 0x9d, 0x80, 0x8c, 0xad, 0x7a, 0x7b, 0x84, 0x2e, 0xbb,
|
||||
0x9c, 0x12, 0x05, 0x99, 0x3c, 0x63, 0xb9, 0x6b, 0xab, 0x26, 0x09, 0x01, 0x26, 0xc7, 0xcf, 0x78,
|
||||
0x5d, 0x0d, 0xa4, 0xb6, 0xc9, 0xf1, 0xc3, 0xea, 0xf5, 0x90, 0xe9, 0xb9, 0x7c, 0x5d, 0x99, 0xbc,
|
||||
0xce, 0xc4, 0xd2, 0xe3, 0x30, 0xed, 0x39, 0xaa, 0x6e, 0x84, 0x74, 0x33, 0x44, 0x57, 0xe4, 0x03,
|
||||
0xbe, 0x72, 0x15, 0x4e, 0x71, 0xde, 0x36, 0xf2, 0x54, 0x6d, 0x0f, 0xb5, 0x07, 0xa0, 0x71, 0x72,
|
||||
0xcd, 0x70, 0x92, 0x29, 0xac, 0xb0, 0x71, 0x8e, 0x5d, 0xf8, 0xbe, 0x00, 0xd3, 0xfc, 0xc0, 0xd4,
|
||||
0xf6, 0x9d, 0xb5, 0x0e, 0xa0, 0x9a, 0xa6, 0xe5, 0x05, 0xdd, 0x35, 0x1c, 0xca, 0x43, 0xb8, 0xa5,
|
||||
0x9a, 0x0f, 0x92, 0x03, 0x04, 0x73, 0x3d, 0x80, 0xc1, 0xc8, 0xa1, 0x6e, 0x3b, 0x0d, 0x05, 0xf6,
|
||||
0x09, 0x87, 0x7c, 0x07, 0xa4, 0x47, 0x6c, 0xa0, 0x22, 0x7c, 0xb2, 0x92, 0x66, 0x21, 0xbb, 0x8b,
|
||||
0xba, 0xba, 0xc9, 0x2e, 0x66, 0xe9, 0x03, 0xbf, 0x08, 0xc9, 0xf8, 0x17, 0x21, 0xcb, 0x9f, 0x84,
|
||||
0x19, 0xcd, 0xea, 0x45, 0xcd, 0x5d, 0x16, 0x23, 0xc7, 0x7c, 0xf7, 0x63, 0xc2, 0x73, 0x30, 0x68,
|
||||
0x31, 0xdf, 0x16, 0x84, 0x2f, 0xa6, 0xd2, 0xab, 0x5b, 0xcb, 0x5f, 0x49, 0xcd, 0xad, 0x52, 0xe8,
|
||||
0x16, 0x9f, 0xa9, 0x8c, 0x3a, 0x06, 0xd2, 0xb0, 0xf5, 0xf0, 0xa5, 0xc7, 0xe1, 0x43, 0x5d, 0xdd,
|
||||
0xdb, 0xeb, 0xef, 0x2e, 0x69, 0x56, 0xef, 0x5c, 0xd7, 0xea, 0x5a, 0x83, 0x4f, 0x9f, 0xf8, 0x89,
|
||||
0x3c, 0x90, 0xff, 0xd8, 0xe7, 0xcf, 0xbc, 0x2f, 0x9d, 0x8b, 0xfd, 0x56, 0x5a, 0xdd, 0x80, 0x19,
|
||||
0xa6, 0xac, 0x90, 0xef, 0x2f, 0xf4, 0x14, 0x21, 0x1d, 0x79, 0x87, 0x55, 0xfe, 0xda, 0xeb, 0xa4,
|
||||
0x5c, 0xcb, 0xd3, 0x0c, 0x8a, 0xc7, 0xe8, 0x41, 0xa3, 0x2a, 0xc3, 0x03, 0x21, 0x3e, 0xba, 0x35,
|
||||
0x91, 0x13, 0xc3, 0xf8, 0x5d, 0xc6, 0x38, 0x13, 0x60, 0x6c, 0x31, 0x68, 0xb5, 0x0e, 0x93, 0xc7,
|
||||
0xe1, 0xfa, 0x5b, 0xc6, 0x55, 0x44, 0x41, 0x92, 0x55, 0x98, 0x22, 0x24, 0x5a, 0xdf, 0xf5, 0xac,
|
||||
0x1e, 0xc9, 0x7b, 0x47, 0xd3, 0xfc, 0xdd, 0xeb, 0x74, 0xaf, 0x94, 0x30, 0xac, 0xee, 0xa3, 0xaa,
|
||||
0x55, 0x20, 0x9f, 0x9c, 0xda, 0x48, 0x33, 0x62, 0x18, 0x5e, 0x65, 0x86, 0xf8, 0xfa, 0xd5, 0x4f,
|
||||
0xc0, 0x2c, 0xfe, 0x9f, 0xa4, 0xa5, 0xa0, 0x25, 0xf1, 0x17, 0x5e, 0xe5, 0xef, 0xbf, 0x40, 0xb7,
|
||||
0xe3, 0x8c, 0x4f, 0x10, 0xb0, 0x29, 0xb0, 0x8a, 0x5d, 0xe4, 0x79, 0xc8, 0x71, 0x15, 0xd5, 0x18,
|
||||
0x65, 0x5e, 0xe0, 0xc6, 0xa0, 0xfc, 0xb9, 0x37, 0xc3, 0xab, 0xb8, 0x4a, 0x91, 0x35, 0xc3, 0xa8,
|
||||
0xee, 0xc0, 0xc9, 0x11, 0x51, 0x91, 0x80, 0xf3, 0x45, 0xc6, 0x39, 0x3b, 0x14, 0x19, 0x98, 0x76,
|
||||
0x0b, 0xb8, 0xdc, 0x5f, 0xcb, 0x04, 0x9c, 0xbf, 0xc3, 0x38, 0x25, 0x86, 0xe5, 0x4b, 0x8a, 0x19,
|
||||
0x9f, 0x86, 0xe9, 0x5b, 0xc8, 0xd9, 0xb5, 0x5c, 0x76, 0x4b, 0x93, 0x80, 0xee, 0x25, 0x46, 0x37,
|
||||
0xc5, 0x80, 0xe4, 0xda, 0x06, 0x73, 0x5d, 0x81, 0x5c, 0x47, 0xd5, 0x50, 0x02, 0x8a, 0xcf, 0x33,
|
||||
0x8a, 0x09, 0xac, 0x8f, 0xa1, 0x35, 0x28, 0x76, 0x2d, 0x56, 0x99, 0xe2, 0xe1, 0x2f, 0x33, 0x78,
|
||||
0x81, 0x63, 0x18, 0x85, 0x6d, 0xd9, 0x7d, 0x03, 0x97, 0xad, 0x78, 0x8a, 0xdf, 0xe5, 0x14, 0x1c,
|
||||
0xc3, 0x28, 0x8e, 0xe1, 0xd6, 0xdf, 0xe3, 0x14, 0x6e, 0xc0, 0x9f, 0x4f, 0x41, 0xc1, 0x32, 0x8d,
|
||||
0x7d, 0xcb, 0x4c, 0x62, 0xc4, 0x17, 0x18, 0x03, 0x30, 0x08, 0x26, 0xb8, 0x0a, 0xf9, 0xa4, 0x0b,
|
||||
0xf1, 0x07, 0x6f, 0xf2, 0xed, 0xc1, 0x57, 0x60, 0x15, 0xa6, 0x78, 0x82, 0xd2, 0x2d, 0x33, 0x01,
|
||||
0xc5, 0x97, 0x18, 0x45, 0x29, 0x00, 0x63, 0xd3, 0xf0, 0x90, 0xeb, 0x75, 0x51, 0x12, 0x92, 0x57,
|
||||
0xf8, 0x34, 0x18, 0x84, 0xb9, 0x72, 0x17, 0x99, 0xda, 0x5e, 0x32, 0x86, 0x2f, 0x73, 0x57, 0x72,
|
||||
0x0c, 0xa6, 0xa8, 0xc3, 0x64, 0x4f, 0x75, 0xdc, 0x3d, 0xd5, 0x48, 0xb4, 0x1c, 0x7f, 0xc8, 0x38,
|
||||
0x8a, 0x3e, 0x88, 0x79, 0xa4, 0x6f, 0x1e, 0x87, 0xe6, 0x2b, 0xdc, 0x23, 0x01, 0x18, 0xdb, 0x7a,
|
||||
0xae, 0x47, 0xae, 0xb4, 0x8e, 0xc3, 0xf6, 0x47, 0x7c, 0xeb, 0x51, 0xec, 0x7a, 0x90, 0xf1, 0x2a,
|
||||
0xe4, 0x5d, 0xfd, 0x4e, 0x22, 0x9a, 0x3f, 0xe6, 0x2b, 0x4d, 0x00, 0x18, 0x7c, 0x1d, 0x4e, 0x8d,
|
||||
0x2c, 0x13, 0x09, 0xc8, 0xfe, 0x84, 0x91, 0x9d, 0x18, 0x51, 0x2a, 0x58, 0x4a, 0x38, 0x2e, 0xe5,
|
||||
0x9f, 0xf2, 0x94, 0x80, 0x22, 0x5c, 0x5b, 0xf8, 0xac, 0xe0, 0xaa, 0x9d, 0xe3, 0x79, 0xed, 0xcf,
|
||||
0xb8, 0xd7, 0x28, 0x36, 0xe4, 0xb5, 0x6d, 0x38, 0xc1, 0x18, 0x8f, 0xb7, 0xae, 0x5f, 0xe5, 0x89,
|
||||
0x95, 0xa2, 0x77, 0xc2, 0xab, 0xfb, 0x49, 0x98, 0xf3, 0xdd, 0xc9, 0x9b, 0x52, 0x57, 0xe9, 0xa9,
|
||||
0x76, 0x02, 0xe6, 0xaf, 0x31, 0x66, 0x9e, 0xf1, 0xfd, 0xae, 0xd6, 0x5d, 0x57, 0x6d, 0x4c, 0xfe,
|
||||
0x2c, 0x94, 0x39, 0x79, 0xdf, 0x74, 0x90, 0x66, 0x75, 0x4d, 0xfd, 0x0e, 0x6a, 0x27, 0xa0, 0xfe,
|
||||
0xf3, 0xc8, 0x52, 0xed, 0x04, 0xe0, 0x98, 0xb9, 0x09, 0xa2, 0xdf, 0xab, 0x28, 0x7a, 0xcf, 0xb6,
|
||||
0x1c, 0x2f, 0x86, 0xf1, 0xeb, 0x7c, 0xa5, 0x7c, 0x5c, 0x93, 0xc0, 0xaa, 0x0d, 0x28, 0x91, 0xc7,
|
||||
0xa4, 0x21, 0xf9, 0x17, 0x8c, 0x68, 0x72, 0x80, 0x62, 0x89, 0x43, 0xb3, 0x7a, 0xb6, 0xea, 0x24,
|
||||
0xc9, 0x7f, 0x7f, 0xc9, 0x13, 0x07, 0x83, 0xb0, 0xc4, 0xe1, 0xed, 0xdb, 0x08, 0x57, 0xfb, 0x04,
|
||||
0x0c, 0xdf, 0xe0, 0x89, 0x83, 0x63, 0x18, 0x05, 0x6f, 0x18, 0x12, 0x50, 0xfc, 0x15, 0xa7, 0xe0,
|
||||
0x18, 0x4c, 0xf1, 0xf1, 0x41, 0xa1, 0x75, 0x50, 0x57, 0x77, 0x3d, 0x87, 0xb6, 0xc2, 0x47, 0x53,
|
||||
0x7d, 0xf3, 0xcd, 0x70, 0x13, 0x26, 0x07, 0xa0, 0x38, 0x13, 0xb1, 0x2b, 0x54, 0x72, 0x52, 0x8a,
|
||||
0x37, 0xec, 0x5b, 0x3c, 0x13, 0x05, 0x60, 0xd8, 0xb6, 0x40, 0x87, 0x88, 0xdd, 0xae, 0xe1, 0xf3,
|
||||
0x41, 0x02, 0xba, 0x6f, 0x47, 0x8c, 0x6b, 0x71, 0x2c, 0xe6, 0x0c, 0xf4, 0x3f, 0x7d, 0xf3, 0x26,
|
||||
0xda, 0x4f, 0x14, 0x9d, 0x7f, 0x1d, 0xe9, 0x7f, 0x76, 0x28, 0x92, 0xe6, 0x90, 0xa9, 0x48, 0x3f,
|
||||
0x25, 0xc5, 0xfd, 0x58, 0xa7, 0xfc, 0xb3, 0xf7, 0xd9, 0x7c, 0xc3, 0xed, 0x54, 0x75, 0x0d, 0x07,
|
||||
0x79, 0xb8, 0xe9, 0x89, 0x27, 0x7b, 0xe1, 0xbe, 0x1f, 0xe7, 0xa1, 0x9e, 0xa7, 0x7a, 0x0d, 0x26,
|
||||
0x43, 0x0d, 0x4f, 0x3c, 0xd5, 0xa7, 0x19, 0x55, 0x31, 0xd8, 0xef, 0x54, 0x2f, 0x42, 0x06, 0x37,
|
||||
0x2f, 0xf1, 0xf0, 0x9f, 0x63, 0x70, 0xa2, 0x5e, 0xfd, 0x08, 0xe4, 0x78, 0xd3, 0x12, 0x0f, 0xfd,
|
||||
0x79, 0x06, 0xf5, 0x21, 0x18, 0xce, 0x1b, 0x96, 0x78, 0xf8, 0x2f, 0x70, 0x38, 0x87, 0x60, 0x78,
|
||||
0x72, 0x17, 0x7e, 0xe7, 0x97, 0x32, 0xac, 0xe8, 0x70, 0xdf, 0x5d, 0x85, 0x09, 0xd6, 0xa9, 0xc4,
|
||||
0xa3, 0x3f, 0xc3, 0x5e, 0xce, 0x11, 0xd5, 0x27, 0x21, 0x9b, 0xd0, 0xe1, 0xbf, 0xcc, 0xa0, 0x54,
|
||||
0xbf, 0x5a, 0x87, 0x42, 0xa0, 0x3b, 0x89, 0x87, 0xff, 0x0a, 0x83, 0x07, 0x51, 0xd8, 0x74, 0xd6,
|
||||
0x9d, 0xc4, 0x13, 0xfc, 0x2a, 0x37, 0x9d, 0x21, 0xb0, 0xdb, 0x78, 0x63, 0x12, 0x8f, 0xfe, 0x35,
|
||||
0xee, 0x75, 0x0e, 0xa9, 0x3e, 0x05, 0x79, 0xbf, 0xd8, 0xc4, 0xe3, 0x7f, 0x9d, 0xe1, 0x07, 0x18,
|
||||
0xec, 0x81, 0x40, 0xb1, 0x8b, 0xa7, 0xf8, 0x0d, 0xee, 0x81, 0x00, 0x0a, 0x6f, 0xa3, 0x68, 0x03,
|
||||
0x13, 0xcf, 0xf4, 0x9b, 0x7c, 0x1b, 0x45, 0xfa, 0x17, 0xbc, 0x9a, 0x24, 0xe7, 0xc7, 0x53, 0xfc,
|
||||
0x16, 0x5f, 0x4d, 0xa2, 0x8f, 0xcd, 0x88, 0x76, 0x04, 0xf1, 0x1c, 0xbf, 0xcd, 0xcd, 0x88, 0x34,
|
||||
0x04, 0xd5, 0x2d, 0x90, 0x86, 0xbb, 0x81, 0x78, 0xbe, 0xcf, 0x32, 0xbe, 0xe9, 0xa1, 0x66, 0xa0,
|
||||
0xfa, 0x0c, 0x9c, 0x18, 0xdd, 0x09, 0xc4, 0xb3, 0x7e, 0xee, 0x7e, 0xe4, 0xec, 0x16, 0x6c, 0x04,
|
||||
0xaa, 0xdb, 0x83, 0x92, 0x12, 0xec, 0x02, 0xe2, 0x69, 0x5f, 0xbc, 0x1f, 0x4e, 0xdc, 0xc1, 0x26,
|
||||
0xa0, 0x5a, 0x03, 0x18, 0x14, 0xe0, 0x78, 0xae, 0x97, 0x18, 0x57, 0x00, 0x84, 0xb7, 0x06, 0xab,
|
||||
0xbf, 0xf1, 0xf8, 0xcf, 0xf3, 0xad, 0xc1, 0x10, 0x78, 0x6b, 0xf0, 0xd2, 0x1b, 0x8f, 0x7e, 0x99,
|
||||
0x6f, 0x0d, 0x0e, 0xc1, 0x91, 0x1d, 0xa8, 0x6e, 0xf1, 0x0c, 0x5f, 0xe0, 0x91, 0x1d, 0x40, 0x55,
|
||||
0x37, 0x60, 0x7a, 0xa8, 0x20, 0xc6, 0x53, 0x7d, 0x91, 0x51, 0x89, 0xd1, 0x7a, 0x18, 0x2c, 0x5e,
|
||||
0xac, 0x18, 0xc6, 0xb3, 0xfd, 0x7e, 0xa4, 0x78, 0xb1, 0x5a, 0x58, 0xbd, 0x0a, 0x39, 0xb3, 0x6f,
|
||||
0x18, 0x78, 0xf3, 0x48, 0x47, 0xff, 0xc0, 0xae, 0xfc, 0xaf, 0xef, 0x30, 0xef, 0x70, 0x40, 0xf5,
|
||||
0x22, 0x64, 0x51, 0x6f, 0x17, 0xb5, 0xe3, 0x90, 0xff, 0xf6, 0x0e, 0x4f, 0x98, 0x58, 0xbb, 0xfa,
|
||||
0x14, 0x00, 0xbd, 0x1a, 0x21, 0x9f, 0xfd, 0x62, 0xb0, 0xff, 0xfe, 0x0e, 0xfb, 0xe9, 0xcb, 0x00,
|
||||
0x32, 0x20, 0xa0, 0x3f, 0xa4, 0x39, 0x9a, 0xe0, 0xcd, 0x30, 0x01, 0x59, 0x91, 0x2b, 0x30, 0x71,
|
||||
0xc3, 0xb5, 0x4c, 0x4f, 0xed, 0xc6, 0xa1, 0xff, 0x83, 0xa1, 0xb9, 0x3e, 0x76, 0x58, 0xcf, 0x72,
|
||||
0x90, 0xa7, 0x76, 0xdd, 0x38, 0xec, 0x7f, 0x32, 0xac, 0x0f, 0xc0, 0x60, 0x4d, 0x75, 0xbd, 0x24,
|
||||
0xf3, 0xfe, 0x21, 0x07, 0x73, 0x00, 0x36, 0x1a, 0xff, 0x7f, 0x13, 0xed, 0xc7, 0x61, 0xdf, 0xe2,
|
||||
0x46, 0x33, 0xfd, 0xea, 0x47, 0x20, 0x8f, 0xff, 0xa5, 0xbf, 0x67, 0x8b, 0x01, 0xff, 0x17, 0x03,
|
||||
0x0f, 0x10, 0xf8, 0xcd, 0xae, 0xd7, 0xf6, 0xf4, 0x78, 0x67, 0xff, 0x37, 0x5b, 0x69, 0xae, 0x5f,
|
||||
0xad, 0x41, 0xc1, 0xf5, 0xda, 0xed, 0x3e, 0xeb, 0x4f, 0x63, 0xe0, 0xff, 0xf3, 0x8e, 0x7f, 0x65,
|
||||
0xe1, 0x63, 0xf0, 0x6a, 0xdf, 0xbe, 0xe9, 0xd9, 0x16, 0xf9, 0xcc, 0x11, 0xc7, 0x70, 0x9f, 0x31,
|
||||
0x04, 0x20, 0xcb, 0x8d, 0xd1, 0xd7, 0xb7, 0xb0, 0x6a, 0xad, 0x5a, 0xf4, 0xe2, 0xf6, 0xb9, 0x85,
|
||||
0xf8, 0x1b, 0x58, 0xf8, 0xdf, 0x0c, 0x4c, 0xf9, 0x3e, 0xe1, 0x57, 0xb1, 0xbe, 0x60, 0xee, 0x78,
|
||||
0x97, 0xb8, 0x0b, 0x7f, 0x93, 0x86, 0x5c, 0x5d, 0x75, 0x3d, 0xf5, 0xb6, 0xba, 0x2f, 0xd9, 0x30,
|
||||
0x83, 0xff, 0x5f, 0x57, 0x6d, 0x72, 0x25, 0xc8, 0xf6, 0x2e, 0xbb, 0x27, 0xff, 0xe0, 0xd2, 0xe0,
|
||||
0xad, 0x1c, 0xb1, 0x34, 0x42, 0x9d, 0xfc, 0xbe, 0x60, 0x59, 0x7c, 0xf5, 0x9f, 0x4e, 0x8f, 0xfd,
|
||||
0xe2, 0x3f, 0x9f, 0xce, 0xad, 0xef, 0x3f, 0xa3, 0x1b, 0xae, 0x65, 0xca, 0xa3, 0xa8, 0xa5, 0x4f,
|
||||
0x0b, 0xf0, 0xe0, 0x08, 0xf9, 0x06, 0xdb, 0xda, 0xec, 0x6b, 0xd3, 0x85, 0x84, 0xaf, 0xe6, 0x30,
|
||||
0x6a, 0x42, 0x31, 0xf4, 0xfa, 0xa3, 0x5e, 0x33, 0x77, 0x1d, 0xca, 0x87, 0xcd, 0x44, 0x12, 0x21,
|
||||
0x7d, 0x13, 0xed, 0xb3, 0x1f, 0x29, 0xe2, 0x7f, 0xa5, 0xb3, 0x83, 0x9f, 0x72, 0x0a, 0x8b, 0x85,
|
||||
0xf3, 0xd3, 0x01, 0xeb, 0xd8, 0xcb, 0xe8, 0x78, 0x35, 0x75, 0x59, 0x98, 0x53, 0x61, 0x3e, 0xce,
|
||||
0xd2, 0xff, 0xe7, 0x2b, 0x16, 0x2a, 0x30, 0x4e, 0x85, 0xd2, 0x2c, 0x64, 0x9b, 0xa6, 0x77, 0xe9,
|
||||
0x02, 0xa1, 0x4a, 0xcb, 0xf4, 0x61, 0x79, 0xed, 0xd5, 0x7b, 0x95, 0xb1, 0xef, 0xdd, 0xab, 0x8c,
|
||||
0xfd, 0xc3, 0xbd, 0xca, 0xd8, 0x6b, 0xf7, 0x2a, 0xc2, 0x1b, 0xf7, 0x2a, 0xc2, 0x5b, 0xf7, 0x2a,
|
||||
0xc2, 0xdb, 0xf7, 0x2a, 0xc2, 0xdd, 0x83, 0x8a, 0xf0, 0xe5, 0x83, 0x8a, 0xf0, 0xd5, 0x83, 0x8a,
|
||||
0xf0, 0xcd, 0x83, 0x8a, 0xf0, 0x9d, 0x83, 0x8a, 0xf0, 0xea, 0x41, 0x65, 0xec, 0x7b, 0x07, 0x95,
|
||||
0xb1, 0xd7, 0x0e, 0x2a, 0xc2, 0x1b, 0x07, 0x95, 0xb1, 0xb7, 0x0e, 0x2a, 0xc2, 0xdb, 0x07, 0x95,
|
||||
0xb1, 0xbb, 0x3f, 0xa8, 0x8c, 0xfd, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x42, 0x03, 0x05, 0x0d,
|
||||
0x1b, 0x35, 0x00, 0x00,
|
||||
}
|
||||
r := bytes.NewReader(gzipped)
|
||||
gzipr, err := compress_gzip.NewReader(r)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
ungzipped, err := io_ioutil.ReadAll(gzipr)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if err := github_com_gogo_protobuf_proto.Unmarshal(ungzipped, d); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return d
|
||||
}
|
||||
func (this *Castaway) VerboseEqual(that interface{}) error {
|
||||
if that == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that == nil && this != nil")
|
||||
}
|
||||
|
||||
that1, ok := that.(*Castaway)
|
||||
if !ok {
|
||||
that2, ok := that.(Castaway)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return fmt.Errorf("that is not of type *Castaway")
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that is type *Castaway but is nil && this != nil")
|
||||
} else if this == nil {
|
||||
return fmt.Errorf("that is type *Castaway but is not nil && this == nil")
|
||||
}
|
||||
if len(this.CastMapValueMessage) != len(that1.CastMapValueMessage) {
|
||||
return fmt.Errorf("CastMapValueMessage this(%v) Not Equal that(%v)", len(this.CastMapValueMessage), len(that1.CastMapValueMessage))
|
||||
}
|
||||
for i := range this.CastMapValueMessage {
|
||||
a := (Wilson)(this.CastMapValueMessage[i])
|
||||
b := (Wilson)(that1.CastMapValueMessage[i])
|
||||
if !(&a).Equal(&b) {
|
||||
return fmt.Errorf("CastMapValueMessage this[%v](%v) Not Equal that[%v](%v)", i, this.CastMapValueMessage[i], i, that1.CastMapValueMessage[i])
|
||||
}
|
||||
}
|
||||
if len(this.CastMapValueMessageNullable) != len(that1.CastMapValueMessageNullable) {
|
||||
return fmt.Errorf("CastMapValueMessageNullable this(%v) Not Equal that(%v)", len(this.CastMapValueMessageNullable), len(that1.CastMapValueMessageNullable))
|
||||
}
|
||||
for i := range this.CastMapValueMessageNullable {
|
||||
a := (*Wilson)(this.CastMapValueMessageNullable[i])
|
||||
b := (*Wilson)(that1.CastMapValueMessageNullable[i])
|
||||
if !a.Equal(b) {
|
||||
return fmt.Errorf("CastMapValueMessageNullable this[%v](%v) Not Equal that[%v](%v)", i, this.CastMapValueMessageNullable[i], i, that1.CastMapValueMessageNullable[i])
|
||||
}
|
||||
}
|
||||
if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
|
||||
return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *Castaway) Equal(that interface{}) bool {
|
||||
if that == nil {
|
||||
return this == nil
|
||||
}
|
||||
|
||||
that1, ok := that.(*Castaway)
|
||||
if !ok {
|
||||
that2, ok := that.(Castaway)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
return this == nil
|
||||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
if len(this.CastMapValueMessage) != len(that1.CastMapValueMessage) {
|
||||
return false
|
||||
}
|
||||
for i := range this.CastMapValueMessage {
|
||||
a := (Wilson)(this.CastMapValueMessage[i])
|
||||
b := (Wilson)(that1.CastMapValueMessage[i])
|
||||
if !(&a).Equal(&b) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if len(this.CastMapValueMessageNullable) != len(that1.CastMapValueMessageNullable) {
|
||||
return false
|
||||
}
|
||||
for i := range this.CastMapValueMessageNullable {
|
||||
a := (*Wilson)(this.CastMapValueMessageNullable[i])
|
||||
b := (*Wilson)(that1.CastMapValueMessageNullable[i])
|
||||
if !a.Equal(b) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
func (this *Wilson) VerboseEqual(that interface{}) error {
|
||||
if that == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that == nil && this != nil")
|
||||
}
|
||||
|
||||
that1, ok := that.(*Wilson)
|
||||
if !ok {
|
||||
that2, ok := that.(Wilson)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return fmt.Errorf("that is not of type *Wilson")
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that is type *Wilson but is nil && this != nil")
|
||||
} else if this == nil {
|
||||
return fmt.Errorf("that is type *Wilson but is not nil && this == nil")
|
||||
}
|
||||
if this.Int64 != nil && that1.Int64 != nil {
|
||||
if *this.Int64 != *that1.Int64 {
|
||||
return fmt.Errorf("Int64 this(%v) Not Equal that(%v)", *this.Int64, *that1.Int64)
|
||||
}
|
||||
} else if this.Int64 != nil {
|
||||
return fmt.Errorf("this.Int64 == nil && that.Int64 != nil")
|
||||
} else if that1.Int64 != nil {
|
||||
return fmt.Errorf("Int64 this(%v) Not Equal that(%v)", this.Int64, that1.Int64)
|
||||
}
|
||||
if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
|
||||
return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *Wilson) Equal(that interface{}) bool {
|
||||
if that == nil {
|
||||
return this == nil
|
||||
}
|
||||
|
||||
that1, ok := that.(*Wilson)
|
||||
if !ok {
|
||||
that2, ok := that.(Wilson)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
return this == nil
|
||||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
if this.Int64 != nil && that1.Int64 != nil {
|
||||
if *this.Int64 != *that1.Int64 {
|
||||
return false
|
||||
}
|
||||
} else if this.Int64 != nil {
|
||||
return false
|
||||
} else if that1.Int64 != nil {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
type CastawayFace interface {
|
||||
Proto() github_com_gogo_protobuf_proto.Message
|
||||
GetCastMapValueMessage() map[int32]MyWilson
|
||||
GetCastMapValueMessageNullable() map[int32]*MyWilson
|
||||
}
|
||||
|
||||
func (this *Castaway) Proto() github_com_gogo_protobuf_proto.Message {
|
||||
return this
|
||||
}
|
||||
|
||||
func (this *Castaway) TestProto() github_com_gogo_protobuf_proto.Message {
|
||||
return NewCastawayFromFace(this)
|
||||
}
|
||||
|
||||
func (this *Castaway) GetCastMapValueMessage() map[int32]MyWilson {
|
||||
return this.CastMapValueMessage
|
||||
}
|
||||
|
||||
func (this *Castaway) GetCastMapValueMessageNullable() map[int32]*MyWilson {
|
||||
return this.CastMapValueMessageNullable
|
||||
}
|
||||
|
||||
func NewCastawayFromFace(that CastawayFace) *Castaway {
|
||||
this := &Castaway{}
|
||||
this.CastMapValueMessage = that.GetCastMapValueMessage()
|
||||
this.CastMapValueMessageNullable = that.GetCastMapValueMessageNullable()
|
||||
return this
|
||||
}
|
||||
|
||||
type WilsonFace interface {
|
||||
Proto() github_com_gogo_protobuf_proto.Message
|
||||
GetInt64() *int64
|
||||
}
|
||||
|
||||
func (this *Wilson) Proto() github_com_gogo_protobuf_proto.Message {
|
||||
return this
|
||||
}
|
||||
|
||||
func (this *Wilson) TestProto() github_com_gogo_protobuf_proto.Message {
|
||||
return NewWilsonFromFace(this)
|
||||
}
|
||||
|
||||
func (this *Wilson) GetInt64() *int64 {
|
||||
return this.Int64
|
||||
}
|
||||
|
||||
func NewWilsonFromFace(that WilsonFace) *Wilson {
|
||||
this := &Wilson{}
|
||||
this.Int64 = that.GetInt64()
|
||||
return this
|
||||
}
|
||||
|
||||
func (this *Castaway) GoString() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := make([]string, 0, 6)
|
||||
s = append(s, "&castvalue.Castaway{")
|
||||
keysForCastMapValueMessage := make([]int32, 0, len(this.CastMapValueMessage))
|
||||
for k := range this.CastMapValueMessage {
|
||||
keysForCastMapValueMessage = append(keysForCastMapValueMessage, k)
|
||||
}
|
||||
github_com_gogo_protobuf_sortkeys.Int32s(keysForCastMapValueMessage)
|
||||
mapStringForCastMapValueMessage := "map[int32]MyWilson{"
|
||||
for _, k := range keysForCastMapValueMessage {
|
||||
mapStringForCastMapValueMessage += fmt.Sprintf("%#v: %#v,", k, this.CastMapValueMessage[k])
|
||||
}
|
||||
mapStringForCastMapValueMessage += "}"
|
||||
if this.CastMapValueMessage != nil {
|
||||
s = append(s, "CastMapValueMessage: "+mapStringForCastMapValueMessage+",\n")
|
||||
}
|
||||
keysForCastMapValueMessageNullable := make([]int32, 0, len(this.CastMapValueMessageNullable))
|
||||
for k := range this.CastMapValueMessageNullable {
|
||||
keysForCastMapValueMessageNullable = append(keysForCastMapValueMessageNullable, k)
|
||||
}
|
||||
github_com_gogo_protobuf_sortkeys.Int32s(keysForCastMapValueMessageNullable)
|
||||
mapStringForCastMapValueMessageNullable := "map[int32]*MyWilson{"
|
||||
for _, k := range keysForCastMapValueMessageNullable {
|
||||
mapStringForCastMapValueMessageNullable += fmt.Sprintf("%#v: %#v,", k, this.CastMapValueMessageNullable[k])
|
||||
}
|
||||
mapStringForCastMapValueMessageNullable += "}"
|
||||
if this.CastMapValueMessageNullable != nil {
|
||||
s = append(s, "CastMapValueMessageNullable: "+mapStringForCastMapValueMessageNullable+",\n")
|
||||
}
|
||||
if this.XXX_unrecognized != nil {
|
||||
s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
|
||||
}
|
||||
s = append(s, "}")
|
||||
return strings.Join(s, "")
|
||||
}
|
||||
func (this *Wilson) GoString() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := make([]string, 0, 5)
|
||||
s = append(s, "&castvalue.Wilson{")
|
||||
if this.Int64 != nil {
|
||||
s = append(s, "Int64: "+valueToGoStringCastvalue(this.Int64, "int64")+",\n")
|
||||
}
|
||||
if this.XXX_unrecognized != nil {
|
||||
s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
|
||||
}
|
||||
s = append(s, "}")
|
||||
return strings.Join(s, "")
|
||||
}
|
||||
func valueToGoStringCastvalue(v interface{}, typ string) string {
|
||||
rv := reflect.ValueOf(v)
|
||||
if rv.IsNil() {
|
||||
return "nil"
|
||||
}
|
||||
pv := reflect.Indirect(rv).Interface()
|
||||
return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
|
||||
}
|
||||
func NewPopulatedCastaway(r randyCastvalue, easy bool) *Castaway {
|
||||
this := &Castaway{}
|
||||
if r.Intn(10) != 0 {
|
||||
v1 := r.Intn(10)
|
||||
this.CastMapValueMessage = make(map[int32]MyWilson)
|
||||
for i := 0; i < v1; i++ {
|
||||
this.CastMapValueMessage[int32(r.Int31())] = (MyWilson)(*NewPopulatedWilson(r, easy))
|
||||
}
|
||||
}
|
||||
if r.Intn(10) != 0 {
|
||||
v2 := r.Intn(10)
|
||||
this.CastMapValueMessageNullable = make(map[int32]*MyWilson)
|
||||
for i := 0; i < v2; i++ {
|
||||
this.CastMapValueMessageNullable[int32(r.Int31())] = (*MyWilson)(NewPopulatedWilson(r, easy))
|
||||
}
|
||||
}
|
||||
if !easy && r.Intn(10) != 0 {
|
||||
this.XXX_unrecognized = randUnrecognizedCastvalue(r, 3)
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
func NewPopulatedWilson(r randyCastvalue, easy bool) *Wilson {
|
||||
this := &Wilson{}
|
||||
if r.Intn(10) != 0 {
|
||||
v3 := int64(r.Int63())
|
||||
if r.Intn(2) == 0 {
|
||||
v3 *= -1
|
||||
}
|
||||
this.Int64 = &v3
|
||||
}
|
||||
if !easy && r.Intn(10) != 0 {
|
||||
this.XXX_unrecognized = randUnrecognizedCastvalue(r, 2)
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
type randyCastvalue interface {
|
||||
Float32() float32
|
||||
Float64() float64
|
||||
Int63() int64
|
||||
Int31() int32
|
||||
Uint32() uint32
|
||||
Intn(n int) int
|
||||
}
|
||||
|
||||
func randUTF8RuneCastvalue(r randyCastvalue) rune {
|
||||
ru := r.Intn(62)
|
||||
if ru < 10 {
|
||||
return rune(ru + 48)
|
||||
} else if ru < 36 {
|
||||
return rune(ru + 55)
|
||||
}
|
||||
return rune(ru + 61)
|
||||
}
|
||||
func randStringCastvalue(r randyCastvalue) string {
|
||||
v4 := r.Intn(100)
|
||||
tmps := make([]rune, v4)
|
||||
for i := 0; i < v4; i++ {
|
||||
tmps[i] = randUTF8RuneCastvalue(r)
|
||||
}
|
||||
return string(tmps)
|
||||
}
|
||||
func randUnrecognizedCastvalue(r randyCastvalue, maxFieldNumber int) (dAtA []byte) {
|
||||
l := r.Intn(5)
|
||||
for i := 0; i < l; i++ {
|
||||
wire := r.Intn(4)
|
||||
if wire == 3 {
|
||||
wire = 5
|
||||
}
|
||||
fieldNumber := maxFieldNumber + r.Intn(100)
|
||||
dAtA = randFieldCastvalue(dAtA, r, fieldNumber, wire)
|
||||
}
|
||||
return dAtA
|
||||
}
|
||||
func randFieldCastvalue(dAtA []byte, r randyCastvalue, fieldNumber int, wire int) []byte {
|
||||
key := uint32(fieldNumber)<<3 | uint32(wire)
|
||||
switch wire {
|
||||
case 0:
|
||||
dAtA = encodeVarintPopulateCastvalue(dAtA, uint64(key))
|
||||
v5 := r.Int63()
|
||||
if r.Intn(2) == 0 {
|
||||
v5 *= -1
|
||||
}
|
||||
dAtA = encodeVarintPopulateCastvalue(dAtA, uint64(v5))
|
||||
case 1:
|
||||
dAtA = encodeVarintPopulateCastvalue(dAtA, uint64(key))
|
||||
dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
|
||||
case 2:
|
||||
dAtA = encodeVarintPopulateCastvalue(dAtA, uint64(key))
|
||||
ll := r.Intn(100)
|
||||
dAtA = encodeVarintPopulateCastvalue(dAtA, uint64(ll))
|
||||
for j := 0; j < ll; j++ {
|
||||
dAtA = append(dAtA, byte(r.Intn(256)))
|
||||
}
|
||||
default:
|
||||
dAtA = encodeVarintPopulateCastvalue(dAtA, uint64(key))
|
||||
dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
|
||||
}
|
||||
return dAtA
|
||||
}
|
||||
func encodeVarintPopulateCastvalue(dAtA []byte, v uint64) []byte {
|
||||
for v >= 1<<7 {
|
||||
dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80))
|
||||
v >>= 7
|
||||
}
|
||||
dAtA = append(dAtA, uint8(v))
|
||||
return dAtA
|
||||
}
|
||||
func (m *Castaway) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if len(m.CastMapValueMessage) > 0 {
|
||||
for k, v := range m.CastMapValueMessage {
|
||||
_ = k
|
||||
_ = v
|
||||
l = ((*Wilson)(&v)).Size()
|
||||
mapEntrySize := 1 + sovCastvalue(uint64(k)) + 1 + l + sovCastvalue(uint64(l))
|
||||
n += mapEntrySize + 1 + sovCastvalue(uint64(mapEntrySize))
|
||||
}
|
||||
}
|
||||
if len(m.CastMapValueMessageNullable) > 0 {
|
||||
for k, v := range m.CastMapValueMessageNullable {
|
||||
_ = k
|
||||
_ = v
|
||||
l = 0
|
||||
if v != nil {
|
||||
l = ((*Wilson)(v)).Size()
|
||||
l += 1 + sovCastvalue(uint64(l))
|
||||
}
|
||||
mapEntrySize := 1 + sovCastvalue(uint64(k)) + l
|
||||
n += mapEntrySize + 1 + sovCastvalue(uint64(mapEntrySize))
|
||||
}
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func (m *Wilson) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.Int64 != nil {
|
||||
n += 1 + sovCastvalue(uint64(*m.Int64))
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovCastvalue(x uint64) (n int) {
|
||||
for {
|
||||
n++
|
||||
x >>= 7
|
||||
if x == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
func sozCastvalue(x uint64) (n int) {
|
||||
return sovCastvalue(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (this *Castaway) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
keysForCastMapValueMessage := make([]int32, 0, len(this.CastMapValueMessage))
|
||||
for k := range this.CastMapValueMessage {
|
||||
keysForCastMapValueMessage = append(keysForCastMapValueMessage, k)
|
||||
}
|
||||
github_com_gogo_protobuf_sortkeys.Int32s(keysForCastMapValueMessage)
|
||||
mapStringForCastMapValueMessage := "map[int32]MyWilson{"
|
||||
for _, k := range keysForCastMapValueMessage {
|
||||
mapStringForCastMapValueMessage += fmt.Sprintf("%v: %v,", k, this.CastMapValueMessage[k])
|
||||
}
|
||||
mapStringForCastMapValueMessage += "}"
|
||||
keysForCastMapValueMessageNullable := make([]int32, 0, len(this.CastMapValueMessageNullable))
|
||||
for k := range this.CastMapValueMessageNullable {
|
||||
keysForCastMapValueMessageNullable = append(keysForCastMapValueMessageNullable, k)
|
||||
}
|
||||
github_com_gogo_protobuf_sortkeys.Int32s(keysForCastMapValueMessageNullable)
|
||||
mapStringForCastMapValueMessageNullable := "map[int32]*MyWilson{"
|
||||
for _, k := range keysForCastMapValueMessageNullable {
|
||||
mapStringForCastMapValueMessageNullable += fmt.Sprintf("%v: %v,", k, this.CastMapValueMessageNullable[k])
|
||||
}
|
||||
mapStringForCastMapValueMessageNullable += "}"
|
||||
s := strings.Join([]string{`&Castaway{`,
|
||||
`CastMapValueMessage:` + mapStringForCastMapValueMessage + `,`,
|
||||
`CastMapValueMessageNullable:` + mapStringForCastMapValueMessageNullable + `,`,
|
||||
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
return s
|
||||
}
|
||||
func (this *Wilson) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := strings.Join([]string{`&Wilson{`,
|
||||
`Int64:` + valueToStringCastvalue(this.Int64) + `,`,
|
||||
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
return s
|
||||
}
|
||||
func valueToStringCastvalue(v interface{}) string {
|
||||
rv := reflect.ValueOf(v)
|
||||
if rv.IsNil() {
|
||||
return "nil"
|
||||
}
|
||||
pv := reflect.Indirect(rv).Interface()
|
||||
return fmt.Sprintf("*%v", pv)
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("castvalue.proto", fileDescriptor_castvalue_87404b9a479f5489) }
|
||||
|
||||
var fileDescriptor_castvalue_87404b9a479f5489 = []byte{
|
||||
// 342 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4f, 0x4e, 0x2c, 0x2e,
|
||||
0x29, 0x4b, 0xcc, 0x29, 0x4d, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x84, 0x0b, 0x48,
|
||||
0xe9, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0xa7, 0xe7, 0xa7, 0xe7,
|
||||
0xeb, 0x83, 0x55, 0x24, 0x95, 0xa6, 0x81, 0x79, 0x60, 0x0e, 0x98, 0x05, 0xd1, 0xa9, 0x74, 0x90,
|
||||
0x99, 0x8b, 0xc3, 0x39, 0xb1, 0xb8, 0x24, 0xb1, 0x3c, 0xb1, 0x52, 0xa8, 0x80, 0x4b, 0x18, 0xc4,
|
||||
0xf6, 0x4d, 0x2c, 0x08, 0x03, 0x99, 0xe5, 0x9b, 0x5a, 0x5c, 0x9c, 0x98, 0x9e, 0x2a, 0xc1, 0xa8,
|
||||
0xc0, 0xac, 0xc1, 0x6d, 0xa4, 0xa3, 0x87, 0xb0, 0x15, 0xa6, 0x43, 0x0f, 0x8b, 0x72, 0xd7, 0xbc,
|
||||
0x92, 0xa2, 0x4a, 0x27, 0x81, 0x13, 0xf7, 0xe4, 0x19, 0xba, 0xee, 0xcb, 0x73, 0xf8, 0x56, 0x86,
|
||||
0x67, 0xe6, 0x14, 0xe7, 0xe7, 0x05, 0x61, 0x33, 0x5a, 0xa8, 0x85, 0x91, 0x4b, 0x1a, 0x8b, 0xb8,
|
||||
0x5f, 0x69, 0x4e, 0x4e, 0x62, 0x52, 0x4e, 0xaa, 0x04, 0x13, 0xd8, 0x6a, 0x13, 0x22, 0xad, 0x86,
|
||||
0x69, 0x83, 0x38, 0x81, 0x07, 0xc5, 0x7a, 0x7c, 0xd6, 0x48, 0x45, 0x72, 0x49, 0xe0, 0xf2, 0x89,
|
||||
0x90, 0x00, 0x17, 0x73, 0x76, 0x6a, 0xa5, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x6b, 0x10, 0x88, 0x29,
|
||||
0xa4, 0xce, 0xc5, 0x0a, 0x76, 0x8b, 0x04, 0x93, 0x02, 0xa3, 0x06, 0xb7, 0x91, 0x20, 0x92, 0xeb,
|
||||
0xa0, 0x96, 0x41, 0xe4, 0xad, 0x98, 0x2c, 0x18, 0xa5, 0x12, 0xb9, 0x14, 0x08, 0xb9, 0x94, 0x42,
|
||||
0x2b, 0x94, 0xe4, 0xb8, 0xd8, 0x20, 0x82, 0x42, 0x22, 0x5c, 0xac, 0x9e, 0x79, 0x25, 0x66, 0x26,
|
||||
0x60, 0xa3, 0x98, 0x83, 0x20, 0x1c, 0x27, 0x9f, 0x13, 0x0f, 0xe5, 0x18, 0x2e, 0x3c, 0x94, 0x63,
|
||||
0xb8, 0xf1, 0x50, 0x8e, 0xe1, 0xc1, 0x43, 0x39, 0xc6, 0x17, 0x0f, 0xe5, 0x18, 0x3f, 0x3c, 0x94,
|
||||
0x63, 0xfc, 0xf1, 0x50, 0x8e, 0xb1, 0xe1, 0x91, 0x1c, 0xe3, 0x8a, 0x47, 0x72, 0x8c, 0x1b, 0x1e,
|
||||
0xc9, 0x31, 0xee, 0x78, 0x24, 0xc7, 0x78, 0xe0, 0x91, 0x1c, 0xe3, 0x89, 0x47, 0x72, 0x0c, 0x17,
|
||||
0x1e, 0xc9, 0x31, 0x3c, 0x78, 0x24, 0xc7, 0xf8, 0xe2, 0x91, 0x1c, 0xc3, 0x87, 0x47, 0x72, 0x8c,
|
||||
0x3f, 0x1e, 0xc9, 0x31, 0x34, 0x3c, 0x96, 0x63, 0x00, 0x04, 0x00, 0x00, 0xff, 0xff, 0x7b, 0x8b,
|
||||
0x19, 0x68, 0x7d, 0x02, 0x00, 0x00,
|
||||
}
|
66
vendor/github.com/gogo/protobuf/test/castvalue/castvalue.proto
generated
vendored
Normal file
66
vendor/github.com/gogo/protobuf/test/castvalue/castvalue.proto
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2015, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package castvalue;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.goproto_stringer_all) = false;
|
||||
option (gogoproto.goproto_enum_prefix_all) = false;
|
||||
option (gogoproto.goproto_getters_all) = false;
|
||||
|
||||
option (gogoproto.equal_all) = true;
|
||||
option (gogoproto.verbose_equal_all) = true;
|
||||
option (gogoproto.stringer_all) = true;
|
||||
option (gogoproto.gostring_all) = true;
|
||||
option (gogoproto.face_all) = true;
|
||||
option (gogoproto.description_all) = true;
|
||||
|
||||
option (gogoproto.testgen_all) = true;
|
||||
option (gogoproto.populate_all) = true;
|
||||
option (gogoproto.benchgen_all) = true;
|
||||
option (gogoproto.unmarshaler_all) = false;
|
||||
option (gogoproto.marshaler_all) = false;
|
||||
option (gogoproto.sizer_all) = true;
|
||||
|
||||
option (gogoproto.goproto_enum_stringer_all) = false;
|
||||
option (gogoproto.enum_stringer_all) = true;
|
||||
|
||||
option (gogoproto.unsafe_marshaler_all) = false;
|
||||
option (gogoproto.unsafe_unmarshaler_all) = false;
|
||||
|
||||
message Castaway {
|
||||
map<int32,Wilson> CastMapValueMessage = 1 [(gogoproto.castvalue) = "MyWilson", (gogoproto.nullable) = false];
|
||||
map<int32,Wilson> CastMapValueMessageNullable = 2 [(gogoproto.castvalue) = "MyWilson"];
|
||||
}
|
||||
|
||||
message Wilson {
|
||||
optional int64 Int64 = 1;
|
||||
}
|
446
vendor/github.com/gogo/protobuf/test/castvalue/castvaluepb_test.go
generated
vendored
Normal file
446
vendor/github.com/gogo/protobuf/test/castvalue/castvaluepb_test.go
generated
vendored
Normal file
@ -0,0 +1,446 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: castvalue.proto
|
||||
|
||||
package castvalue
|
||||
|
||||
import testing "testing"
|
||||
import math_rand "math/rand"
|
||||
import time "time"
|
||||
import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
|
||||
import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb"
|
||||
import fmt "fmt"
|
||||
import go_parser "go/parser"
|
||||
import proto "github.com/gogo/protobuf/proto"
|
||||
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 TestCastawayProto(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
if err := github_com_gogo_protobuf_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
|
||||
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkCastawayProtoMarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Castaway, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
pops[i] = NewPopulatedCastaway(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
total += len(dAtA)
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func BenchmarkCastawayProtoUnmarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
datas := make([][]byte, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedCastaway(popr, false))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
datas[i] = dAtA
|
||||
}
|
||||
msg := &Castaway{}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += len(datas[i%10000])
|
||||
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestWilsonProto(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
if err := github_com_gogo_protobuf_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
|
||||
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkWilsonProtoMarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Wilson, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
pops[i] = NewPopulatedWilson(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
total += len(dAtA)
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func BenchmarkWilsonProtoUnmarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
datas := make([][]byte, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedWilson(popr, false))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
datas[i] = dAtA
|
||||
}
|
||||
msg := &Wilson{}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += len(datas[i%10000])
|
||||
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestCastawayJSON(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
||||
jsondata, err := marshaler.MarshalToString(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
err = github_com_gogo_protobuf_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 TestWilsonJSON(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
||||
jsondata, err := marshaler.MarshalToString(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
err = github_com_gogo_protobuf_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 TestCastawayProtoText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
||||
msg := &Castaway{}
|
||||
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("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 TestCastawayProtoCompactText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
||||
msg := &Castaway{}
|
||||
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("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 TestWilsonProtoText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
||||
msg := &Wilson{}
|
||||
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("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 TestWilsonProtoCompactText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
||||
msg := &Wilson{}
|
||||
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("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 TestCastvalueDescription(t *testing.T) {
|
||||
CastvalueDescription()
|
||||
}
|
||||
func TestCastawayVerboseEqual(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
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 TestWilsonVerboseEqual(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
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 TestCastawayFace(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
msg := p.TestProto()
|
||||
if !p.Equal(msg) {
|
||||
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
||||
}
|
||||
}
|
||||
func TestWilsonFace(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
msg := p.TestProto()
|
||||
if !p.Equal(msg) {
|
||||
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
||||
}
|
||||
}
|
||||
func TestCastawayGoString(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
s1 := p.GoString()
|
||||
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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
func TestWilsonGoString(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
s1 := p.GoString()
|
||||
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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
func TestCastawaySize(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
size2 := github_com_gogo_protobuf_proto.Size(p)
|
||||
dAtA, err := github_com_gogo_protobuf_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 := github_com_gogo_protobuf_proto.Size(p)
|
||||
if size3 != size {
|
||||
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkCastawaySize(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Castaway, 1000)
|
||||
for i := 0; i < 1000; i++ {
|
||||
pops[i] = NewPopulatedCastaway(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += pops[i%1000].Size()
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestWilsonSize(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
size2 := github_com_gogo_protobuf_proto.Size(p)
|
||||
dAtA, err := github_com_gogo_protobuf_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 := github_com_gogo_protobuf_proto.Size(p)
|
||||
if size3 != size {
|
||||
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkWilsonSize(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Wilson, 1000)
|
||||
for i := 0; i < 1000; i++ {
|
||||
pops[i] = NewPopulatedWilson(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += pops[i%1000].Size()
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestCastawayStringer(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
s1 := p.String()
|
||||
s2 := fmt.Sprintf("%v", p)
|
||||
if s1 != s2 {
|
||||
t.Fatalf("String want %v got %v", s1, s2)
|
||||
}
|
||||
}
|
||||
func TestWilsonStringer(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(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
|
1485
vendor/github.com/gogo/protobuf/test/castvalue/combos/both/castvalue.pb.go
generated
vendored
Normal file
1485
vendor/github.com/gogo/protobuf/test/castvalue/combos/both/castvalue.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
66
vendor/github.com/gogo/protobuf/test/castvalue/combos/both/castvalue.proto
generated
vendored
Normal file
66
vendor/github.com/gogo/protobuf/test/castvalue/combos/both/castvalue.proto
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2015, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package castvalue;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.goproto_stringer_all) = false;
|
||||
option (gogoproto.goproto_enum_prefix_all) = false;
|
||||
option (gogoproto.goproto_getters_all) = false;
|
||||
|
||||
option (gogoproto.equal_all) = true;
|
||||
option (gogoproto.verbose_equal_all) = true;
|
||||
option (gogoproto.stringer_all) = true;
|
||||
option (gogoproto.gostring_all) = true;
|
||||
option (gogoproto.face_all) = true;
|
||||
option (gogoproto.description_all) = true;
|
||||
|
||||
option (gogoproto.testgen_all) = true;
|
||||
option (gogoproto.populate_all) = true;
|
||||
option (gogoproto.benchgen_all) = true;
|
||||
option (gogoproto.unmarshaler_all) = true;
|
||||
option (gogoproto.marshaler_all) = true;
|
||||
option (gogoproto.sizer_all) = true;
|
||||
|
||||
option (gogoproto.goproto_enum_stringer_all) = false;
|
||||
option (gogoproto.enum_stringer_all) = true;
|
||||
|
||||
option (gogoproto.unsafe_marshaler_all) = false;
|
||||
option (gogoproto.unsafe_unmarshaler_all) = false;
|
||||
|
||||
message Castaway {
|
||||
map<int32,Wilson> CastMapValueMessage = 1 [(gogoproto.castvalue) = "MyWilson", (gogoproto.nullable) = false];
|
||||
map<int32,Wilson> CastMapValueMessageNullable = 2 [(gogoproto.castvalue) = "MyWilson"];
|
||||
}
|
||||
|
||||
message Wilson {
|
||||
optional int64 Int64 = 1;
|
||||
}
|
502
vendor/github.com/gogo/protobuf/test/castvalue/combos/both/castvaluepb_test.go
generated
vendored
Normal file
502
vendor/github.com/gogo/protobuf/test/castvalue/combos/both/castvaluepb_test.go
generated
vendored
Normal file
@ -0,0 +1,502 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: combos/both/castvalue.proto
|
||||
|
||||
package castvalue
|
||||
|
||||
import testing "testing"
|
||||
import math_rand "math/rand"
|
||||
import time "time"
|
||||
import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
|
||||
import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb"
|
||||
import fmt "fmt"
|
||||
import go_parser "go/parser"
|
||||
import proto "github.com/gogo/protobuf/proto"
|
||||
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 TestCastawayProto(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
if err := github_com_gogo_protobuf_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
|
||||
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCastawayMarshalTo(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(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 := &Castaway{}
|
||||
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))
|
||||
}
|
||||
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 BenchmarkCastawayProtoMarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Castaway, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
pops[i] = NewPopulatedCastaway(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
total += len(dAtA)
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func BenchmarkCastawayProtoUnmarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
datas := make([][]byte, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedCastaway(popr, false))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
datas[i] = dAtA
|
||||
}
|
||||
msg := &Castaway{}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += len(datas[i%10000])
|
||||
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestWilsonProto(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
if err := github_com_gogo_protobuf_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
|
||||
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWilsonMarshalTo(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(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 := &Wilson{}
|
||||
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))
|
||||
}
|
||||
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 BenchmarkWilsonProtoMarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Wilson, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
pops[i] = NewPopulatedWilson(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
total += len(dAtA)
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func BenchmarkWilsonProtoUnmarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
datas := make([][]byte, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedWilson(popr, false))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
datas[i] = dAtA
|
||||
}
|
||||
msg := &Wilson{}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += len(datas[i%10000])
|
||||
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestCastawayJSON(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
||||
jsondata, err := marshaler.MarshalToString(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
err = github_com_gogo_protobuf_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 TestWilsonJSON(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
||||
jsondata, err := marshaler.MarshalToString(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
err = github_com_gogo_protobuf_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 TestCastawayProtoText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
||||
msg := &Castaway{}
|
||||
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("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 TestCastawayProtoCompactText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
||||
msg := &Castaway{}
|
||||
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("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 TestWilsonProtoText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
||||
msg := &Wilson{}
|
||||
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("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 TestWilsonProtoCompactText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
||||
msg := &Wilson{}
|
||||
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("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 TestCastvalueDescription(t *testing.T) {
|
||||
CastvalueDescription()
|
||||
}
|
||||
func TestCastawayVerboseEqual(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
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 TestWilsonVerboseEqual(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
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 TestCastawayFace(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
msg := p.TestProto()
|
||||
if !p.Equal(msg) {
|
||||
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
||||
}
|
||||
}
|
||||
func TestWilsonFace(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
msg := p.TestProto()
|
||||
if !p.Equal(msg) {
|
||||
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
||||
}
|
||||
}
|
||||
func TestCastawayGoString(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
s1 := p.GoString()
|
||||
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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
func TestWilsonGoString(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
s1 := p.GoString()
|
||||
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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
func TestCastawaySize(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
size2 := github_com_gogo_protobuf_proto.Size(p)
|
||||
dAtA, err := github_com_gogo_protobuf_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 := github_com_gogo_protobuf_proto.Size(p)
|
||||
if size3 != size {
|
||||
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkCastawaySize(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Castaway, 1000)
|
||||
for i := 0; i < 1000; i++ {
|
||||
pops[i] = NewPopulatedCastaway(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += pops[i%1000].Size()
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestWilsonSize(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
size2 := github_com_gogo_protobuf_proto.Size(p)
|
||||
dAtA, err := github_com_gogo_protobuf_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 := github_com_gogo_protobuf_proto.Size(p)
|
||||
if size3 != size {
|
||||
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkWilsonSize(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Wilson, 1000)
|
||||
for i := 0; i < 1000; i++ {
|
||||
pops[i] = NewPopulatedWilson(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += pops[i%1000].Size()
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestCastawayStringer(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
s1 := p.String()
|
||||
s2 := fmt.Sprintf("%v", p)
|
||||
if s1 != s2 {
|
||||
t.Fatalf("String want %v got %v", s1, s2)
|
||||
}
|
||||
}
|
||||
func TestWilsonStringer(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(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
|
31
vendor/github.com/gogo/protobuf/test/castvalue/combos/both/mytypes.go
generated
vendored
Normal file
31
vendor/github.com/gogo/protobuf/test/castvalue/combos/both/mytypes.go
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package castvalue
|
||||
|
||||
type MyWilson Wilson
|
1033
vendor/github.com/gogo/protobuf/test/castvalue/combos/marshaler/castvalue.pb.go
generated
vendored
Normal file
1033
vendor/github.com/gogo/protobuf/test/castvalue/combos/marshaler/castvalue.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
66
vendor/github.com/gogo/protobuf/test/castvalue/combos/marshaler/castvalue.proto
generated
vendored
Normal file
66
vendor/github.com/gogo/protobuf/test/castvalue/combos/marshaler/castvalue.proto
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2015, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package castvalue;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.goproto_stringer_all) = false;
|
||||
option (gogoproto.goproto_enum_prefix_all) = false;
|
||||
option (gogoproto.goproto_getters_all) = false;
|
||||
|
||||
option (gogoproto.equal_all) = true;
|
||||
option (gogoproto.verbose_equal_all) = true;
|
||||
option (gogoproto.stringer_all) = true;
|
||||
option (gogoproto.gostring_all) = true;
|
||||
option (gogoproto.face_all) = true;
|
||||
option (gogoproto.description_all) = true;
|
||||
|
||||
option (gogoproto.testgen_all) = true;
|
||||
option (gogoproto.populate_all) = true;
|
||||
option (gogoproto.benchgen_all) = true;
|
||||
option (gogoproto.unmarshaler_all) = false;
|
||||
option (gogoproto.marshaler_all) = true;
|
||||
option (gogoproto.sizer_all) = true;
|
||||
|
||||
option (gogoproto.goproto_enum_stringer_all) = false;
|
||||
option (gogoproto.enum_stringer_all) = true;
|
||||
|
||||
option (gogoproto.unsafe_marshaler_all) = false;
|
||||
option (gogoproto.unsafe_unmarshaler_all) = false;
|
||||
|
||||
message Castaway {
|
||||
map<int32,Wilson> CastMapValueMessage = 1 [(gogoproto.castvalue) = "MyWilson", (gogoproto.nullable) = false];
|
||||
map<int32,Wilson> CastMapValueMessageNullable = 2 [(gogoproto.castvalue) = "MyWilson"];
|
||||
}
|
||||
|
||||
message Wilson {
|
||||
optional int64 Int64 = 1;
|
||||
}
|
502
vendor/github.com/gogo/protobuf/test/castvalue/combos/marshaler/castvaluepb_test.go
generated
vendored
Normal file
502
vendor/github.com/gogo/protobuf/test/castvalue/combos/marshaler/castvaluepb_test.go
generated
vendored
Normal file
@ -0,0 +1,502 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: combos/marshaler/castvalue.proto
|
||||
|
||||
package castvalue
|
||||
|
||||
import testing "testing"
|
||||
import math_rand "math/rand"
|
||||
import time "time"
|
||||
import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
|
||||
import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb"
|
||||
import fmt "fmt"
|
||||
import go_parser "go/parser"
|
||||
import proto "github.com/gogo/protobuf/proto"
|
||||
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 TestCastawayProto(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
if err := github_com_gogo_protobuf_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
|
||||
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCastawayMarshalTo(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(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 := &Castaway{}
|
||||
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))
|
||||
}
|
||||
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 BenchmarkCastawayProtoMarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Castaway, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
pops[i] = NewPopulatedCastaway(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
total += len(dAtA)
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func BenchmarkCastawayProtoUnmarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
datas := make([][]byte, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedCastaway(popr, false))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
datas[i] = dAtA
|
||||
}
|
||||
msg := &Castaway{}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += len(datas[i%10000])
|
||||
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestWilsonProto(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
if err := github_com_gogo_protobuf_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
|
||||
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func TestWilsonMarshalTo(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(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 := &Wilson{}
|
||||
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))
|
||||
}
|
||||
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 BenchmarkWilsonProtoMarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Wilson, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
pops[i] = NewPopulatedWilson(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
total += len(dAtA)
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func BenchmarkWilsonProtoUnmarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
datas := make([][]byte, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedWilson(popr, false))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
datas[i] = dAtA
|
||||
}
|
||||
msg := &Wilson{}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += len(datas[i%10000])
|
||||
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestCastawayJSON(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
||||
jsondata, err := marshaler.MarshalToString(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
err = github_com_gogo_protobuf_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 TestWilsonJSON(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
||||
jsondata, err := marshaler.MarshalToString(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
err = github_com_gogo_protobuf_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 TestCastawayProtoText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
||||
msg := &Castaway{}
|
||||
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("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 TestCastawayProtoCompactText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
||||
msg := &Castaway{}
|
||||
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("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 TestWilsonProtoText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
||||
msg := &Wilson{}
|
||||
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("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 TestWilsonProtoCompactText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
||||
msg := &Wilson{}
|
||||
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("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 TestCastvalueDescription(t *testing.T) {
|
||||
CastvalueDescription()
|
||||
}
|
||||
func TestCastawayVerboseEqual(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
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 TestWilsonVerboseEqual(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
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 TestCastawayFace(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
msg := p.TestProto()
|
||||
if !p.Equal(msg) {
|
||||
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
||||
}
|
||||
}
|
||||
func TestWilsonFace(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
msg := p.TestProto()
|
||||
if !p.Equal(msg) {
|
||||
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
||||
}
|
||||
}
|
||||
func TestCastawayGoString(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
s1 := p.GoString()
|
||||
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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
func TestWilsonGoString(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
s1 := p.GoString()
|
||||
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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
func TestCastawaySize(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
size2 := github_com_gogo_protobuf_proto.Size(p)
|
||||
dAtA, err := github_com_gogo_protobuf_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 := github_com_gogo_protobuf_proto.Size(p)
|
||||
if size3 != size {
|
||||
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkCastawaySize(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Castaway, 1000)
|
||||
for i := 0; i < 1000; i++ {
|
||||
pops[i] = NewPopulatedCastaway(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += pops[i%1000].Size()
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestWilsonSize(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
size2 := github_com_gogo_protobuf_proto.Size(p)
|
||||
dAtA, err := github_com_gogo_protobuf_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 := github_com_gogo_protobuf_proto.Size(p)
|
||||
if size3 != size {
|
||||
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkWilsonSize(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Wilson, 1000)
|
||||
for i := 0; i < 1000; i++ {
|
||||
pops[i] = NewPopulatedWilson(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += pops[i%1000].Size()
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestCastawayStringer(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
s1 := p.String()
|
||||
s2 := fmt.Sprintf("%v", p)
|
||||
if s1 != s2 {
|
||||
t.Fatalf("String want %v got %v", s1, s2)
|
||||
}
|
||||
}
|
||||
func TestWilsonStringer(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(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
|
31
vendor/github.com/gogo/protobuf/test/castvalue/combos/marshaler/mytypes.go
generated
vendored
Normal file
31
vendor/github.com/gogo/protobuf/test/castvalue/combos/marshaler/mytypes.go
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package castvalue
|
||||
|
||||
type MyWilson Wilson
|
1359
vendor/github.com/gogo/protobuf/test/castvalue/combos/unmarshaler/castvalue.pb.go
generated
vendored
Normal file
1359
vendor/github.com/gogo/protobuf/test/castvalue/combos/unmarshaler/castvalue.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
66
vendor/github.com/gogo/protobuf/test/castvalue/combos/unmarshaler/castvalue.proto
generated
vendored
Normal file
66
vendor/github.com/gogo/protobuf/test/castvalue/combos/unmarshaler/castvalue.proto
generated
vendored
Normal file
@ -0,0 +1,66 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2015, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package castvalue;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.goproto_stringer_all) = false;
|
||||
option (gogoproto.goproto_enum_prefix_all) = false;
|
||||
option (gogoproto.goproto_getters_all) = false;
|
||||
|
||||
option (gogoproto.equal_all) = true;
|
||||
option (gogoproto.verbose_equal_all) = true;
|
||||
option (gogoproto.stringer_all) = true;
|
||||
option (gogoproto.gostring_all) = true;
|
||||
option (gogoproto.face_all) = true;
|
||||
option (gogoproto.description_all) = true;
|
||||
|
||||
option (gogoproto.testgen_all) = true;
|
||||
option (gogoproto.populate_all) = true;
|
||||
option (gogoproto.benchgen_all) = true;
|
||||
option (gogoproto.unmarshaler_all) = true;
|
||||
option (gogoproto.marshaler_all) = false;
|
||||
option (gogoproto.sizer_all) = true;
|
||||
|
||||
option (gogoproto.goproto_enum_stringer_all) = false;
|
||||
option (gogoproto.enum_stringer_all) = true;
|
||||
|
||||
option (gogoproto.unsafe_marshaler_all) = false;
|
||||
option (gogoproto.unsafe_unmarshaler_all) = false;
|
||||
|
||||
message Castaway {
|
||||
map<int32,Wilson> CastMapValueMessage = 1 [(gogoproto.castvalue) = "MyWilson", (gogoproto.nullable) = false];
|
||||
map<int32,Wilson> CastMapValueMessageNullable = 2 [(gogoproto.castvalue) = "MyWilson"];
|
||||
}
|
||||
|
||||
message Wilson {
|
||||
optional int64 Int64 = 1;
|
||||
}
|
446
vendor/github.com/gogo/protobuf/test/castvalue/combos/unmarshaler/castvaluepb_test.go
generated
vendored
Normal file
446
vendor/github.com/gogo/protobuf/test/castvalue/combos/unmarshaler/castvaluepb_test.go
generated
vendored
Normal file
@ -0,0 +1,446 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: combos/unmarshaler/castvalue.proto
|
||||
|
||||
package castvalue
|
||||
|
||||
import testing "testing"
|
||||
import math_rand "math/rand"
|
||||
import time "time"
|
||||
import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
|
||||
import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb"
|
||||
import fmt "fmt"
|
||||
import go_parser "go/parser"
|
||||
import proto "github.com/gogo/protobuf/proto"
|
||||
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 TestCastawayProto(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
if err := github_com_gogo_protobuf_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
|
||||
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkCastawayProtoMarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Castaway, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
pops[i] = NewPopulatedCastaway(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
total += len(dAtA)
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func BenchmarkCastawayProtoUnmarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
datas := make([][]byte, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedCastaway(popr, false))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
datas[i] = dAtA
|
||||
}
|
||||
msg := &Castaway{}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += len(datas[i%10000])
|
||||
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestWilsonProto(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
if err := github_com_gogo_protobuf_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
|
||||
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkWilsonProtoMarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Wilson, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
pops[i] = NewPopulatedWilson(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
total += len(dAtA)
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func BenchmarkWilsonProtoUnmarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
datas := make([][]byte, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedWilson(popr, false))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
datas[i] = dAtA
|
||||
}
|
||||
msg := &Wilson{}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += len(datas[i%10000])
|
||||
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestCastawayJSON(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
||||
jsondata, err := marshaler.MarshalToString(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
err = github_com_gogo_protobuf_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 TestWilsonJSON(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
||||
jsondata, err := marshaler.MarshalToString(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
err = github_com_gogo_protobuf_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 TestCastawayProtoText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
||||
msg := &Castaway{}
|
||||
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("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 TestCastawayProtoCompactText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
||||
msg := &Castaway{}
|
||||
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("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 TestWilsonProtoText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
||||
msg := &Wilson{}
|
||||
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("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 TestWilsonProtoCompactText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
||||
msg := &Wilson{}
|
||||
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("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 TestCastvalueDescription(t *testing.T) {
|
||||
CastvalueDescription()
|
||||
}
|
||||
func TestCastawayVerboseEqual(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
msg := &Castaway{}
|
||||
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 TestWilsonVerboseEqual(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
msg := &Wilson{}
|
||||
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 TestCastawayFace(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
msg := p.TestProto()
|
||||
if !p.Equal(msg) {
|
||||
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
||||
}
|
||||
}
|
||||
func TestWilsonFace(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
msg := p.TestProto()
|
||||
if !p.Equal(msg) {
|
||||
t.Fatalf("%#v !Face Equal %#v", msg, p)
|
||||
}
|
||||
}
|
||||
func TestCastawayGoString(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
s1 := p.GoString()
|
||||
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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
func TestWilsonGoString(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(popr, false)
|
||||
s1 := p.GoString()
|
||||
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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
func TestCastawaySize(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedCastaway(popr, true)
|
||||
size2 := github_com_gogo_protobuf_proto.Size(p)
|
||||
dAtA, err := github_com_gogo_protobuf_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 := github_com_gogo_protobuf_proto.Size(p)
|
||||
if size3 != size {
|
||||
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkCastawaySize(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Castaway, 1000)
|
||||
for i := 0; i < 1000; i++ {
|
||||
pops[i] = NewPopulatedCastaway(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += pops[i%1000].Size()
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestWilsonSize(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedWilson(popr, true)
|
||||
size2 := github_com_gogo_protobuf_proto.Size(p)
|
||||
dAtA, err := github_com_gogo_protobuf_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 := github_com_gogo_protobuf_proto.Size(p)
|
||||
if size3 != size {
|
||||
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkWilsonSize(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*Wilson, 1000)
|
||||
for i := 0; i < 1000; i++ {
|
||||
pops[i] = NewPopulatedWilson(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += pops[i%1000].Size()
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestCastawayStringer(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedCastaway(popr, false)
|
||||
s1 := p.String()
|
||||
s2 := fmt.Sprintf("%v", p)
|
||||
if s1 != s2 {
|
||||
t.Fatalf("String want %v got %v", s1, s2)
|
||||
}
|
||||
}
|
||||
func TestWilsonStringer(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedWilson(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
|
31
vendor/github.com/gogo/protobuf/test/castvalue/combos/unmarshaler/mytypes.go
generated
vendored
Normal file
31
vendor/github.com/gogo/protobuf/test/castvalue/combos/unmarshaler/mytypes.go
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package castvalue
|
||||
|
||||
type MyWilson Wilson
|
31
vendor/github.com/gogo/protobuf/test/castvalue/mytypes.go
generated
vendored
Normal file
31
vendor/github.com/gogo/protobuf/test/castvalue/mytypes.go
generated
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package castvalue
|
||||
|
||||
type MyWilson Wilson
|
252
vendor/github.com/gogo/protobuf/test/combos/both/bug_test.go
generated
vendored
Normal file
252
vendor/github.com/gogo/protobuf/test/combos/both/bug_test.go
generated
vendored
Normal file
@ -0,0 +1,252 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"math/rand"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
)
|
||||
|
||||
//http://code.google.com/p/goprotobuf/issues/detail?id=39
|
||||
func TestBugUint32VarintSize(t *testing.T) {
|
||||
temp := uint32(math.MaxUint32)
|
||||
n := &NinOptNative{}
|
||||
n.Field5 = &temp
|
||||
data, err := proto.Marshal(n)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if len(data) != 6 {
|
||||
t.Fatalf("data should be length 6, but its %#v", data)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBugZeroLengthSliceSize(t *testing.T) {
|
||||
n := &NinRepPackedNative{
|
||||
Field8: []int64{},
|
||||
}
|
||||
size := n.Size()
|
||||
data, err := proto.Marshal(n)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if len(data) != size {
|
||||
t.Fatalf("expected %v, but got %v", len(data), size)
|
||||
}
|
||||
}
|
||||
|
||||
//http://code.google.com/p/goprotobuf/issues/detail?id=40
|
||||
func TestBugPackedProtoSize(t *testing.T) {
|
||||
n := &NinRepPackedNative{
|
||||
Field4: []int64{172960727389894724, 2360337516664475010, 860833876131988189, 9068073014890763245, 7794843386260381831, 4023536436053141786, 8992311247496919020, 4330096163611305776, 4490411416244976467, 7873947349172707443, 2754969595834279669, 1360667855926938684, 4771480785172657389, 4875578924966668055, 8070579869808877481, 9128179594766551001, 4630419407064527516, 863844540220372892, 8208727650143073487, 7086117356301045838, 7779695211931506151, 5493835345187563535, 9119767633370806007, 9054342025895349248, 1887303228838508438, 7624573031734528281, 1874668389749611225, 3517684643468970593, 6677697606628877758, 7293473953189936168, 444475066704085538, 8594971141363049302, 1146643249094989673, 733393306232853371, 7721178528893916886, 7784452000911004429, 6436373110242711440, 6897422461738321237, 8772249155667732778, 6211871464311393541, 3061903718310406883, 7845488913176136641, 8342255034663902574, 3443058984649725748, 8410801047334832902, 7496541071517841153, 4305416923521577765, 7814967600020476457, 8671843803465481186, 3490266370361096855, 1447425664719091336, 653218597262334239, 8306243902880091940, 7851896059762409081, 5936760560798954978, 5755724498441478025, 7022701569985035966, 3707709584811468220, 529069456924666920, 7986469043681522462, 3092513330689518836, 5103541550470476202, 3577384161242626406, 3733428084624703294, 8388690542440473117, 3262468785346149388, 8788358556558007570, 5476276940198542020, 7277903243119461239, 5065861426928605020, 7533460976202697734, 1749213838654236956, 557497603941617931, 5496307611456481108, 6444547750062831720, 6992758776744205596, 7356719693428537399, 2896328872476734507, 381447079530132038, 598300737753233118, 3687980626612697715, 7240924191084283349, 8172414415307971170, 4847024388701257185, 2081764168600256551, 3394217778539123488, 6244660626429310923, 8301712215675381614, 5360615125359461174, 8410140945829785773, 3152963269026381373, 6197275282781459633, 4419829061407546410, 6262035523070047537, 2837207483933463885, 2158105736666826128, 8150764172235490711},
|
||||
Field7: []int32{249451845, 1409974015, 393609128, 435232428, 1817529040, 91769006, 861170933, 1556185603, 1568580279, 1236375273, 512276621, 693633711, 967580535, 1950715977, 853431462, 1362390253, 159591204, 111900629, 322985263, 279671129, 1592548430, 465651370, 733849989, 1172059400, 1574824441, 263541092, 1271612397, 1520584358, 467078791, 117698716, 1098255064, 2054264846, 1766452305, 1267576395, 1557505617, 1187833560, 956187431, 1970977586, 1160235159, 1610259028, 489585797, 459139078, 566263183, 954319278, 1545018565, 1753946743, 948214318, 422878159, 883926576, 1424009347, 824732372, 1290433180, 80297942, 417294230, 1402647904, 2078392782, 220505045, 787368129, 463781454, 293083578, 808156928, 293976361},
|
||||
Field9: []uint32{0xaa4976e8, 0x3da8cc4c, 0x8c470d83, 0x344d964e, 0x5b90925, 0xa4c4d34e, 0x666eff19, 0xc238e552, 0x9be53bb6, 0x56364245, 0x33ee079d, 0x96bf0ede, 0x7941b74f, 0xdb07cb47, 0x6d76d827, 0x9b211d5d, 0x2798adb6, 0xe48b0c3b, 0x87061b21, 0x48f4e4d2, 0x3e5d5c12, 0x5ee91288, 0x336d4f35, 0xe1d44941, 0xc065548d, 0x2953d73f, 0x873af451, 0xfc769db, 0x9f1bf8da, 0x9baafdfc, 0xf1d3d770, 0x5bb5d2b4, 0xc2c67c48, 0x6845c4c1, 0xa48f32b0, 0xbb04bb70, 0xa5b1ca36, 0x8d98356a, 0x2171f654, 0x5ae279b0, 0x6c4a3d6b, 0x4fff5468, 0xcf9bf851, 0x68513614, 0xdbecd9b0, 0x9553ed3c, 0xa494a736, 0x42205438, 0xbf8e5caa, 0xd3283c6, 0x76d20788, 0x9179826f, 0x96b24f85, 0xbc2eacf4, 0xe4afae0b, 0x4bca85cb, 0x35e63b5b, 0xd7ccee0c, 0x2b506bb9, 0xe78e9f44, 0x9ad232f1, 0x99a37335, 0xa5d6ffc8},
|
||||
Field11: []uint64{0x53c01ebc, 0x4fb85ba6, 0x8805eea1, 0xb20ec896, 0x93b63410, 0xec7c9492, 0x50765a28, 0x19592106, 0x2ecc59b3, 0x39cd474f, 0xe4c9e47, 0x444f48c5, 0xe7731d32, 0xf3f43975, 0x603caedd, 0xbb05a1af, 0xa808e34e, 0x88580b07, 0x4c96bbd1, 0x730b4ab9, 0xed126e2b, 0x6db48205, 0x154ba1b9, 0xc26bfb6a, 0x389aa052, 0x869d966c, 0x7c86b366, 0xcc8edbcd, 0xfa8d6dad, 0xcf5857d9, 0x2d9cda0f, 0x1218a0b8, 0x41bf997, 0xf0ca65ac, 0xa610d4b9, 0x8d362e28, 0xb7212d87, 0x8e0fe109, 0xbee041d9, 0x759be2f6, 0x35fef4f3, 0xaeacdb71, 0x10888852, 0xf4e28117, 0xe2a14812, 0x73b748dc, 0xd1c3c6b2, 0xfef41bf0, 0xc9b43b62, 0x810e4faa, 0xcaa41c06, 0x1893fe0d, 0xedc7c850, 0xd12b9eaa, 0x467ee1a9, 0xbe84756b, 0xda7b1680, 0xdc069ffe, 0xf1e7e9f9, 0xb3d95370, 0xa92b77df, 0x5693ac41, 0xd04b7287, 0x27aebf15, 0x837b316e, 0x4dbe2263, 0xbab70c67, 0x547dab21, 0x3c346c1f, 0xb8ef0e4e, 0xfe2d03ce, 0xe1d75955, 0xfec1306, 0xba35c23e, 0xb784ed04, 0x2a4e33aa, 0x7e19d09a, 0x3827c1fe, 0xf3a51561, 0xef765e2b, 0xb044256c, 0x62b322be, 0xf34d56be, 0xeb71b369, 0xffe1294f, 0x237fe8d0, 0x77a1473b, 0x239e1196, 0xdd19bf3d, 0x82c91fe1, 0x95361c57, 0xffea3f1b, 0x1a094c84},
|
||||
Field12: []int64{8308420747267165049, 3664160795077875961, 7868970059161834817, 7237335984251173739, 5254748003907196506, 3362259627111837480, 430460752854552122, 5119635556501066533, 1277716037866233522, 9185775384759813768, 833932430882717888, 7986528304451297640, 6792233378368656337, 2074207091120609721, 1788723326198279432, 7756514594746453657, 2283775964901597324, 3061497730110517191, 7733947890656120277, 626967303632386244, 7822928600388582821, 3489658753000061230, 168869995163005961, 248814782163480763, 477885608911386247, 4198422415674133867, 3379354662797976109, 9925112544736939, 1486335136459138480, 4561560414032850671, 1010864164014091267, 186722821683803084, 5106357936724819318, 1298160820191228988, 4675403242419953145, 7130634540106489752, 7101280006672440929, 7176058292431955718, 9109875054097770321, 6810974877085322872, 4736707874303993641, 8993135362721382187, 6857881554990254283, 3704748883307461680, 1099360832887634994, 5207691918707192633, 5984721695043995243},
|
||||
}
|
||||
size := proto.Size(n)
|
||||
data, err := proto.Marshal(n)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if len(data) != size {
|
||||
t.Fatalf("expected %v, but got %v diff is %v", len(data), size, len(data)-size)
|
||||
}
|
||||
}
|
||||
|
||||
func testSize(m interface {
|
||||
proto.Message
|
||||
Size() int
|
||||
}, desc string, expected int) ([]byte, error) {
|
||||
data, err := proto.Marshal(m)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
protoSize := proto.Size(m)
|
||||
mSize := m.Size()
|
||||
lenData := len(data)
|
||||
if protoSize != mSize || protoSize != lenData || mSize != lenData {
|
||||
return nil, fmt.Errorf("%s proto.Size(m){%d} != m.Size(){%d} != len(data){%d}", desc, protoSize, mSize, lenData)
|
||||
}
|
||||
if got := protoSize; got != expected {
|
||||
return nil, fmt.Errorf("%s proto.Size(m) got %d expected %d", desc, got, expected)
|
||||
}
|
||||
if got := mSize; got != expected {
|
||||
return nil, fmt.Errorf("%s m.Size() got %d expected %d", desc, got, expected)
|
||||
}
|
||||
if got := lenData; got != expected {
|
||||
return nil, fmt.Errorf("%s len(data) got %d expected %d", desc, got, expected)
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
func TestInt32Int64Compatibility(t *testing.T) {
|
||||
|
||||
//test nullable int32 and int64
|
||||
|
||||
data1, err := testSize(&NinOptNative{
|
||||
Field3: proto.Int32(-1),
|
||||
}, "nullable", 11)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
//change marshaled data1 to unmarshal into 4th field which is an int64
|
||||
data1[0] = uint8(uint32(4 /*fieldNumber*/)<<3 | uint32(0 /*wireType*/))
|
||||
u1 := &NinOptNative{}
|
||||
if err = proto.Unmarshal(data1, u1); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if !u1.Equal(&NinOptNative{
|
||||
Field4: proto.Int64(-1),
|
||||
}) {
|
||||
t.Error("nullable unmarshaled int32 is not the same int64")
|
||||
}
|
||||
|
||||
//test non-nullable int32 and int64
|
||||
|
||||
data2, err := testSize(&NidOptNative{
|
||||
Field3: -1,
|
||||
}, "non nullable", 67)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
//change marshaled data2 to unmarshal into 4th field which is an int64
|
||||
field3 := uint8(uint32(3 /*fieldNumber*/)<<3 | uint32(0 /*wireType*/))
|
||||
field4 := uint8(uint32(4 /*fieldNumber*/)<<3 | uint32(0 /*wireType*/))
|
||||
for i, c := range data2 {
|
||||
if c == field4 {
|
||||
data2[i] = field3
|
||||
} else if c == field3 {
|
||||
data2[i] = field4
|
||||
}
|
||||
}
|
||||
u2 := &NidOptNative{}
|
||||
if err = proto.Unmarshal(data2, u2); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if !u2.Equal(&NidOptNative{
|
||||
Field4: -1,
|
||||
}) {
|
||||
t.Error("non nullable unmarshaled int32 is not the same int64")
|
||||
}
|
||||
|
||||
//test packed repeated int32 and int64
|
||||
|
||||
m4 := &NinRepPackedNative{
|
||||
Field3: []int32{-1},
|
||||
}
|
||||
data4, err := testSize(m4, "packed", 12)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
u4 := &NinRepPackedNative{}
|
||||
if err := proto.Unmarshal(data4, u4); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if err := u4.VerboseEqual(m4); err != nil {
|
||||
t.Fatalf("%#v", u4)
|
||||
}
|
||||
|
||||
//test repeated int32 and int64
|
||||
|
||||
if _, err := testSize(&NinRepNative{
|
||||
Field3: []int32{-1},
|
||||
}, "repeated", 11); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
t.Logf("tested all")
|
||||
}
|
||||
|
||||
func TestRepeatedExtensionsMsgsIssue161(t *testing.T) {
|
||||
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
rep := 10
|
||||
nins := make([]*NinOptNative, rep)
|
||||
for i := range nins {
|
||||
nins[i] = NewPopulatedNinOptNative(r, true)
|
||||
}
|
||||
input := &MyExtendable{}
|
||||
if err := proto.SetExtension(input, E_FieldE, nins); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
data, err := proto.Marshal(input)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
output := &MyExtendable{}
|
||||
if err := proto.Unmarshal(data, output); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !input.Equal(output) {
|
||||
t.Fatalf("want %#v but got %#v", input, output)
|
||||
}
|
||||
data2, err2 := proto.Marshal(output)
|
||||
if err2 != nil {
|
||||
t.Fatal(err2)
|
||||
}
|
||||
if len(data) != len(data2) {
|
||||
t.Fatal("expected equal length buffers")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRepeatedExtensionsFieldsIssue161(t *testing.T) {
|
||||
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
rep := 10
|
||||
ints := make([]int64, rep)
|
||||
for i := range ints {
|
||||
ints[i] = r.Int63()
|
||||
}
|
||||
input := &MyExtendable{}
|
||||
if err := proto.SetExtension(input, E_FieldD, ints); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
data, err := proto.Marshal(input)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
output := &MyExtendable{}
|
||||
if err := proto.Unmarshal(data, output); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !input.Equal(output) {
|
||||
t.Fatalf("want %#v but got %#v", input, output)
|
||||
}
|
||||
data2, err2 := proto.Marshal(output)
|
||||
if err2 != nil {
|
||||
t.Fatal(err2)
|
||||
}
|
||||
if len(data) != len(data2) {
|
||||
t.Fatal("expected equal length buffers")
|
||||
}
|
||||
}
|
77
vendor/github.com/gogo/protobuf/test/combos/both/t.go
generated
vendored
Normal file
77
vendor/github.com/gogo/protobuf/test/combos/both/t.go
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
)
|
||||
|
||||
type T struct {
|
||||
Data string
|
||||
}
|
||||
|
||||
func (gt *T) protoType() *ProtoType {
|
||||
return &ProtoType{
|
||||
Field2: >.Data,
|
||||
}
|
||||
}
|
||||
|
||||
func (gt T) Equal(other T) bool {
|
||||
return gt.protoType().Equal(other.protoType())
|
||||
}
|
||||
|
||||
func (gt *T) Size() int {
|
||||
proto := &ProtoType{
|
||||
Field2: >.Data,
|
||||
}
|
||||
return proto.Size()
|
||||
}
|
||||
|
||||
func NewPopulatedT(r randyThetest) *T {
|
||||
data := NewPopulatedProtoType(r, false).Field2
|
||||
gt := &T{}
|
||||
if data != nil {
|
||||
gt.Data = *data
|
||||
}
|
||||
return gt
|
||||
}
|
||||
|
||||
func (r T) Marshal() ([]byte, error) {
|
||||
return proto.Marshal(r.protoType())
|
||||
}
|
||||
|
||||
func (r *T) MarshalTo(data []byte) (n int, err error) {
|
||||
return r.protoType().MarshalTo(data)
|
||||
}
|
||||
|
||||
func (r *T) Unmarshal(data []byte) error {
|
||||
pr := &ProtoType{}
|
||||
err := proto.Unmarshal(data, pr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if pr.Field2 != nil {
|
||||
r.Data = *pr.Field2
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (gt T) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(gt.Data)
|
||||
}
|
||||
|
||||
func (gt *T) UnmarshalJSON(data []byte) error {
|
||||
var s string
|
||||
err := json.Unmarshal(data, &s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*gt = T{Data: s}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (gt T) Compare(other T) int {
|
||||
return strings.Compare(gt.Data, other.Data)
|
||||
}
|
46037
vendor/github.com/gogo/protobuf/test/combos/both/thetest.pb.go
generated
vendored
Normal file
46037
vendor/github.com/gogo/protobuf/test/combos/both/thetest.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
649
vendor/github.com/gogo/protobuf/test/combos/both/thetest.proto
generated
vendored
Normal file
649
vendor/github.com/gogo/protobuf/test/combos/both/thetest.proto
generated
vendored
Normal file
@ -0,0 +1,649 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
package test;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.goproto_stringer_all) = false;
|
||||
option (gogoproto.goproto_enum_prefix_all) = false;
|
||||
option (gogoproto.goproto_getters_all) = false;
|
||||
|
||||
option (gogoproto.equal_all) = true;
|
||||
option (gogoproto.verbose_equal_all) = true;
|
||||
option (gogoproto.stringer_all) = true;
|
||||
option (gogoproto.gostring_all) = true;
|
||||
option (gogoproto.face_all) = true;
|
||||
option (gogoproto.description_all) = true;
|
||||
|
||||
option (gogoproto.testgen_all) = true;
|
||||
option (gogoproto.populate_all) = true;
|
||||
option (gogoproto.benchgen_all) = true;
|
||||
option (gogoproto.unmarshaler_all) = true;
|
||||
option (gogoproto.marshaler_all) = true;
|
||||
option (gogoproto.sizer_all) = true;
|
||||
option (gogoproto.protosizer_all) = false;
|
||||
|
||||
option (gogoproto.goproto_enum_stringer_all) = false;
|
||||
option (gogoproto.enum_stringer_all) = true;
|
||||
|
||||
option (gogoproto.unsafe_marshaler_all) = false;
|
||||
option (gogoproto.unsafe_unmarshaler_all) = false;
|
||||
|
||||
option (gogoproto.compare_all) = true;
|
||||
|
||||
message NidOptNative {
|
||||
optional double Field1 = 1 [(gogoproto.nullable) = false];
|
||||
optional float Field2 = 2 [(gogoproto.nullable) = false];
|
||||
optional int32 Field3 = 3 [(gogoproto.nullable) = false];
|
||||
optional int64 Field4 = 4 [(gogoproto.nullable) = false];
|
||||
optional uint32 Field5 = 5 [(gogoproto.nullable) = false];
|
||||
optional uint64 Field6 = 6 [(gogoproto.nullable) = false];
|
||||
optional sint32 Field7 = 7 [(gogoproto.nullable) = false];
|
||||
optional sint64 Field8 = 8 [(gogoproto.nullable) = false];
|
||||
optional fixed32 Field9 = 9 [(gogoproto.nullable) = false];
|
||||
optional sfixed32 Field10 = 10 [(gogoproto.nullable) = false];
|
||||
optional fixed64 Field11 = 11 [(gogoproto.nullable) = false];
|
||||
optional sfixed64 Field12 = 12 [(gogoproto.nullable) = false];
|
||||
optional bool Field13 = 13 [(gogoproto.nullable) = false];
|
||||
optional string Field14 = 14 [(gogoproto.nullable) = false];
|
||||
optional bytes Field15 = 15 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinOptNative {
|
||||
optional double Field1 = 1;
|
||||
optional float Field2 = 2;
|
||||
optional int32 Field3 = 3;
|
||||
optional int64 Field4 = 4;
|
||||
optional uint32 Field5 = 5;
|
||||
optional uint64 Field6 = 6;
|
||||
optional sint32 Field7 = 7;
|
||||
optional sint64 Field8 = 8;
|
||||
optional fixed32 Field9 = 9;
|
||||
optional sfixed32 Field10 = 10;
|
||||
optional fixed64 Field11 = 11;
|
||||
optional sfixed64 Field12 = 12;
|
||||
optional bool Field13 = 13;
|
||||
optional string Field14 = 14;
|
||||
optional bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NidRepNative {
|
||||
repeated double Field1 = 1 [(gogoproto.nullable) = false];
|
||||
repeated float Field2 = 2 [(gogoproto.nullable) = false];
|
||||
repeated int32 Field3 = 3 [(gogoproto.nullable) = false];
|
||||
repeated int64 Field4 = 4 [(gogoproto.nullable) = false];
|
||||
repeated uint32 Field5 = 5 [(gogoproto.nullable) = false];
|
||||
repeated uint64 Field6 = 6 [(gogoproto.nullable) = false];
|
||||
repeated sint32 Field7 = 7 [(gogoproto.nullable) = false];
|
||||
repeated sint64 Field8 = 8 [(gogoproto.nullable) = false];
|
||||
repeated fixed32 Field9 = 9 [(gogoproto.nullable) = false];
|
||||
repeated sfixed32 Field10 = 10 [(gogoproto.nullable) = false];
|
||||
repeated fixed64 Field11 = 11 [(gogoproto.nullable) = false];
|
||||
repeated sfixed64 Field12 = 12 [(gogoproto.nullable) = false];
|
||||
repeated bool Field13 = 13 [(gogoproto.nullable) = false];
|
||||
repeated string Field14 = 14 [(gogoproto.nullable) = false];
|
||||
repeated bytes Field15 = 15 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinRepNative {
|
||||
repeated double Field1 = 1;
|
||||
repeated float Field2 = 2;
|
||||
repeated int32 Field3 = 3;
|
||||
repeated int64 Field4 = 4;
|
||||
repeated uint32 Field5 = 5;
|
||||
repeated uint64 Field6 = 6;
|
||||
repeated sint32 Field7 = 7;
|
||||
repeated sint64 Field8 = 8;
|
||||
repeated fixed32 Field9 = 9;
|
||||
repeated sfixed32 Field10 = 10;
|
||||
repeated fixed64 Field11 = 11;
|
||||
repeated sfixed64 Field12 = 12;
|
||||
repeated bool Field13 = 13;
|
||||
repeated string Field14 = 14;
|
||||
repeated bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NidRepPackedNative {
|
||||
repeated double Field1 = 1 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated float Field2 = 2 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated int32 Field3 = 3 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated int64 Field4 = 4 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated uint32 Field5 = 5 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated uint64 Field6 = 6 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated sint32 Field7 = 7 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated sint64 Field8 = 8 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated fixed32 Field9 = 9 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated sfixed32 Field10 = 10 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated fixed64 Field11 = 11 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated sfixed64 Field12 = 12 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated bool Field13 = 13 [(gogoproto.nullable) = false, packed = true];
|
||||
}
|
||||
|
||||
message NinRepPackedNative {
|
||||
repeated double Field1 = 1 [packed = true];
|
||||
repeated float Field2 = 2 [packed = true];
|
||||
repeated int32 Field3 = 3 [packed = true];
|
||||
repeated int64 Field4 = 4 [packed = true];
|
||||
repeated uint32 Field5 = 5 [packed = true];
|
||||
repeated uint64 Field6 = 6 [packed = true];
|
||||
repeated sint32 Field7 = 7 [packed = true];
|
||||
repeated sint64 Field8 = 8 [packed = true];
|
||||
repeated fixed32 Field9 = 9 [packed = true];
|
||||
repeated sfixed32 Field10 = 10 [packed = true];
|
||||
repeated fixed64 Field11 = 11 [packed = true];
|
||||
repeated sfixed64 Field12 = 12 [packed = true];
|
||||
repeated bool Field13 = 13 [packed = true];
|
||||
}
|
||||
|
||||
message NidOptStruct {
|
||||
optional double Field1 = 1 [(gogoproto.nullable) = false];
|
||||
optional float Field2 = 2 [(gogoproto.nullable) = false];
|
||||
optional NidOptNative Field3 = 3 [(gogoproto.nullable) = false];
|
||||
optional NinOptNative Field4 = 4 [(gogoproto.nullable) = false];
|
||||
optional uint64 Field6 = 6 [(gogoproto.nullable) = false];
|
||||
optional sint32 Field7 = 7 [(gogoproto.nullable) = false];
|
||||
optional NidOptNative Field8 = 8 [(gogoproto.nullable) = false];
|
||||
optional bool Field13 = 13 [(gogoproto.nullable) = false];
|
||||
optional string Field14 = 14 [(gogoproto.nullable) = false];
|
||||
optional bytes Field15 = 15 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinOptStruct {
|
||||
optional double Field1 = 1;
|
||||
optional float Field2 = 2;
|
||||
optional NidOptNative Field3 = 3;
|
||||
optional NinOptNative Field4 = 4;
|
||||
optional uint64 Field6 = 6;
|
||||
optional sint32 Field7 = 7;
|
||||
optional NidOptNative Field8 = 8;
|
||||
optional bool Field13 = 13;
|
||||
optional string Field14 = 14;
|
||||
optional bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NidRepStruct {
|
||||
repeated double Field1 = 1 [(gogoproto.nullable) = false];
|
||||
repeated float Field2 = 2 [(gogoproto.nullable) = false];
|
||||
repeated NidOptNative Field3 = 3 [(gogoproto.nullable) = false];
|
||||
repeated NinOptNative Field4 = 4 [(gogoproto.nullable) = false];
|
||||
repeated uint64 Field6 = 6 [(gogoproto.nullable) = false];
|
||||
repeated sint32 Field7 = 7 [(gogoproto.nullable) = false];
|
||||
repeated NidOptNative Field8 = 8 [(gogoproto.nullable) = false];
|
||||
repeated bool Field13 = 13 [(gogoproto.nullable) = false];
|
||||
repeated string Field14 = 14 [(gogoproto.nullable) = false];
|
||||
repeated bytes Field15 = 15 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinRepStruct {
|
||||
repeated double Field1 = 1;
|
||||
repeated float Field2 = 2;
|
||||
repeated NidOptNative Field3 = 3;
|
||||
repeated NinOptNative Field4 = 4;
|
||||
repeated uint64 Field6 = 6;
|
||||
repeated sint32 Field7 = 7;
|
||||
repeated NidOptNative Field8 = 8;
|
||||
repeated bool Field13 = 13;
|
||||
repeated string Field14 = 14;
|
||||
repeated bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NidEmbeddedStruct {
|
||||
optional NidOptNative Field1 = 1 [(gogoproto.embed) = true];
|
||||
optional NidOptNative Field200 = 200 [(gogoproto.nullable) = false];
|
||||
optional bool Field210 = 210 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinEmbeddedStruct {
|
||||
optional NidOptNative Field1 = 1 [(gogoproto.embed) = true];
|
||||
optional NidOptNative Field200 = 200;
|
||||
optional bool Field210 = 210;
|
||||
}
|
||||
|
||||
message NidNestedStruct {
|
||||
optional NidOptStruct Field1 = 1 [(gogoproto.nullable) = false];
|
||||
repeated NidRepStruct Field2 = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinNestedStruct {
|
||||
optional NinOptStruct Field1 = 1;
|
||||
repeated NinRepStruct Field2 = 2;
|
||||
}
|
||||
|
||||
message NidOptCustom {
|
||||
optional bytes Id = 1 [(gogoproto.customtype) = "Uuid", (gogoproto.nullable) = false];
|
||||
optional bytes Value = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message CustomDash {
|
||||
optional bytes Value = 1 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom-dash-type.Bytes"];
|
||||
}
|
||||
|
||||
message NinOptCustom {
|
||||
optional bytes Id = 1 [(gogoproto.customtype) = "Uuid"];
|
||||
optional bytes Value = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128"];
|
||||
}
|
||||
|
||||
message NidRepCustom {
|
||||
repeated bytes Id = 1 [(gogoproto.customtype) = "Uuid", (gogoproto.nullable) = false];
|
||||
repeated bytes Value = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinRepCustom {
|
||||
repeated bytes Id = 1 [(gogoproto.customtype) = "Uuid"];
|
||||
repeated bytes Value = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128"];
|
||||
}
|
||||
|
||||
message NinOptNativeUnion {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional double Field1 = 1;
|
||||
optional float Field2 = 2;
|
||||
optional int32 Field3 = 3;
|
||||
optional int64 Field4 = 4;
|
||||
optional uint32 Field5 = 5;
|
||||
optional uint64 Field6 = 6;
|
||||
optional bool Field13 = 13;
|
||||
optional string Field14 = 14;
|
||||
optional bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NinOptStructUnion {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional double Field1 = 1;
|
||||
optional float Field2 = 2;
|
||||
optional NidOptNative Field3 = 3;
|
||||
optional NinOptNative Field4 = 4;
|
||||
optional uint64 Field6 = 6;
|
||||
optional sint32 Field7 = 7;
|
||||
optional bool Field13 = 13;
|
||||
optional string Field14 = 14;
|
||||
optional bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NinEmbeddedStructUnion {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional NidOptNative Field1 = 1 [(gogoproto.embed) = true];
|
||||
optional NinOptNative Field200 = 200;
|
||||
optional bool Field210 = 210;
|
||||
}
|
||||
|
||||
message NinNestedStructUnion {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional NinOptNativeUnion Field1 = 1;
|
||||
optional NinOptStructUnion Field2 = 2;
|
||||
optional NinEmbeddedStructUnion Field3 = 3;
|
||||
}
|
||||
|
||||
message Tree {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional OrBranch Or = 1;
|
||||
optional AndBranch And = 2;
|
||||
optional Leaf Leaf = 3;
|
||||
}
|
||||
|
||||
message OrBranch {
|
||||
optional Tree Left = 1 [(gogoproto.nullable) = false];
|
||||
optional Tree Right = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message AndBranch {
|
||||
optional Tree Left = 1 [(gogoproto.nullable) = false];
|
||||
optional Tree Right = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message Leaf {
|
||||
optional int64 Value = 1 [(gogoproto.nullable) = false];
|
||||
optional string StrValue = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message DeepTree {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional ADeepBranch Down = 1;
|
||||
optional AndDeepBranch And = 2;
|
||||
optional DeepLeaf Leaf = 3;
|
||||
}
|
||||
|
||||
message ADeepBranch {
|
||||
optional DeepTree Down = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message AndDeepBranch {
|
||||
optional DeepTree Left = 1 [(gogoproto.nullable) = false];
|
||||
optional DeepTree Right = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message DeepLeaf {
|
||||
optional Tree Tree = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message Nil {
|
||||
|
||||
}
|
||||
|
||||
enum TheTestEnum {
|
||||
A = 0;
|
||||
B = 1;
|
||||
C = 2;
|
||||
}
|
||||
|
||||
enum AnotherTestEnum {
|
||||
option (gogoproto.goproto_enum_prefix) = false;
|
||||
D = 10;
|
||||
E = 11;
|
||||
}
|
||||
|
||||
// YetAnotherTestEnum is used to test cross-package import of custom name
|
||||
// fields and default resolution.
|
||||
enum YetAnotherTestEnum {
|
||||
option (gogoproto.goproto_enum_prefix) = false;
|
||||
AA = 0;
|
||||
BB = 1 [(gogoproto.enumvalue_customname) = "BetterYetBB"];
|
||||
}
|
||||
|
||||
// YetAnotherTestEnum is used to test cross-package import of custom name
|
||||
// fields and default resolution.
|
||||
enum YetYetAnotherTestEnum {
|
||||
option (gogoproto.goproto_enum_prefix) = true;
|
||||
CC = 0;
|
||||
DD = 1 [(gogoproto.enumvalue_customname) = "BetterYetDD"];
|
||||
}
|
||||
|
||||
message NidOptEnum {
|
||||
optional TheTestEnum Field1 = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinOptEnum {
|
||||
optional TheTestEnum Field1 = 1;
|
||||
optional YetAnotherTestEnum Field2 = 2;
|
||||
optional YetYetAnotherTestEnum Field3 = 3;
|
||||
}
|
||||
|
||||
message NidRepEnum {
|
||||
repeated TheTestEnum Field1 = 1 [(gogoproto.nullable) = false];
|
||||
repeated YetAnotherTestEnum Field2 = 2 [(gogoproto.nullable) = false];
|
||||
repeated YetYetAnotherTestEnum Field3 = 3 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinRepEnum {
|
||||
repeated TheTestEnum Field1 = 1;
|
||||
repeated YetAnotherTestEnum Field2 = 2;
|
||||
repeated YetYetAnotherTestEnum Field3 = 3;
|
||||
}
|
||||
|
||||
message NinOptEnumDefault {
|
||||
option (gogoproto.goproto_getters) = true;
|
||||
option (gogoproto.face) = false;
|
||||
optional TheTestEnum Field1 = 1 [default=C];
|
||||
optional YetAnotherTestEnum Field2 = 2 [default=BB];
|
||||
optional YetYetAnotherTestEnum Field3 = 3 [default=CC];
|
||||
}
|
||||
|
||||
message AnotherNinOptEnum {
|
||||
optional AnotherTestEnum Field1 = 1;
|
||||
optional YetAnotherTestEnum Field2 = 2;
|
||||
optional YetYetAnotherTestEnum Field3 = 3;
|
||||
}
|
||||
|
||||
message AnotherNinOptEnumDefault {
|
||||
option (gogoproto.goproto_getters) = true;
|
||||
option (gogoproto.face) = false;
|
||||
optional AnotherTestEnum Field1 = 1 [default=E];
|
||||
optional YetAnotherTestEnum Field2 = 2 [default=BB];
|
||||
optional YetYetAnotherTestEnum Field3 = 3 [default=CC];
|
||||
}
|
||||
|
||||
|
||||
message Timer {
|
||||
optional sfixed64 Time1 = 1 [(gogoproto.nullable) = false];
|
||||
optional sfixed64 Time2 = 2 [(gogoproto.nullable) = false];
|
||||
optional bytes Data = 3 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message MyExtendable {
|
||||
option (gogoproto.face) = false;
|
||||
optional int64 Field1 = 1;
|
||||
extensions 100 to 199;
|
||||
}
|
||||
|
||||
extend MyExtendable {
|
||||
optional double FieldA = 100;
|
||||
optional NinOptNative FieldB = 101;
|
||||
optional NinEmbeddedStruct FieldC = 102;
|
||||
repeated int64 FieldD = 104;
|
||||
repeated NinOptNative FieldE = 105;
|
||||
}
|
||||
|
||||
message OtherExtenable {
|
||||
option (gogoproto.face) = false;
|
||||
optional int64 Field2 = 2;
|
||||
extensions 14 to 16;
|
||||
optional int64 Field13 = 13;
|
||||
extensions 10 to 12;
|
||||
optional MyExtendable M = 1;
|
||||
}
|
||||
|
||||
message NestedDefinition {
|
||||
optional int64 Field1 = 1;
|
||||
message NestedMessage {
|
||||
optional fixed64 NestedField1 = 1;
|
||||
optional NestedNestedMsg NNM = 2;
|
||||
message NestedNestedMsg {
|
||||
optional string NestedNestedField1 = 10;
|
||||
}
|
||||
}
|
||||
enum NestedEnum {
|
||||
TYPE_NESTED = 1;
|
||||
}
|
||||
optional NestedEnum EnumField = 2;
|
||||
optional NestedMessage.NestedNestedMsg NNM = 3;
|
||||
optional NestedMessage NM = 4;
|
||||
}
|
||||
|
||||
message NestedScope {
|
||||
optional NestedDefinition.NestedMessage.NestedNestedMsg A = 1;
|
||||
optional NestedDefinition.NestedEnum B = 2;
|
||||
optional NestedDefinition.NestedMessage C = 3;
|
||||
}
|
||||
|
||||
message NinOptNativeDefault {
|
||||
option (gogoproto.goproto_getters) = true;
|
||||
option (gogoproto.face) = false;
|
||||
optional double Field1 = 1 [default = 1234.1234];
|
||||
optional float Field2 = 2 [default = 1234.1234];
|
||||
optional int32 Field3 = 3 [default = 1234];
|
||||
optional int64 Field4 = 4 [default = 1234];
|
||||
optional uint32 Field5 = 5 [default = 1234];
|
||||
optional uint64 Field6 = 6 [default = 1234];
|
||||
optional sint32 Field7 = 7 [default = 1234];
|
||||
optional sint64 Field8 = 8 [default = 1234];
|
||||
optional fixed32 Field9 = 9 [default = 1234];
|
||||
optional sfixed32 Field10 = 10 [default = 1234];
|
||||
optional fixed64 Field11 = 11 [default = 1234];
|
||||
optional sfixed64 Field12 = 12 [default = 1234];
|
||||
optional bool Field13 = 13 [default = true];
|
||||
optional string Field14 = 14 [default = "1234"];
|
||||
optional bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message CustomContainer {
|
||||
optional NidOptCustom CustomStruct = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message CustomNameNidOptNative {
|
||||
optional double Field1 = 1 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldA"];
|
||||
optional float Field2 = 2 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldB"];
|
||||
optional int32 Field3 = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldC"];
|
||||
optional int64 Field4 = 4 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldD"];
|
||||
optional uint32 Field5 = 5 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldE"];
|
||||
optional uint64 Field6 = 6 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldF"];
|
||||
optional sint32 Field7 = 7 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldG"];
|
||||
optional sint64 Field8 = 8 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldH"];
|
||||
optional fixed32 Field9 = 9 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldI"];
|
||||
optional sfixed32 Field10 = 10 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldJ"];
|
||||
optional fixed64 Field11 = 11 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldK"];
|
||||
optional sfixed64 Field12 = 12 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldL"];
|
||||
optional bool Field13 = 13 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldM"];
|
||||
optional string Field14 = 14 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldN"];
|
||||
optional bytes Field15 = 15 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldO"];
|
||||
}
|
||||
|
||||
message CustomNameNinOptNative {
|
||||
optional double Field1 = 1 [(gogoproto.customname) = "FieldA"];
|
||||
optional float Field2 = 2 [(gogoproto.customname) = "FieldB"];
|
||||
optional int32 Field3 = 3 [(gogoproto.customname) = "FieldC"];
|
||||
optional int64 Field4 = 4 [(gogoproto.customname) = "FieldD"];
|
||||
optional uint32 Field5 = 5 [(gogoproto.customname) = "FieldE"];
|
||||
optional uint64 Field6 = 6 [(gogoproto.customname) = "FieldF"];
|
||||
optional sint32 Field7 = 7 [(gogoproto.customname) = "FieldG"];
|
||||
optional sint64 Field8 = 8 [(gogoproto.customname) = "FieldH"];
|
||||
optional fixed32 Field9 = 9 [(gogoproto.customname) = "FieldI"];
|
||||
optional sfixed32 Field10 = 10 [(gogoproto.customname) = "FieldJ"];
|
||||
optional fixed64 Field11 = 11 [(gogoproto.customname) = "FieldK"];
|
||||
optional sfixed64 Field12 = 12 [(gogoproto.customname) = "FielL"];
|
||||
optional bool Field13 = 13 [(gogoproto.customname) = "FieldM"];
|
||||
optional string Field14 = 14 [(gogoproto.customname) = "FieldN"];
|
||||
optional bytes Field15 = 15 [(gogoproto.customname) = "FieldO"];
|
||||
}
|
||||
|
||||
message CustomNameNinRepNative {
|
||||
repeated double Field1 = 1 [(gogoproto.customname) = "FieldA"];
|
||||
repeated float Field2 = 2 [(gogoproto.customname) = "FieldB"];
|
||||
repeated int32 Field3 = 3 [(gogoproto.customname) = "FieldC"];
|
||||
repeated int64 Field4 = 4 [(gogoproto.customname) = "FieldD"];
|
||||
repeated uint32 Field5 = 5 [(gogoproto.customname) = "FieldE"];
|
||||
repeated uint64 Field6 = 6 [(gogoproto.customname) = "FieldF"];
|
||||
repeated sint32 Field7 = 7 [(gogoproto.customname) = "FieldG"];
|
||||
repeated sint64 Field8 = 8 [(gogoproto.customname) = "FieldH"];
|
||||
repeated fixed32 Field9 = 9 [(gogoproto.customname) = "FieldI"];
|
||||
repeated sfixed32 Field10 = 10 [(gogoproto.customname) = "FieldJ"];
|
||||
repeated fixed64 Field11 = 11 [(gogoproto.customname) = "FieldK"];
|
||||
repeated sfixed64 Field12 = 12 [(gogoproto.customname) = "FieldL"];
|
||||
repeated bool Field13 = 13 [(gogoproto.customname) = "FieldM"];
|
||||
repeated string Field14 = 14 [(gogoproto.customname) = "FieldN"];
|
||||
repeated bytes Field15 = 15 [(gogoproto.customname) = "FieldO"];
|
||||
}
|
||||
|
||||
message CustomNameNinStruct {
|
||||
optional double Field1 = 1 [(gogoproto.customname) = "FieldA"];
|
||||
optional float Field2 = 2 [(gogoproto.customname) = "FieldB"];
|
||||
optional NidOptNative Field3 = 3 [(gogoproto.customname) = "FieldC"];
|
||||
repeated NinOptNative Field4 = 4 [(gogoproto.customname) = "FieldD"];
|
||||
optional uint64 Field6 = 6 [(gogoproto.customname) = "FieldE"];
|
||||
optional sint32 Field7 = 7 [(gogoproto.customname) = "FieldF"];
|
||||
optional NidOptNative Field8 = 8 [(gogoproto.customname) = "FieldG"];
|
||||
optional bool Field13 = 13 [(gogoproto.customname) = "FieldH"];
|
||||
optional string Field14 = 14 [(gogoproto.customname) = "FieldI"];
|
||||
optional bytes Field15 = 15 [(gogoproto.customname) = "FieldJ"];
|
||||
}
|
||||
|
||||
message CustomNameCustomType {
|
||||
optional bytes Id = 1 [(gogoproto.customname) = "FieldA", (gogoproto.customtype) = "Uuid"];
|
||||
optional bytes Value = 2 [(gogoproto.customname) = "FieldB", (gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128"];
|
||||
repeated bytes Ids = 3 [(gogoproto.customname) = "FieldC", (gogoproto.customtype) = "Uuid"];
|
||||
repeated bytes Values = 4 [(gogoproto.customname) = "FieldD", (gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128"];
|
||||
}
|
||||
|
||||
message CustomNameNinEmbeddedStructUnion {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional NidOptNative Field1 = 1 [(gogoproto.embed) = true];
|
||||
optional NinOptNative Field200 = 200 [(gogoproto.customname) = "FieldA"];
|
||||
optional bool Field210 = 210 [(gogoproto.customname) = "FieldB"];
|
||||
}
|
||||
|
||||
message CustomNameEnum {
|
||||
optional TheTestEnum Field1 = 1 [(gogoproto.customname) = "FieldA"];
|
||||
repeated TheTestEnum Field2 = 2 [(gogoproto.customname) = "FieldB"];
|
||||
}
|
||||
|
||||
message NoExtensionsMap {
|
||||
option (gogoproto.face) = false;
|
||||
option (gogoproto.goproto_extensions_map) = false;
|
||||
optional int64 Field1 = 1;
|
||||
extensions 100 to 199;
|
||||
}
|
||||
|
||||
extend NoExtensionsMap {
|
||||
optional double FieldA1 = 100;
|
||||
optional NinOptNative FieldB1 = 101;
|
||||
optional NinEmbeddedStruct FieldC1 = 102;
|
||||
}
|
||||
|
||||
message Unrecognized {
|
||||
option (gogoproto.goproto_unrecognized) = false;
|
||||
optional string Field1 = 1;
|
||||
}
|
||||
|
||||
message UnrecognizedWithInner {
|
||||
message Inner {
|
||||
option (gogoproto.goproto_unrecognized) = false;
|
||||
optional uint32 Field1 = 1;
|
||||
}
|
||||
|
||||
repeated Inner embedded = 1;
|
||||
optional string Field2 = 2;
|
||||
}
|
||||
|
||||
message UnrecognizedWithEmbed {
|
||||
message Embedded {
|
||||
option (gogoproto.goproto_unrecognized) = false;
|
||||
optional uint32 Field1 = 1;
|
||||
}
|
||||
|
||||
optional Embedded embedded = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
|
||||
optional string Field2 = 2;
|
||||
}
|
||||
|
||||
message Node {
|
||||
optional string Label = 1;
|
||||
repeated Node Children = 2;
|
||||
}
|
||||
|
||||
message NonByteCustomType {
|
||||
optional ProtoType Field1 = 1 [(gogoproto.customtype) = "T"];
|
||||
}
|
||||
|
||||
message NidOptNonByteCustomType {
|
||||
optional ProtoType Field1 = 1 [(gogoproto.customtype) = "T", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinOptNonByteCustomType {
|
||||
optional ProtoType Field1 = 1 [(gogoproto.customtype) = "T"];
|
||||
}
|
||||
|
||||
message NidRepNonByteCustomType {
|
||||
repeated ProtoType Field1 = 1 [(gogoproto.customtype) = "T", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinRepNonByteCustomType {
|
||||
repeated ProtoType Field1 = 1 [(gogoproto.customtype) = "T"];
|
||||
}
|
||||
|
||||
message ProtoType {
|
||||
optional string Field2 = 1;
|
||||
}
|
17878
vendor/github.com/gogo/protobuf/test/combos/both/thetestpb_test.go
generated
vendored
Normal file
17878
vendor/github.com/gogo/protobuf/test/combos/both/thetestpb_test.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
137
vendor/github.com/gogo/protobuf/test/combos/both/uuid.go
generated
vendored
Normal file
137
vendor/github.com/gogo/protobuf/test/combos/both/uuid.go
generated
vendored
Normal file
@ -0,0 +1,137 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
func PutLittleEndianUint64(b []byte, offset int, v uint64) {
|
||||
b[offset] = byte(v)
|
||||
b[offset+1] = byte(v >> 8)
|
||||
b[offset+2] = byte(v >> 16)
|
||||
b[offset+3] = byte(v >> 24)
|
||||
b[offset+4] = byte(v >> 32)
|
||||
b[offset+5] = byte(v >> 40)
|
||||
b[offset+6] = byte(v >> 48)
|
||||
b[offset+7] = byte(v >> 56)
|
||||
}
|
||||
|
||||
type Uuid []byte
|
||||
|
||||
func (uuid Uuid) Bytes() []byte {
|
||||
return uuid
|
||||
}
|
||||
|
||||
func (uuid Uuid) Marshal() ([]byte, error) {
|
||||
if len(uuid) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
return []byte(uuid), nil
|
||||
}
|
||||
|
||||
func (uuid Uuid) MarshalTo(data []byte) (n int, err error) {
|
||||
if len(uuid) == 0 {
|
||||
return 0, nil
|
||||
}
|
||||
copy(data, uuid)
|
||||
return 16, nil
|
||||
}
|
||||
|
||||
func (uuid *Uuid) Unmarshal(data []byte) error {
|
||||
if len(data) == 0 {
|
||||
uuid = nil
|
||||
return nil
|
||||
}
|
||||
id := Uuid(make([]byte, 16))
|
||||
copy(id, data)
|
||||
*uuid = id
|
||||
return nil
|
||||
}
|
||||
|
||||
func (uuid *Uuid) Size() int {
|
||||
if uuid == nil {
|
||||
return 0
|
||||
}
|
||||
if len(*uuid) == 0 {
|
||||
return 0
|
||||
}
|
||||
return 16
|
||||
}
|
||||
|
||||
func (uuid Uuid) MarshalJSON() ([]byte, error) {
|
||||
s := hex.EncodeToString([]byte(uuid))
|
||||
return json.Marshal(s)
|
||||
}
|
||||
|
||||
func (uuid *Uuid) UnmarshalJSON(data []byte) error {
|
||||
var s string
|
||||
err := json.Unmarshal(data, &s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
d, err := hex.DecodeString(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*uuid = Uuid(d)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (uuid Uuid) Equal(other Uuid) bool {
|
||||
return bytes.Equal(uuid[0:], other[0:])
|
||||
}
|
||||
|
||||
func (uuid Uuid) Compare(other Uuid) int {
|
||||
return bytes.Compare(uuid[0:], other[0:])
|
||||
}
|
||||
|
||||
type int63 interface {
|
||||
Int63() int64
|
||||
}
|
||||
|
||||
func NewPopulatedUuid(r int63) *Uuid {
|
||||
u := RandV4(r)
|
||||
return &u
|
||||
}
|
||||
|
||||
func RandV4(r int63) Uuid {
|
||||
uuid := make(Uuid, 16)
|
||||
uuid.RandV4(r)
|
||||
return uuid
|
||||
}
|
||||
|
||||
func (uuid Uuid) RandV4(r int63) {
|
||||
PutLittleEndianUint64(uuid, 0, uint64(r.Int63()))
|
||||
PutLittleEndianUint64(uuid, 8, uint64(r.Int63()))
|
||||
uuid[6] = (uuid[6] & 0xf) | 0x40
|
||||
uuid[8] = (uuid[8] & 0x3f) | 0x80
|
||||
}
|
252
vendor/github.com/gogo/protobuf/test/combos/marshaler/bug_test.go
generated
vendored
Normal file
252
vendor/github.com/gogo/protobuf/test/combos/marshaler/bug_test.go
generated
vendored
Normal file
@ -0,0 +1,252 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"math/rand"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
)
|
||||
|
||||
//http://code.google.com/p/goprotobuf/issues/detail?id=39
|
||||
func TestBugUint32VarintSize(t *testing.T) {
|
||||
temp := uint32(math.MaxUint32)
|
||||
n := &NinOptNative{}
|
||||
n.Field5 = &temp
|
||||
data, err := proto.Marshal(n)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if len(data) != 6 {
|
||||
t.Fatalf("data should be length 6, but its %#v", data)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBugZeroLengthSliceSize(t *testing.T) {
|
||||
n := &NinRepPackedNative{
|
||||
Field8: []int64{},
|
||||
}
|
||||
size := n.Size()
|
||||
data, err := proto.Marshal(n)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if len(data) != size {
|
||||
t.Fatalf("expected %v, but got %v", len(data), size)
|
||||
}
|
||||
}
|
||||
|
||||
//http://code.google.com/p/goprotobuf/issues/detail?id=40
|
||||
func TestBugPackedProtoSize(t *testing.T) {
|
||||
n := &NinRepPackedNative{
|
||||
Field4: []int64{172960727389894724, 2360337516664475010, 860833876131988189, 9068073014890763245, 7794843386260381831, 4023536436053141786, 8992311247496919020, 4330096163611305776, 4490411416244976467, 7873947349172707443, 2754969595834279669, 1360667855926938684, 4771480785172657389, 4875578924966668055, 8070579869808877481, 9128179594766551001, 4630419407064527516, 863844540220372892, 8208727650143073487, 7086117356301045838, 7779695211931506151, 5493835345187563535, 9119767633370806007, 9054342025895349248, 1887303228838508438, 7624573031734528281, 1874668389749611225, 3517684643468970593, 6677697606628877758, 7293473953189936168, 444475066704085538, 8594971141363049302, 1146643249094989673, 733393306232853371, 7721178528893916886, 7784452000911004429, 6436373110242711440, 6897422461738321237, 8772249155667732778, 6211871464311393541, 3061903718310406883, 7845488913176136641, 8342255034663902574, 3443058984649725748, 8410801047334832902, 7496541071517841153, 4305416923521577765, 7814967600020476457, 8671843803465481186, 3490266370361096855, 1447425664719091336, 653218597262334239, 8306243902880091940, 7851896059762409081, 5936760560798954978, 5755724498441478025, 7022701569985035966, 3707709584811468220, 529069456924666920, 7986469043681522462, 3092513330689518836, 5103541550470476202, 3577384161242626406, 3733428084624703294, 8388690542440473117, 3262468785346149388, 8788358556558007570, 5476276940198542020, 7277903243119461239, 5065861426928605020, 7533460976202697734, 1749213838654236956, 557497603941617931, 5496307611456481108, 6444547750062831720, 6992758776744205596, 7356719693428537399, 2896328872476734507, 381447079530132038, 598300737753233118, 3687980626612697715, 7240924191084283349, 8172414415307971170, 4847024388701257185, 2081764168600256551, 3394217778539123488, 6244660626429310923, 8301712215675381614, 5360615125359461174, 8410140945829785773, 3152963269026381373, 6197275282781459633, 4419829061407546410, 6262035523070047537, 2837207483933463885, 2158105736666826128, 8150764172235490711},
|
||||
Field7: []int32{249451845, 1409974015, 393609128, 435232428, 1817529040, 91769006, 861170933, 1556185603, 1568580279, 1236375273, 512276621, 693633711, 967580535, 1950715977, 853431462, 1362390253, 159591204, 111900629, 322985263, 279671129, 1592548430, 465651370, 733849989, 1172059400, 1574824441, 263541092, 1271612397, 1520584358, 467078791, 117698716, 1098255064, 2054264846, 1766452305, 1267576395, 1557505617, 1187833560, 956187431, 1970977586, 1160235159, 1610259028, 489585797, 459139078, 566263183, 954319278, 1545018565, 1753946743, 948214318, 422878159, 883926576, 1424009347, 824732372, 1290433180, 80297942, 417294230, 1402647904, 2078392782, 220505045, 787368129, 463781454, 293083578, 808156928, 293976361},
|
||||
Field9: []uint32{0xaa4976e8, 0x3da8cc4c, 0x8c470d83, 0x344d964e, 0x5b90925, 0xa4c4d34e, 0x666eff19, 0xc238e552, 0x9be53bb6, 0x56364245, 0x33ee079d, 0x96bf0ede, 0x7941b74f, 0xdb07cb47, 0x6d76d827, 0x9b211d5d, 0x2798adb6, 0xe48b0c3b, 0x87061b21, 0x48f4e4d2, 0x3e5d5c12, 0x5ee91288, 0x336d4f35, 0xe1d44941, 0xc065548d, 0x2953d73f, 0x873af451, 0xfc769db, 0x9f1bf8da, 0x9baafdfc, 0xf1d3d770, 0x5bb5d2b4, 0xc2c67c48, 0x6845c4c1, 0xa48f32b0, 0xbb04bb70, 0xa5b1ca36, 0x8d98356a, 0x2171f654, 0x5ae279b0, 0x6c4a3d6b, 0x4fff5468, 0xcf9bf851, 0x68513614, 0xdbecd9b0, 0x9553ed3c, 0xa494a736, 0x42205438, 0xbf8e5caa, 0xd3283c6, 0x76d20788, 0x9179826f, 0x96b24f85, 0xbc2eacf4, 0xe4afae0b, 0x4bca85cb, 0x35e63b5b, 0xd7ccee0c, 0x2b506bb9, 0xe78e9f44, 0x9ad232f1, 0x99a37335, 0xa5d6ffc8},
|
||||
Field11: []uint64{0x53c01ebc, 0x4fb85ba6, 0x8805eea1, 0xb20ec896, 0x93b63410, 0xec7c9492, 0x50765a28, 0x19592106, 0x2ecc59b3, 0x39cd474f, 0xe4c9e47, 0x444f48c5, 0xe7731d32, 0xf3f43975, 0x603caedd, 0xbb05a1af, 0xa808e34e, 0x88580b07, 0x4c96bbd1, 0x730b4ab9, 0xed126e2b, 0x6db48205, 0x154ba1b9, 0xc26bfb6a, 0x389aa052, 0x869d966c, 0x7c86b366, 0xcc8edbcd, 0xfa8d6dad, 0xcf5857d9, 0x2d9cda0f, 0x1218a0b8, 0x41bf997, 0xf0ca65ac, 0xa610d4b9, 0x8d362e28, 0xb7212d87, 0x8e0fe109, 0xbee041d9, 0x759be2f6, 0x35fef4f3, 0xaeacdb71, 0x10888852, 0xf4e28117, 0xe2a14812, 0x73b748dc, 0xd1c3c6b2, 0xfef41bf0, 0xc9b43b62, 0x810e4faa, 0xcaa41c06, 0x1893fe0d, 0xedc7c850, 0xd12b9eaa, 0x467ee1a9, 0xbe84756b, 0xda7b1680, 0xdc069ffe, 0xf1e7e9f9, 0xb3d95370, 0xa92b77df, 0x5693ac41, 0xd04b7287, 0x27aebf15, 0x837b316e, 0x4dbe2263, 0xbab70c67, 0x547dab21, 0x3c346c1f, 0xb8ef0e4e, 0xfe2d03ce, 0xe1d75955, 0xfec1306, 0xba35c23e, 0xb784ed04, 0x2a4e33aa, 0x7e19d09a, 0x3827c1fe, 0xf3a51561, 0xef765e2b, 0xb044256c, 0x62b322be, 0xf34d56be, 0xeb71b369, 0xffe1294f, 0x237fe8d0, 0x77a1473b, 0x239e1196, 0xdd19bf3d, 0x82c91fe1, 0x95361c57, 0xffea3f1b, 0x1a094c84},
|
||||
Field12: []int64{8308420747267165049, 3664160795077875961, 7868970059161834817, 7237335984251173739, 5254748003907196506, 3362259627111837480, 430460752854552122, 5119635556501066533, 1277716037866233522, 9185775384759813768, 833932430882717888, 7986528304451297640, 6792233378368656337, 2074207091120609721, 1788723326198279432, 7756514594746453657, 2283775964901597324, 3061497730110517191, 7733947890656120277, 626967303632386244, 7822928600388582821, 3489658753000061230, 168869995163005961, 248814782163480763, 477885608911386247, 4198422415674133867, 3379354662797976109, 9925112544736939, 1486335136459138480, 4561560414032850671, 1010864164014091267, 186722821683803084, 5106357936724819318, 1298160820191228988, 4675403242419953145, 7130634540106489752, 7101280006672440929, 7176058292431955718, 9109875054097770321, 6810974877085322872, 4736707874303993641, 8993135362721382187, 6857881554990254283, 3704748883307461680, 1099360832887634994, 5207691918707192633, 5984721695043995243},
|
||||
}
|
||||
size := proto.Size(n)
|
||||
data, err := proto.Marshal(n)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if len(data) != size {
|
||||
t.Fatalf("expected %v, but got %v diff is %v", len(data), size, len(data)-size)
|
||||
}
|
||||
}
|
||||
|
||||
func testSize(m interface {
|
||||
proto.Message
|
||||
Size() int
|
||||
}, desc string, expected int) ([]byte, error) {
|
||||
data, err := proto.Marshal(m)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
protoSize := proto.Size(m)
|
||||
mSize := m.Size()
|
||||
lenData := len(data)
|
||||
if protoSize != mSize || protoSize != lenData || mSize != lenData {
|
||||
return nil, fmt.Errorf("%s proto.Size(m){%d} != m.Size(){%d} != len(data){%d}", desc, protoSize, mSize, lenData)
|
||||
}
|
||||
if got := protoSize; got != expected {
|
||||
return nil, fmt.Errorf("%s proto.Size(m) got %d expected %d", desc, got, expected)
|
||||
}
|
||||
if got := mSize; got != expected {
|
||||
return nil, fmt.Errorf("%s m.Size() got %d expected %d", desc, got, expected)
|
||||
}
|
||||
if got := lenData; got != expected {
|
||||
return nil, fmt.Errorf("%s len(data) got %d expected %d", desc, got, expected)
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
func TestInt32Int64Compatibility(t *testing.T) {
|
||||
|
||||
//test nullable int32 and int64
|
||||
|
||||
data1, err := testSize(&NinOptNative{
|
||||
Field3: proto.Int32(-1),
|
||||
}, "nullable", 11)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
//change marshaled data1 to unmarshal into 4th field which is an int64
|
||||
data1[0] = uint8(uint32(4 /*fieldNumber*/)<<3 | uint32(0 /*wireType*/))
|
||||
u1 := &NinOptNative{}
|
||||
if err = proto.Unmarshal(data1, u1); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if !u1.Equal(&NinOptNative{
|
||||
Field4: proto.Int64(-1),
|
||||
}) {
|
||||
t.Error("nullable unmarshaled int32 is not the same int64")
|
||||
}
|
||||
|
||||
//test non-nullable int32 and int64
|
||||
|
||||
data2, err := testSize(&NidOptNative{
|
||||
Field3: -1,
|
||||
}, "non nullable", 67)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
//change marshaled data2 to unmarshal into 4th field which is an int64
|
||||
field3 := uint8(uint32(3 /*fieldNumber*/)<<3 | uint32(0 /*wireType*/))
|
||||
field4 := uint8(uint32(4 /*fieldNumber*/)<<3 | uint32(0 /*wireType*/))
|
||||
for i, c := range data2 {
|
||||
if c == field4 {
|
||||
data2[i] = field3
|
||||
} else if c == field3 {
|
||||
data2[i] = field4
|
||||
}
|
||||
}
|
||||
u2 := &NidOptNative{}
|
||||
if err = proto.Unmarshal(data2, u2); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if !u2.Equal(&NidOptNative{
|
||||
Field4: -1,
|
||||
}) {
|
||||
t.Error("non nullable unmarshaled int32 is not the same int64")
|
||||
}
|
||||
|
||||
//test packed repeated int32 and int64
|
||||
|
||||
m4 := &NinRepPackedNative{
|
||||
Field3: []int32{-1},
|
||||
}
|
||||
data4, err := testSize(m4, "packed", 12)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
u4 := &NinRepPackedNative{}
|
||||
if err := proto.Unmarshal(data4, u4); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if err := u4.VerboseEqual(m4); err != nil {
|
||||
t.Fatalf("%#v", u4)
|
||||
}
|
||||
|
||||
//test repeated int32 and int64
|
||||
|
||||
if _, err := testSize(&NinRepNative{
|
||||
Field3: []int32{-1},
|
||||
}, "repeated", 11); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
t.Logf("tested all")
|
||||
}
|
||||
|
||||
func TestRepeatedExtensionsMsgsIssue161(t *testing.T) {
|
||||
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
rep := 10
|
||||
nins := make([]*NinOptNative, rep)
|
||||
for i := range nins {
|
||||
nins[i] = NewPopulatedNinOptNative(r, true)
|
||||
}
|
||||
input := &MyExtendable{}
|
||||
if err := proto.SetExtension(input, E_FieldE, nins); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
data, err := proto.Marshal(input)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
output := &MyExtendable{}
|
||||
if err := proto.Unmarshal(data, output); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !input.Equal(output) {
|
||||
t.Fatalf("want %#v but got %#v", input, output)
|
||||
}
|
||||
data2, err2 := proto.Marshal(output)
|
||||
if err2 != nil {
|
||||
t.Fatal(err2)
|
||||
}
|
||||
if len(data) != len(data2) {
|
||||
t.Fatal("expected equal length buffers")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRepeatedExtensionsFieldsIssue161(t *testing.T) {
|
||||
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
rep := 10
|
||||
ints := make([]int64, rep)
|
||||
for i := range ints {
|
||||
ints[i] = r.Int63()
|
||||
}
|
||||
input := &MyExtendable{}
|
||||
if err := proto.SetExtension(input, E_FieldD, ints); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
data, err := proto.Marshal(input)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
output := &MyExtendable{}
|
||||
if err := proto.Unmarshal(data, output); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !input.Equal(output) {
|
||||
t.Fatalf("want %#v but got %#v", input, output)
|
||||
}
|
||||
data2, err2 := proto.Marshal(output)
|
||||
if err2 != nil {
|
||||
t.Fatal(err2)
|
||||
}
|
||||
if len(data) != len(data2) {
|
||||
t.Fatal("expected equal length buffers")
|
||||
}
|
||||
}
|
77
vendor/github.com/gogo/protobuf/test/combos/marshaler/t.go
generated
vendored
Normal file
77
vendor/github.com/gogo/protobuf/test/combos/marshaler/t.go
generated
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
)
|
||||
|
||||
type T struct {
|
||||
Data string
|
||||
}
|
||||
|
||||
func (gt *T) protoType() *ProtoType {
|
||||
return &ProtoType{
|
||||
Field2: >.Data,
|
||||
}
|
||||
}
|
||||
|
||||
func (gt T) Equal(other T) bool {
|
||||
return gt.protoType().Equal(other.protoType())
|
||||
}
|
||||
|
||||
func (gt *T) Size() int {
|
||||
proto := &ProtoType{
|
||||
Field2: >.Data,
|
||||
}
|
||||
return proto.Size()
|
||||
}
|
||||
|
||||
func NewPopulatedT(r randyThetest) *T {
|
||||
data := NewPopulatedProtoType(r, false).Field2
|
||||
gt := &T{}
|
||||
if data != nil {
|
||||
gt.Data = *data
|
||||
}
|
||||
return gt
|
||||
}
|
||||
|
||||
func (r T) Marshal() ([]byte, error) {
|
||||
return proto.Marshal(r.protoType())
|
||||
}
|
||||
|
||||
func (r *T) MarshalTo(data []byte) (n int, err error) {
|
||||
return r.protoType().MarshalTo(data)
|
||||
}
|
||||
|
||||
func (r *T) Unmarshal(data []byte) error {
|
||||
pr := &ProtoType{}
|
||||
err := proto.Unmarshal(data, pr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if pr.Field2 != nil {
|
||||
r.Data = *pr.Field2
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (gt T) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(gt.Data)
|
||||
}
|
||||
|
||||
func (gt *T) UnmarshalJSON(data []byte) error {
|
||||
var s string
|
||||
err := json.Unmarshal(data, &s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*gt = T{Data: s}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (gt T) Compare(other T) int {
|
||||
return strings.Compare(gt.Data, other.Data)
|
||||
}
|
31684
vendor/github.com/gogo/protobuf/test/combos/marshaler/thetest.pb.go
generated
vendored
Normal file
31684
vendor/github.com/gogo/protobuf/test/combos/marshaler/thetest.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
649
vendor/github.com/gogo/protobuf/test/combos/marshaler/thetest.proto
generated
vendored
Normal file
649
vendor/github.com/gogo/protobuf/test/combos/marshaler/thetest.proto
generated
vendored
Normal file
@ -0,0 +1,649 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
package test;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.goproto_stringer_all) = false;
|
||||
option (gogoproto.goproto_enum_prefix_all) = false;
|
||||
option (gogoproto.goproto_getters_all) = false;
|
||||
|
||||
option (gogoproto.equal_all) = true;
|
||||
option (gogoproto.verbose_equal_all) = true;
|
||||
option (gogoproto.stringer_all) = true;
|
||||
option (gogoproto.gostring_all) = true;
|
||||
option (gogoproto.face_all) = true;
|
||||
option (gogoproto.description_all) = true;
|
||||
|
||||
option (gogoproto.testgen_all) = true;
|
||||
option (gogoproto.populate_all) = true;
|
||||
option (gogoproto.benchgen_all) = true;
|
||||
option (gogoproto.unmarshaler_all) = false;
|
||||
option (gogoproto.marshaler_all) = true;
|
||||
option (gogoproto.sizer_all) = true;
|
||||
option (gogoproto.protosizer_all) = false;
|
||||
|
||||
option (gogoproto.goproto_enum_stringer_all) = false;
|
||||
option (gogoproto.enum_stringer_all) = true;
|
||||
|
||||
option (gogoproto.unsafe_marshaler_all) = false;
|
||||
option (gogoproto.unsafe_unmarshaler_all) = false;
|
||||
|
||||
option (gogoproto.compare_all) = true;
|
||||
|
||||
message NidOptNative {
|
||||
optional double Field1 = 1 [(gogoproto.nullable) = false];
|
||||
optional float Field2 = 2 [(gogoproto.nullable) = false];
|
||||
optional int32 Field3 = 3 [(gogoproto.nullable) = false];
|
||||
optional int64 Field4 = 4 [(gogoproto.nullable) = false];
|
||||
optional uint32 Field5 = 5 [(gogoproto.nullable) = false];
|
||||
optional uint64 Field6 = 6 [(gogoproto.nullable) = false];
|
||||
optional sint32 Field7 = 7 [(gogoproto.nullable) = false];
|
||||
optional sint64 Field8 = 8 [(gogoproto.nullable) = false];
|
||||
optional fixed32 Field9 = 9 [(gogoproto.nullable) = false];
|
||||
optional sfixed32 Field10 = 10 [(gogoproto.nullable) = false];
|
||||
optional fixed64 Field11 = 11 [(gogoproto.nullable) = false];
|
||||
optional sfixed64 Field12 = 12 [(gogoproto.nullable) = false];
|
||||
optional bool Field13 = 13 [(gogoproto.nullable) = false];
|
||||
optional string Field14 = 14 [(gogoproto.nullable) = false];
|
||||
optional bytes Field15 = 15 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinOptNative {
|
||||
optional double Field1 = 1;
|
||||
optional float Field2 = 2;
|
||||
optional int32 Field3 = 3;
|
||||
optional int64 Field4 = 4;
|
||||
optional uint32 Field5 = 5;
|
||||
optional uint64 Field6 = 6;
|
||||
optional sint32 Field7 = 7;
|
||||
optional sint64 Field8 = 8;
|
||||
optional fixed32 Field9 = 9;
|
||||
optional sfixed32 Field10 = 10;
|
||||
optional fixed64 Field11 = 11;
|
||||
optional sfixed64 Field12 = 12;
|
||||
optional bool Field13 = 13;
|
||||
optional string Field14 = 14;
|
||||
optional bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NidRepNative {
|
||||
repeated double Field1 = 1 [(gogoproto.nullable) = false];
|
||||
repeated float Field2 = 2 [(gogoproto.nullable) = false];
|
||||
repeated int32 Field3 = 3 [(gogoproto.nullable) = false];
|
||||
repeated int64 Field4 = 4 [(gogoproto.nullable) = false];
|
||||
repeated uint32 Field5 = 5 [(gogoproto.nullable) = false];
|
||||
repeated uint64 Field6 = 6 [(gogoproto.nullable) = false];
|
||||
repeated sint32 Field7 = 7 [(gogoproto.nullable) = false];
|
||||
repeated sint64 Field8 = 8 [(gogoproto.nullable) = false];
|
||||
repeated fixed32 Field9 = 9 [(gogoproto.nullable) = false];
|
||||
repeated sfixed32 Field10 = 10 [(gogoproto.nullable) = false];
|
||||
repeated fixed64 Field11 = 11 [(gogoproto.nullable) = false];
|
||||
repeated sfixed64 Field12 = 12 [(gogoproto.nullable) = false];
|
||||
repeated bool Field13 = 13 [(gogoproto.nullable) = false];
|
||||
repeated string Field14 = 14 [(gogoproto.nullable) = false];
|
||||
repeated bytes Field15 = 15 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinRepNative {
|
||||
repeated double Field1 = 1;
|
||||
repeated float Field2 = 2;
|
||||
repeated int32 Field3 = 3;
|
||||
repeated int64 Field4 = 4;
|
||||
repeated uint32 Field5 = 5;
|
||||
repeated uint64 Field6 = 6;
|
||||
repeated sint32 Field7 = 7;
|
||||
repeated sint64 Field8 = 8;
|
||||
repeated fixed32 Field9 = 9;
|
||||
repeated sfixed32 Field10 = 10;
|
||||
repeated fixed64 Field11 = 11;
|
||||
repeated sfixed64 Field12 = 12;
|
||||
repeated bool Field13 = 13;
|
||||
repeated string Field14 = 14;
|
||||
repeated bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NidRepPackedNative {
|
||||
repeated double Field1 = 1 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated float Field2 = 2 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated int32 Field3 = 3 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated int64 Field4 = 4 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated uint32 Field5 = 5 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated uint64 Field6 = 6 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated sint32 Field7 = 7 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated sint64 Field8 = 8 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated fixed32 Field9 = 9 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated sfixed32 Field10 = 10 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated fixed64 Field11 = 11 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated sfixed64 Field12 = 12 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated bool Field13 = 13 [(gogoproto.nullable) = false, packed = true];
|
||||
}
|
||||
|
||||
message NinRepPackedNative {
|
||||
repeated double Field1 = 1 [packed = true];
|
||||
repeated float Field2 = 2 [packed = true];
|
||||
repeated int32 Field3 = 3 [packed = true];
|
||||
repeated int64 Field4 = 4 [packed = true];
|
||||
repeated uint32 Field5 = 5 [packed = true];
|
||||
repeated uint64 Field6 = 6 [packed = true];
|
||||
repeated sint32 Field7 = 7 [packed = true];
|
||||
repeated sint64 Field8 = 8 [packed = true];
|
||||
repeated fixed32 Field9 = 9 [packed = true];
|
||||
repeated sfixed32 Field10 = 10 [packed = true];
|
||||
repeated fixed64 Field11 = 11 [packed = true];
|
||||
repeated sfixed64 Field12 = 12 [packed = true];
|
||||
repeated bool Field13 = 13 [packed = true];
|
||||
}
|
||||
|
||||
message NidOptStruct {
|
||||
optional double Field1 = 1 [(gogoproto.nullable) = false];
|
||||
optional float Field2 = 2 [(gogoproto.nullable) = false];
|
||||
optional NidOptNative Field3 = 3 [(gogoproto.nullable) = false];
|
||||
optional NinOptNative Field4 = 4 [(gogoproto.nullable) = false];
|
||||
optional uint64 Field6 = 6 [(gogoproto.nullable) = false];
|
||||
optional sint32 Field7 = 7 [(gogoproto.nullable) = false];
|
||||
optional NidOptNative Field8 = 8 [(gogoproto.nullable) = false];
|
||||
optional bool Field13 = 13 [(gogoproto.nullable) = false];
|
||||
optional string Field14 = 14 [(gogoproto.nullable) = false];
|
||||
optional bytes Field15 = 15 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinOptStruct {
|
||||
optional double Field1 = 1;
|
||||
optional float Field2 = 2;
|
||||
optional NidOptNative Field3 = 3;
|
||||
optional NinOptNative Field4 = 4;
|
||||
optional uint64 Field6 = 6;
|
||||
optional sint32 Field7 = 7;
|
||||
optional NidOptNative Field8 = 8;
|
||||
optional bool Field13 = 13;
|
||||
optional string Field14 = 14;
|
||||
optional bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NidRepStruct {
|
||||
repeated double Field1 = 1 [(gogoproto.nullable) = false];
|
||||
repeated float Field2 = 2 [(gogoproto.nullable) = false];
|
||||
repeated NidOptNative Field3 = 3 [(gogoproto.nullable) = false];
|
||||
repeated NinOptNative Field4 = 4 [(gogoproto.nullable) = false];
|
||||
repeated uint64 Field6 = 6 [(gogoproto.nullable) = false];
|
||||
repeated sint32 Field7 = 7 [(gogoproto.nullable) = false];
|
||||
repeated NidOptNative Field8 = 8 [(gogoproto.nullable) = false];
|
||||
repeated bool Field13 = 13 [(gogoproto.nullable) = false];
|
||||
repeated string Field14 = 14 [(gogoproto.nullable) = false];
|
||||
repeated bytes Field15 = 15 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinRepStruct {
|
||||
repeated double Field1 = 1;
|
||||
repeated float Field2 = 2;
|
||||
repeated NidOptNative Field3 = 3;
|
||||
repeated NinOptNative Field4 = 4;
|
||||
repeated uint64 Field6 = 6;
|
||||
repeated sint32 Field7 = 7;
|
||||
repeated NidOptNative Field8 = 8;
|
||||
repeated bool Field13 = 13;
|
||||
repeated string Field14 = 14;
|
||||
repeated bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NidEmbeddedStruct {
|
||||
optional NidOptNative Field1 = 1 [(gogoproto.embed) = true];
|
||||
optional NidOptNative Field200 = 200 [(gogoproto.nullable) = false];
|
||||
optional bool Field210 = 210 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinEmbeddedStruct {
|
||||
optional NidOptNative Field1 = 1 [(gogoproto.embed) = true];
|
||||
optional NidOptNative Field200 = 200;
|
||||
optional bool Field210 = 210;
|
||||
}
|
||||
|
||||
message NidNestedStruct {
|
||||
optional NidOptStruct Field1 = 1 [(gogoproto.nullable) = false];
|
||||
repeated NidRepStruct Field2 = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinNestedStruct {
|
||||
optional NinOptStruct Field1 = 1;
|
||||
repeated NinRepStruct Field2 = 2;
|
||||
}
|
||||
|
||||
message NidOptCustom {
|
||||
optional bytes Id = 1 [(gogoproto.customtype) = "Uuid", (gogoproto.nullable) = false];
|
||||
optional bytes Value = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message CustomDash {
|
||||
optional bytes Value = 1 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom-dash-type.Bytes"];
|
||||
}
|
||||
|
||||
message NinOptCustom {
|
||||
optional bytes Id = 1 [(gogoproto.customtype) = "Uuid"];
|
||||
optional bytes Value = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128"];
|
||||
}
|
||||
|
||||
message NidRepCustom {
|
||||
repeated bytes Id = 1 [(gogoproto.customtype) = "Uuid", (gogoproto.nullable) = false];
|
||||
repeated bytes Value = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinRepCustom {
|
||||
repeated bytes Id = 1 [(gogoproto.customtype) = "Uuid"];
|
||||
repeated bytes Value = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128"];
|
||||
}
|
||||
|
||||
message NinOptNativeUnion {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional double Field1 = 1;
|
||||
optional float Field2 = 2;
|
||||
optional int32 Field3 = 3;
|
||||
optional int64 Field4 = 4;
|
||||
optional uint32 Field5 = 5;
|
||||
optional uint64 Field6 = 6;
|
||||
optional bool Field13 = 13;
|
||||
optional string Field14 = 14;
|
||||
optional bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NinOptStructUnion {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional double Field1 = 1;
|
||||
optional float Field2 = 2;
|
||||
optional NidOptNative Field3 = 3;
|
||||
optional NinOptNative Field4 = 4;
|
||||
optional uint64 Field6 = 6;
|
||||
optional sint32 Field7 = 7;
|
||||
optional bool Field13 = 13;
|
||||
optional string Field14 = 14;
|
||||
optional bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NinEmbeddedStructUnion {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional NidOptNative Field1 = 1 [(gogoproto.embed) = true];
|
||||
optional NinOptNative Field200 = 200;
|
||||
optional bool Field210 = 210;
|
||||
}
|
||||
|
||||
message NinNestedStructUnion {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional NinOptNativeUnion Field1 = 1;
|
||||
optional NinOptStructUnion Field2 = 2;
|
||||
optional NinEmbeddedStructUnion Field3 = 3;
|
||||
}
|
||||
|
||||
message Tree {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional OrBranch Or = 1;
|
||||
optional AndBranch And = 2;
|
||||
optional Leaf Leaf = 3;
|
||||
}
|
||||
|
||||
message OrBranch {
|
||||
optional Tree Left = 1 [(gogoproto.nullable) = false];
|
||||
optional Tree Right = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message AndBranch {
|
||||
optional Tree Left = 1 [(gogoproto.nullable) = false];
|
||||
optional Tree Right = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message Leaf {
|
||||
optional int64 Value = 1 [(gogoproto.nullable) = false];
|
||||
optional string StrValue = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message DeepTree {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional ADeepBranch Down = 1;
|
||||
optional AndDeepBranch And = 2;
|
||||
optional DeepLeaf Leaf = 3;
|
||||
}
|
||||
|
||||
message ADeepBranch {
|
||||
optional DeepTree Down = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message AndDeepBranch {
|
||||
optional DeepTree Left = 1 [(gogoproto.nullable) = false];
|
||||
optional DeepTree Right = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message DeepLeaf {
|
||||
optional Tree Tree = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message Nil {
|
||||
|
||||
}
|
||||
|
||||
enum TheTestEnum {
|
||||
A = 0;
|
||||
B = 1;
|
||||
C = 2;
|
||||
}
|
||||
|
||||
enum AnotherTestEnum {
|
||||
option (gogoproto.goproto_enum_prefix) = false;
|
||||
D = 10;
|
||||
E = 11;
|
||||
}
|
||||
|
||||
// YetAnotherTestEnum is used to test cross-package import of custom name
|
||||
// fields and default resolution.
|
||||
enum YetAnotherTestEnum {
|
||||
option (gogoproto.goproto_enum_prefix) = false;
|
||||
AA = 0;
|
||||
BB = 1 [(gogoproto.enumvalue_customname) = "BetterYetBB"];
|
||||
}
|
||||
|
||||
// YetAnotherTestEnum is used to test cross-package import of custom name
|
||||
// fields and default resolution.
|
||||
enum YetYetAnotherTestEnum {
|
||||
option (gogoproto.goproto_enum_prefix) = true;
|
||||
CC = 0;
|
||||
DD = 1 [(gogoproto.enumvalue_customname) = "BetterYetDD"];
|
||||
}
|
||||
|
||||
message NidOptEnum {
|
||||
optional TheTestEnum Field1 = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinOptEnum {
|
||||
optional TheTestEnum Field1 = 1;
|
||||
optional YetAnotherTestEnum Field2 = 2;
|
||||
optional YetYetAnotherTestEnum Field3 = 3;
|
||||
}
|
||||
|
||||
message NidRepEnum {
|
||||
repeated TheTestEnum Field1 = 1 [(gogoproto.nullable) = false];
|
||||
repeated YetAnotherTestEnum Field2 = 2 [(gogoproto.nullable) = false];
|
||||
repeated YetYetAnotherTestEnum Field3 = 3 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinRepEnum {
|
||||
repeated TheTestEnum Field1 = 1;
|
||||
repeated YetAnotherTestEnum Field2 = 2;
|
||||
repeated YetYetAnotherTestEnum Field3 = 3;
|
||||
}
|
||||
|
||||
message NinOptEnumDefault {
|
||||
option (gogoproto.goproto_getters) = true;
|
||||
option (gogoproto.face) = false;
|
||||
optional TheTestEnum Field1 = 1 [default=C];
|
||||
optional YetAnotherTestEnum Field2 = 2 [default=BB];
|
||||
optional YetYetAnotherTestEnum Field3 = 3 [default=CC];
|
||||
}
|
||||
|
||||
message AnotherNinOptEnum {
|
||||
optional AnotherTestEnum Field1 = 1;
|
||||
optional YetAnotherTestEnum Field2 = 2;
|
||||
optional YetYetAnotherTestEnum Field3 = 3;
|
||||
}
|
||||
|
||||
message AnotherNinOptEnumDefault {
|
||||
option (gogoproto.goproto_getters) = true;
|
||||
option (gogoproto.face) = false;
|
||||
optional AnotherTestEnum Field1 = 1 [default=E];
|
||||
optional YetAnotherTestEnum Field2 = 2 [default=BB];
|
||||
optional YetYetAnotherTestEnum Field3 = 3 [default=CC];
|
||||
}
|
||||
|
||||
|
||||
message Timer {
|
||||
optional sfixed64 Time1 = 1 [(gogoproto.nullable) = false];
|
||||
optional sfixed64 Time2 = 2 [(gogoproto.nullable) = false];
|
||||
optional bytes Data = 3 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message MyExtendable {
|
||||
option (gogoproto.face) = false;
|
||||
optional int64 Field1 = 1;
|
||||
extensions 100 to 199;
|
||||
}
|
||||
|
||||
extend MyExtendable {
|
||||
optional double FieldA = 100;
|
||||
optional NinOptNative FieldB = 101;
|
||||
optional NinEmbeddedStruct FieldC = 102;
|
||||
repeated int64 FieldD = 104;
|
||||
repeated NinOptNative FieldE = 105;
|
||||
}
|
||||
|
||||
message OtherExtenable {
|
||||
option (gogoproto.face) = false;
|
||||
optional int64 Field2 = 2;
|
||||
extensions 14 to 16;
|
||||
optional int64 Field13 = 13;
|
||||
extensions 10 to 12;
|
||||
optional MyExtendable M = 1;
|
||||
}
|
||||
|
||||
message NestedDefinition {
|
||||
optional int64 Field1 = 1;
|
||||
message NestedMessage {
|
||||
optional fixed64 NestedField1 = 1;
|
||||
optional NestedNestedMsg NNM = 2;
|
||||
message NestedNestedMsg {
|
||||
optional string NestedNestedField1 = 10;
|
||||
}
|
||||
}
|
||||
enum NestedEnum {
|
||||
TYPE_NESTED = 1;
|
||||
}
|
||||
optional NestedEnum EnumField = 2;
|
||||
optional NestedMessage.NestedNestedMsg NNM = 3;
|
||||
optional NestedMessage NM = 4;
|
||||
}
|
||||
|
||||
message NestedScope {
|
||||
optional NestedDefinition.NestedMessage.NestedNestedMsg A = 1;
|
||||
optional NestedDefinition.NestedEnum B = 2;
|
||||
optional NestedDefinition.NestedMessage C = 3;
|
||||
}
|
||||
|
||||
message NinOptNativeDefault {
|
||||
option (gogoproto.goproto_getters) = true;
|
||||
option (gogoproto.face) = false;
|
||||
optional double Field1 = 1 [default = 1234.1234];
|
||||
optional float Field2 = 2 [default = 1234.1234];
|
||||
optional int32 Field3 = 3 [default = 1234];
|
||||
optional int64 Field4 = 4 [default = 1234];
|
||||
optional uint32 Field5 = 5 [default = 1234];
|
||||
optional uint64 Field6 = 6 [default = 1234];
|
||||
optional sint32 Field7 = 7 [default = 1234];
|
||||
optional sint64 Field8 = 8 [default = 1234];
|
||||
optional fixed32 Field9 = 9 [default = 1234];
|
||||
optional sfixed32 Field10 = 10 [default = 1234];
|
||||
optional fixed64 Field11 = 11 [default = 1234];
|
||||
optional sfixed64 Field12 = 12 [default = 1234];
|
||||
optional bool Field13 = 13 [default = true];
|
||||
optional string Field14 = 14 [default = "1234"];
|
||||
optional bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message CustomContainer {
|
||||
optional NidOptCustom CustomStruct = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message CustomNameNidOptNative {
|
||||
optional double Field1 = 1 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldA"];
|
||||
optional float Field2 = 2 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldB"];
|
||||
optional int32 Field3 = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldC"];
|
||||
optional int64 Field4 = 4 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldD"];
|
||||
optional uint32 Field5 = 5 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldE"];
|
||||
optional uint64 Field6 = 6 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldF"];
|
||||
optional sint32 Field7 = 7 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldG"];
|
||||
optional sint64 Field8 = 8 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldH"];
|
||||
optional fixed32 Field9 = 9 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldI"];
|
||||
optional sfixed32 Field10 = 10 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldJ"];
|
||||
optional fixed64 Field11 = 11 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldK"];
|
||||
optional sfixed64 Field12 = 12 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldL"];
|
||||
optional bool Field13 = 13 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldM"];
|
||||
optional string Field14 = 14 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldN"];
|
||||
optional bytes Field15 = 15 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldO"];
|
||||
}
|
||||
|
||||
message CustomNameNinOptNative {
|
||||
optional double Field1 = 1 [(gogoproto.customname) = "FieldA"];
|
||||
optional float Field2 = 2 [(gogoproto.customname) = "FieldB"];
|
||||
optional int32 Field3 = 3 [(gogoproto.customname) = "FieldC"];
|
||||
optional int64 Field4 = 4 [(gogoproto.customname) = "FieldD"];
|
||||
optional uint32 Field5 = 5 [(gogoproto.customname) = "FieldE"];
|
||||
optional uint64 Field6 = 6 [(gogoproto.customname) = "FieldF"];
|
||||
optional sint32 Field7 = 7 [(gogoproto.customname) = "FieldG"];
|
||||
optional sint64 Field8 = 8 [(gogoproto.customname) = "FieldH"];
|
||||
optional fixed32 Field9 = 9 [(gogoproto.customname) = "FieldI"];
|
||||
optional sfixed32 Field10 = 10 [(gogoproto.customname) = "FieldJ"];
|
||||
optional fixed64 Field11 = 11 [(gogoproto.customname) = "FieldK"];
|
||||
optional sfixed64 Field12 = 12 [(gogoproto.customname) = "FielL"];
|
||||
optional bool Field13 = 13 [(gogoproto.customname) = "FieldM"];
|
||||
optional string Field14 = 14 [(gogoproto.customname) = "FieldN"];
|
||||
optional bytes Field15 = 15 [(gogoproto.customname) = "FieldO"];
|
||||
}
|
||||
|
||||
message CustomNameNinRepNative {
|
||||
repeated double Field1 = 1 [(gogoproto.customname) = "FieldA"];
|
||||
repeated float Field2 = 2 [(gogoproto.customname) = "FieldB"];
|
||||
repeated int32 Field3 = 3 [(gogoproto.customname) = "FieldC"];
|
||||
repeated int64 Field4 = 4 [(gogoproto.customname) = "FieldD"];
|
||||
repeated uint32 Field5 = 5 [(gogoproto.customname) = "FieldE"];
|
||||
repeated uint64 Field6 = 6 [(gogoproto.customname) = "FieldF"];
|
||||
repeated sint32 Field7 = 7 [(gogoproto.customname) = "FieldG"];
|
||||
repeated sint64 Field8 = 8 [(gogoproto.customname) = "FieldH"];
|
||||
repeated fixed32 Field9 = 9 [(gogoproto.customname) = "FieldI"];
|
||||
repeated sfixed32 Field10 = 10 [(gogoproto.customname) = "FieldJ"];
|
||||
repeated fixed64 Field11 = 11 [(gogoproto.customname) = "FieldK"];
|
||||
repeated sfixed64 Field12 = 12 [(gogoproto.customname) = "FieldL"];
|
||||
repeated bool Field13 = 13 [(gogoproto.customname) = "FieldM"];
|
||||
repeated string Field14 = 14 [(gogoproto.customname) = "FieldN"];
|
||||
repeated bytes Field15 = 15 [(gogoproto.customname) = "FieldO"];
|
||||
}
|
||||
|
||||
message CustomNameNinStruct {
|
||||
optional double Field1 = 1 [(gogoproto.customname) = "FieldA"];
|
||||
optional float Field2 = 2 [(gogoproto.customname) = "FieldB"];
|
||||
optional NidOptNative Field3 = 3 [(gogoproto.customname) = "FieldC"];
|
||||
repeated NinOptNative Field4 = 4 [(gogoproto.customname) = "FieldD"];
|
||||
optional uint64 Field6 = 6 [(gogoproto.customname) = "FieldE"];
|
||||
optional sint32 Field7 = 7 [(gogoproto.customname) = "FieldF"];
|
||||
optional NidOptNative Field8 = 8 [(gogoproto.customname) = "FieldG"];
|
||||
optional bool Field13 = 13 [(gogoproto.customname) = "FieldH"];
|
||||
optional string Field14 = 14 [(gogoproto.customname) = "FieldI"];
|
||||
optional bytes Field15 = 15 [(gogoproto.customname) = "FieldJ"];
|
||||
}
|
||||
|
||||
message CustomNameCustomType {
|
||||
optional bytes Id = 1 [(gogoproto.customname) = "FieldA", (gogoproto.customtype) = "Uuid"];
|
||||
optional bytes Value = 2 [(gogoproto.customname) = "FieldB", (gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128"];
|
||||
repeated bytes Ids = 3 [(gogoproto.customname) = "FieldC", (gogoproto.customtype) = "Uuid"];
|
||||
repeated bytes Values = 4 [(gogoproto.customname) = "FieldD", (gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128"];
|
||||
}
|
||||
|
||||
message CustomNameNinEmbeddedStructUnion {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional NidOptNative Field1 = 1 [(gogoproto.embed) = true];
|
||||
optional NinOptNative Field200 = 200 [(gogoproto.customname) = "FieldA"];
|
||||
optional bool Field210 = 210 [(gogoproto.customname) = "FieldB"];
|
||||
}
|
||||
|
||||
message CustomNameEnum {
|
||||
optional TheTestEnum Field1 = 1 [(gogoproto.customname) = "FieldA"];
|
||||
repeated TheTestEnum Field2 = 2 [(gogoproto.customname) = "FieldB"];
|
||||
}
|
||||
|
||||
message NoExtensionsMap {
|
||||
option (gogoproto.face) = false;
|
||||
option (gogoproto.goproto_extensions_map) = false;
|
||||
optional int64 Field1 = 1;
|
||||
extensions 100 to 199;
|
||||
}
|
||||
|
||||
extend NoExtensionsMap {
|
||||
optional double FieldA1 = 100;
|
||||
optional NinOptNative FieldB1 = 101;
|
||||
optional NinEmbeddedStruct FieldC1 = 102;
|
||||
}
|
||||
|
||||
message Unrecognized {
|
||||
option (gogoproto.goproto_unrecognized) = false;
|
||||
optional string Field1 = 1;
|
||||
}
|
||||
|
||||
message UnrecognizedWithInner {
|
||||
message Inner {
|
||||
option (gogoproto.goproto_unrecognized) = false;
|
||||
optional uint32 Field1 = 1;
|
||||
}
|
||||
|
||||
repeated Inner embedded = 1;
|
||||
optional string Field2 = 2;
|
||||
}
|
||||
|
||||
message UnrecognizedWithEmbed {
|
||||
message Embedded {
|
||||
option (gogoproto.goproto_unrecognized) = false;
|
||||
optional uint32 Field1 = 1;
|
||||
}
|
||||
|
||||
optional Embedded embedded = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
|
||||
optional string Field2 = 2;
|
||||
}
|
||||
|
||||
message Node {
|
||||
optional string Label = 1;
|
||||
repeated Node Children = 2;
|
||||
}
|
||||
|
||||
message NonByteCustomType {
|
||||
optional ProtoType Field1 = 1 [(gogoproto.customtype) = "T"];
|
||||
}
|
||||
|
||||
message NidOptNonByteCustomType {
|
||||
optional ProtoType Field1 = 1 [(gogoproto.customtype) = "T", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinOptNonByteCustomType {
|
||||
optional ProtoType Field1 = 1 [(gogoproto.customtype) = "T"];
|
||||
}
|
||||
|
||||
message NidRepNonByteCustomType {
|
||||
repeated ProtoType Field1 = 1 [(gogoproto.customtype) = "T", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinRepNonByteCustomType {
|
||||
repeated ProtoType Field1 = 1 [(gogoproto.customtype) = "T"];
|
||||
}
|
||||
|
||||
message ProtoType {
|
||||
optional string Field2 = 1;
|
||||
}
|
17878
vendor/github.com/gogo/protobuf/test/combos/marshaler/thetestpb_test.go
generated
vendored
Normal file
17878
vendor/github.com/gogo/protobuf/test/combos/marshaler/thetestpb_test.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
137
vendor/github.com/gogo/protobuf/test/combos/marshaler/uuid.go
generated
vendored
Normal file
137
vendor/github.com/gogo/protobuf/test/combos/marshaler/uuid.go
generated
vendored
Normal file
@ -0,0 +1,137 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
func PutLittleEndianUint64(b []byte, offset int, v uint64) {
|
||||
b[offset] = byte(v)
|
||||
b[offset+1] = byte(v >> 8)
|
||||
b[offset+2] = byte(v >> 16)
|
||||
b[offset+3] = byte(v >> 24)
|
||||
b[offset+4] = byte(v >> 32)
|
||||
b[offset+5] = byte(v >> 40)
|
||||
b[offset+6] = byte(v >> 48)
|
||||
b[offset+7] = byte(v >> 56)
|
||||
}
|
||||
|
||||
type Uuid []byte
|
||||
|
||||
func (uuid Uuid) Bytes() []byte {
|
||||
return uuid
|
||||
}
|
||||
|
||||
func (uuid Uuid) Marshal() ([]byte, error) {
|
||||
if len(uuid) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
return []byte(uuid), nil
|
||||
}
|
||||
|
||||
func (uuid Uuid) MarshalTo(data []byte) (n int, err error) {
|
||||
if len(uuid) == 0 {
|
||||
return 0, nil
|
||||
}
|
||||
copy(data, uuid)
|
||||
return 16, nil
|
||||
}
|
||||
|
||||
func (uuid *Uuid) Unmarshal(data []byte) error {
|
||||
if len(data) == 0 {
|
||||
uuid = nil
|
||||
return nil
|
||||
}
|
||||
id := Uuid(make([]byte, 16))
|
||||
copy(id, data)
|
||||
*uuid = id
|
||||
return nil
|
||||
}
|
||||
|
||||
func (uuid *Uuid) Size() int {
|
||||
if uuid == nil {
|
||||
return 0
|
||||
}
|
||||
if len(*uuid) == 0 {
|
||||
return 0
|
||||
}
|
||||
return 16
|
||||
}
|
||||
|
||||
func (uuid Uuid) MarshalJSON() ([]byte, error) {
|
||||
s := hex.EncodeToString([]byte(uuid))
|
||||
return json.Marshal(s)
|
||||
}
|
||||
|
||||
func (uuid *Uuid) UnmarshalJSON(data []byte) error {
|
||||
var s string
|
||||
err := json.Unmarshal(data, &s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
d, err := hex.DecodeString(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*uuid = Uuid(d)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (uuid Uuid) Equal(other Uuid) bool {
|
||||
return bytes.Equal(uuid[0:], other[0:])
|
||||
}
|
||||
|
||||
func (uuid Uuid) Compare(other Uuid) int {
|
||||
return bytes.Compare(uuid[0:], other[0:])
|
||||
}
|
||||
|
||||
type int63 interface {
|
||||
Int63() int64
|
||||
}
|
||||
|
||||
func NewPopulatedUuid(r int63) *Uuid {
|
||||
u := RandV4(r)
|
||||
return &u
|
||||
}
|
||||
|
||||
func RandV4(r int63) Uuid {
|
||||
uuid := make(Uuid, 16)
|
||||
uuid.RandV4(r)
|
||||
return uuid
|
||||
}
|
||||
|
||||
func (uuid Uuid) RandV4(r int63) {
|
||||
PutLittleEndianUint64(uuid, 0, uint64(r.Int63()))
|
||||
PutLittleEndianUint64(uuid, 8, uint64(r.Int63()))
|
||||
uuid[6] = (uuid[6] & 0xf) | 0x40
|
||||
uuid[8] = (uuid[8] & 0x3f) | 0x80
|
||||
}
|
252
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/bug_test.go
generated
vendored
Normal file
252
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/bug_test.go
generated
vendored
Normal file
@ -0,0 +1,252 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"math"
|
||||
"math/rand"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
)
|
||||
|
||||
//http://code.google.com/p/goprotobuf/issues/detail?id=39
|
||||
func TestBugUint32VarintSize(t *testing.T) {
|
||||
temp := uint32(math.MaxUint32)
|
||||
n := &NinOptNative{}
|
||||
n.Field5 = &temp
|
||||
data, err := proto.Marshal(n)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if len(data) != 6 {
|
||||
t.Fatalf("data should be length 6, but its %#v", data)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBugZeroLengthSliceSize(t *testing.T) {
|
||||
n := &NinRepPackedNative{
|
||||
Field8: []int64{},
|
||||
}
|
||||
size := n.Size()
|
||||
data, err := proto.Marshal(n)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if len(data) != size {
|
||||
t.Fatalf("expected %v, but got %v", len(data), size)
|
||||
}
|
||||
}
|
||||
|
||||
//http://code.google.com/p/goprotobuf/issues/detail?id=40
|
||||
func TestBugPackedProtoSize(t *testing.T) {
|
||||
n := &NinRepPackedNative{
|
||||
Field4: []int64{172960727389894724, 2360337516664475010, 860833876131988189, 9068073014890763245, 7794843386260381831, 4023536436053141786, 8992311247496919020, 4330096163611305776, 4490411416244976467, 7873947349172707443, 2754969595834279669, 1360667855926938684, 4771480785172657389, 4875578924966668055, 8070579869808877481, 9128179594766551001, 4630419407064527516, 863844540220372892, 8208727650143073487, 7086117356301045838, 7779695211931506151, 5493835345187563535, 9119767633370806007, 9054342025895349248, 1887303228838508438, 7624573031734528281, 1874668389749611225, 3517684643468970593, 6677697606628877758, 7293473953189936168, 444475066704085538, 8594971141363049302, 1146643249094989673, 733393306232853371, 7721178528893916886, 7784452000911004429, 6436373110242711440, 6897422461738321237, 8772249155667732778, 6211871464311393541, 3061903718310406883, 7845488913176136641, 8342255034663902574, 3443058984649725748, 8410801047334832902, 7496541071517841153, 4305416923521577765, 7814967600020476457, 8671843803465481186, 3490266370361096855, 1447425664719091336, 653218597262334239, 8306243902880091940, 7851896059762409081, 5936760560798954978, 5755724498441478025, 7022701569985035966, 3707709584811468220, 529069456924666920, 7986469043681522462, 3092513330689518836, 5103541550470476202, 3577384161242626406, 3733428084624703294, 8388690542440473117, 3262468785346149388, 8788358556558007570, 5476276940198542020, 7277903243119461239, 5065861426928605020, 7533460976202697734, 1749213838654236956, 557497603941617931, 5496307611456481108, 6444547750062831720, 6992758776744205596, 7356719693428537399, 2896328872476734507, 381447079530132038, 598300737753233118, 3687980626612697715, 7240924191084283349, 8172414415307971170, 4847024388701257185, 2081764168600256551, 3394217778539123488, 6244660626429310923, 8301712215675381614, 5360615125359461174, 8410140945829785773, 3152963269026381373, 6197275282781459633, 4419829061407546410, 6262035523070047537, 2837207483933463885, 2158105736666826128, 8150764172235490711},
|
||||
Field7: []int32{249451845, 1409974015, 393609128, 435232428, 1817529040, 91769006, 861170933, 1556185603, 1568580279, 1236375273, 512276621, 693633711, 967580535, 1950715977, 853431462, 1362390253, 159591204, 111900629, 322985263, 279671129, 1592548430, 465651370, 733849989, 1172059400, 1574824441, 263541092, 1271612397, 1520584358, 467078791, 117698716, 1098255064, 2054264846, 1766452305, 1267576395, 1557505617, 1187833560, 956187431, 1970977586, 1160235159, 1610259028, 489585797, 459139078, 566263183, 954319278, 1545018565, 1753946743, 948214318, 422878159, 883926576, 1424009347, 824732372, 1290433180, 80297942, 417294230, 1402647904, 2078392782, 220505045, 787368129, 463781454, 293083578, 808156928, 293976361},
|
||||
Field9: []uint32{0xaa4976e8, 0x3da8cc4c, 0x8c470d83, 0x344d964e, 0x5b90925, 0xa4c4d34e, 0x666eff19, 0xc238e552, 0x9be53bb6, 0x56364245, 0x33ee079d, 0x96bf0ede, 0x7941b74f, 0xdb07cb47, 0x6d76d827, 0x9b211d5d, 0x2798adb6, 0xe48b0c3b, 0x87061b21, 0x48f4e4d2, 0x3e5d5c12, 0x5ee91288, 0x336d4f35, 0xe1d44941, 0xc065548d, 0x2953d73f, 0x873af451, 0xfc769db, 0x9f1bf8da, 0x9baafdfc, 0xf1d3d770, 0x5bb5d2b4, 0xc2c67c48, 0x6845c4c1, 0xa48f32b0, 0xbb04bb70, 0xa5b1ca36, 0x8d98356a, 0x2171f654, 0x5ae279b0, 0x6c4a3d6b, 0x4fff5468, 0xcf9bf851, 0x68513614, 0xdbecd9b0, 0x9553ed3c, 0xa494a736, 0x42205438, 0xbf8e5caa, 0xd3283c6, 0x76d20788, 0x9179826f, 0x96b24f85, 0xbc2eacf4, 0xe4afae0b, 0x4bca85cb, 0x35e63b5b, 0xd7ccee0c, 0x2b506bb9, 0xe78e9f44, 0x9ad232f1, 0x99a37335, 0xa5d6ffc8},
|
||||
Field11: []uint64{0x53c01ebc, 0x4fb85ba6, 0x8805eea1, 0xb20ec896, 0x93b63410, 0xec7c9492, 0x50765a28, 0x19592106, 0x2ecc59b3, 0x39cd474f, 0xe4c9e47, 0x444f48c5, 0xe7731d32, 0xf3f43975, 0x603caedd, 0xbb05a1af, 0xa808e34e, 0x88580b07, 0x4c96bbd1, 0x730b4ab9, 0xed126e2b, 0x6db48205, 0x154ba1b9, 0xc26bfb6a, 0x389aa052, 0x869d966c, 0x7c86b366, 0xcc8edbcd, 0xfa8d6dad, 0xcf5857d9, 0x2d9cda0f, 0x1218a0b8, 0x41bf997, 0xf0ca65ac, 0xa610d4b9, 0x8d362e28, 0xb7212d87, 0x8e0fe109, 0xbee041d9, 0x759be2f6, 0x35fef4f3, 0xaeacdb71, 0x10888852, 0xf4e28117, 0xe2a14812, 0x73b748dc, 0xd1c3c6b2, 0xfef41bf0, 0xc9b43b62, 0x810e4faa, 0xcaa41c06, 0x1893fe0d, 0xedc7c850, 0xd12b9eaa, 0x467ee1a9, 0xbe84756b, 0xda7b1680, 0xdc069ffe, 0xf1e7e9f9, 0xb3d95370, 0xa92b77df, 0x5693ac41, 0xd04b7287, 0x27aebf15, 0x837b316e, 0x4dbe2263, 0xbab70c67, 0x547dab21, 0x3c346c1f, 0xb8ef0e4e, 0xfe2d03ce, 0xe1d75955, 0xfec1306, 0xba35c23e, 0xb784ed04, 0x2a4e33aa, 0x7e19d09a, 0x3827c1fe, 0xf3a51561, 0xef765e2b, 0xb044256c, 0x62b322be, 0xf34d56be, 0xeb71b369, 0xffe1294f, 0x237fe8d0, 0x77a1473b, 0x239e1196, 0xdd19bf3d, 0x82c91fe1, 0x95361c57, 0xffea3f1b, 0x1a094c84},
|
||||
Field12: []int64{8308420747267165049, 3664160795077875961, 7868970059161834817, 7237335984251173739, 5254748003907196506, 3362259627111837480, 430460752854552122, 5119635556501066533, 1277716037866233522, 9185775384759813768, 833932430882717888, 7986528304451297640, 6792233378368656337, 2074207091120609721, 1788723326198279432, 7756514594746453657, 2283775964901597324, 3061497730110517191, 7733947890656120277, 626967303632386244, 7822928600388582821, 3489658753000061230, 168869995163005961, 248814782163480763, 477885608911386247, 4198422415674133867, 3379354662797976109, 9925112544736939, 1486335136459138480, 4561560414032850671, 1010864164014091267, 186722821683803084, 5106357936724819318, 1298160820191228988, 4675403242419953145, 7130634540106489752, 7101280006672440929, 7176058292431955718, 9109875054097770321, 6810974877085322872, 4736707874303993641, 8993135362721382187, 6857881554990254283, 3704748883307461680, 1099360832887634994, 5207691918707192633, 5984721695043995243},
|
||||
}
|
||||
size := proto.Size(n)
|
||||
data, err := proto.Marshal(n)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
if len(data) != size {
|
||||
t.Fatalf("expected %v, but got %v diff is %v", len(data), size, len(data)-size)
|
||||
}
|
||||
}
|
||||
|
||||
func testSize(m interface {
|
||||
proto.Message
|
||||
Size() int
|
||||
}, desc string, expected int) ([]byte, error) {
|
||||
data, err := proto.Marshal(m)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
protoSize := proto.Size(m)
|
||||
mSize := m.Size()
|
||||
lenData := len(data)
|
||||
if protoSize != mSize || protoSize != lenData || mSize != lenData {
|
||||
return nil, fmt.Errorf("%s proto.Size(m){%d} != m.Size(){%d} != len(data){%d}", desc, protoSize, mSize, lenData)
|
||||
}
|
||||
if got := protoSize; got != expected {
|
||||
return nil, fmt.Errorf("%s proto.Size(m) got %d expected %d", desc, got, expected)
|
||||
}
|
||||
if got := mSize; got != expected {
|
||||
return nil, fmt.Errorf("%s m.Size() got %d expected %d", desc, got, expected)
|
||||
}
|
||||
if got := lenData; got != expected {
|
||||
return nil, fmt.Errorf("%s len(data) got %d expected %d", desc, got, expected)
|
||||
}
|
||||
return data, nil
|
||||
}
|
||||
|
||||
func TestInt32Int64Compatibility(t *testing.T) {
|
||||
|
||||
//test nullable int32 and int64
|
||||
|
||||
data1, err := testSize(&NinOptNative{
|
||||
Field3: proto.Int32(-1),
|
||||
}, "nullable", 11)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
//change marshaled data1 to unmarshal into 4th field which is an int64
|
||||
data1[0] = uint8(uint32(4 /*fieldNumber*/)<<3 | uint32(0 /*wireType*/))
|
||||
u1 := &NinOptNative{}
|
||||
if err = proto.Unmarshal(data1, u1); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if !u1.Equal(&NinOptNative{
|
||||
Field4: proto.Int64(-1),
|
||||
}) {
|
||||
t.Error("nullable unmarshaled int32 is not the same int64")
|
||||
}
|
||||
|
||||
//test non-nullable int32 and int64
|
||||
|
||||
data2, err := testSize(&NidOptNative{
|
||||
Field3: -1,
|
||||
}, "non nullable", 67)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
//change marshaled data2 to unmarshal into 4th field which is an int64
|
||||
field3 := uint8(uint32(3 /*fieldNumber*/)<<3 | uint32(0 /*wireType*/))
|
||||
field4 := uint8(uint32(4 /*fieldNumber*/)<<3 | uint32(0 /*wireType*/))
|
||||
for i, c := range data2 {
|
||||
if c == field4 {
|
||||
data2[i] = field3
|
||||
} else if c == field3 {
|
||||
data2[i] = field4
|
||||
}
|
||||
}
|
||||
u2 := &NidOptNative{}
|
||||
if err = proto.Unmarshal(data2, u2); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if !u2.Equal(&NidOptNative{
|
||||
Field4: -1,
|
||||
}) {
|
||||
t.Error("non nullable unmarshaled int32 is not the same int64")
|
||||
}
|
||||
|
||||
//test packed repeated int32 and int64
|
||||
|
||||
m4 := &NinRepPackedNative{
|
||||
Field3: []int32{-1},
|
||||
}
|
||||
data4, err := testSize(m4, "packed", 12)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
u4 := &NinRepPackedNative{}
|
||||
if err := proto.Unmarshal(data4, u4); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if err := u4.VerboseEqual(m4); err != nil {
|
||||
t.Fatalf("%#v", u4)
|
||||
}
|
||||
|
||||
//test repeated int32 and int64
|
||||
|
||||
if _, err := testSize(&NinRepNative{
|
||||
Field3: []int32{-1},
|
||||
}, "repeated", 11); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
t.Logf("tested all")
|
||||
}
|
||||
|
||||
func TestRepeatedExtensionsMsgsIssue161(t *testing.T) {
|
||||
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
rep := 10
|
||||
nins := make([]*NinOptNative, rep)
|
||||
for i := range nins {
|
||||
nins[i] = NewPopulatedNinOptNative(r, true)
|
||||
}
|
||||
input := &MyExtendable{}
|
||||
if err := proto.SetExtension(input, E_FieldE, nins); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
data, err := proto.Marshal(input)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
output := &MyExtendable{}
|
||||
if err := proto.Unmarshal(data, output); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !input.Equal(output) {
|
||||
t.Fatalf("want %#v but got %#v", input, output)
|
||||
}
|
||||
data2, err2 := proto.Marshal(output)
|
||||
if err2 != nil {
|
||||
t.Fatal(err2)
|
||||
}
|
||||
if len(data) != len(data2) {
|
||||
t.Fatal("expected equal length buffers")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRepeatedExtensionsFieldsIssue161(t *testing.T) {
|
||||
r := rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
rep := 10
|
||||
ints := make([]int64, rep)
|
||||
for i := range ints {
|
||||
ints[i] = r.Int63()
|
||||
}
|
||||
input := &MyExtendable{}
|
||||
if err := proto.SetExtension(input, E_FieldD, ints); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
data, err := proto.Marshal(input)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
output := &MyExtendable{}
|
||||
if err := proto.Unmarshal(data, output); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !input.Equal(output) {
|
||||
t.Fatalf("want %#v but got %#v", input, output)
|
||||
}
|
||||
data2, err2 := proto.Marshal(output)
|
||||
if err2 != nil {
|
||||
t.Fatal(err2)
|
||||
}
|
||||
if len(data) != len(data2) {
|
||||
t.Fatal("expected equal length buffers")
|
||||
}
|
||||
}
|
73
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/t.go
generated
vendored
Normal file
73
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/t.go
generated
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"github.com/gogo/protobuf/proto"
|
||||
)
|
||||
|
||||
type T struct {
|
||||
Data string
|
||||
}
|
||||
|
||||
func (gt *T) protoType() *ProtoType {
|
||||
return &ProtoType{
|
||||
Field2: >.Data,
|
||||
}
|
||||
}
|
||||
|
||||
func (gt T) Equal(other T) bool {
|
||||
return gt.protoType().Equal(other.protoType())
|
||||
}
|
||||
|
||||
func (gt *T) Size() int {
|
||||
proto := &ProtoType{
|
||||
Field2: >.Data,
|
||||
}
|
||||
return proto.Size()
|
||||
}
|
||||
|
||||
func NewPopulatedT(r randyThetest) *T {
|
||||
data := NewPopulatedProtoType(r, false).Field2
|
||||
gt := &T{}
|
||||
if data != nil {
|
||||
gt.Data = *data
|
||||
}
|
||||
return gt
|
||||
}
|
||||
|
||||
func (r T) Marshal() ([]byte, error) {
|
||||
return proto.Marshal(r.protoType())
|
||||
}
|
||||
|
||||
func (r *T) Unmarshal(data []byte) error {
|
||||
pr := &ProtoType{}
|
||||
err := proto.Unmarshal(data, pr)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if pr.Field2 != nil {
|
||||
r.Data = *pr.Field2
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (gt T) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(gt.Data)
|
||||
}
|
||||
|
||||
func (gt *T) UnmarshalJSON(data []byte) error {
|
||||
var s string
|
||||
err := json.Unmarshal(data, &s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*gt = T{Data: s}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (gt T) Compare(other T) int {
|
||||
return strings.Compare(gt.Data, other.Data)
|
||||
}
|
41441
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/thetest.pb.go
generated
vendored
Normal file
41441
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/thetest.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
649
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/thetest.proto
generated
vendored
Normal file
649
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/thetest.proto
generated
vendored
Normal file
@ -0,0 +1,649 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
package test;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.goproto_stringer_all) = false;
|
||||
option (gogoproto.goproto_enum_prefix_all) = false;
|
||||
option (gogoproto.goproto_getters_all) = false;
|
||||
|
||||
option (gogoproto.equal_all) = true;
|
||||
option (gogoproto.verbose_equal_all) = true;
|
||||
option (gogoproto.stringer_all) = true;
|
||||
option (gogoproto.gostring_all) = true;
|
||||
option (gogoproto.face_all) = true;
|
||||
option (gogoproto.description_all) = true;
|
||||
|
||||
option (gogoproto.testgen_all) = true;
|
||||
option (gogoproto.populate_all) = true;
|
||||
option (gogoproto.benchgen_all) = true;
|
||||
option (gogoproto.unmarshaler_all) = true;
|
||||
option (gogoproto.marshaler_all) = false;
|
||||
option (gogoproto.sizer_all) = true;
|
||||
option (gogoproto.protosizer_all) = false;
|
||||
|
||||
option (gogoproto.goproto_enum_stringer_all) = false;
|
||||
option (gogoproto.enum_stringer_all) = true;
|
||||
|
||||
option (gogoproto.unsafe_marshaler_all) = false;
|
||||
option (gogoproto.unsafe_unmarshaler_all) = false;
|
||||
|
||||
option (gogoproto.compare_all) = true;
|
||||
|
||||
message NidOptNative {
|
||||
optional double Field1 = 1 [(gogoproto.nullable) = false];
|
||||
optional float Field2 = 2 [(gogoproto.nullable) = false];
|
||||
optional int32 Field3 = 3 [(gogoproto.nullable) = false];
|
||||
optional int64 Field4 = 4 [(gogoproto.nullable) = false];
|
||||
optional uint32 Field5 = 5 [(gogoproto.nullable) = false];
|
||||
optional uint64 Field6 = 6 [(gogoproto.nullable) = false];
|
||||
optional sint32 Field7 = 7 [(gogoproto.nullable) = false];
|
||||
optional sint64 Field8 = 8 [(gogoproto.nullable) = false];
|
||||
optional fixed32 Field9 = 9 [(gogoproto.nullable) = false];
|
||||
optional sfixed32 Field10 = 10 [(gogoproto.nullable) = false];
|
||||
optional fixed64 Field11 = 11 [(gogoproto.nullable) = false];
|
||||
optional sfixed64 Field12 = 12 [(gogoproto.nullable) = false];
|
||||
optional bool Field13 = 13 [(gogoproto.nullable) = false];
|
||||
optional string Field14 = 14 [(gogoproto.nullable) = false];
|
||||
optional bytes Field15 = 15 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinOptNative {
|
||||
optional double Field1 = 1;
|
||||
optional float Field2 = 2;
|
||||
optional int32 Field3 = 3;
|
||||
optional int64 Field4 = 4;
|
||||
optional uint32 Field5 = 5;
|
||||
optional uint64 Field6 = 6;
|
||||
optional sint32 Field7 = 7;
|
||||
optional sint64 Field8 = 8;
|
||||
optional fixed32 Field9 = 9;
|
||||
optional sfixed32 Field10 = 10;
|
||||
optional fixed64 Field11 = 11;
|
||||
optional sfixed64 Field12 = 12;
|
||||
optional bool Field13 = 13;
|
||||
optional string Field14 = 14;
|
||||
optional bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NidRepNative {
|
||||
repeated double Field1 = 1 [(gogoproto.nullable) = false];
|
||||
repeated float Field2 = 2 [(gogoproto.nullable) = false];
|
||||
repeated int32 Field3 = 3 [(gogoproto.nullable) = false];
|
||||
repeated int64 Field4 = 4 [(gogoproto.nullable) = false];
|
||||
repeated uint32 Field5 = 5 [(gogoproto.nullable) = false];
|
||||
repeated uint64 Field6 = 6 [(gogoproto.nullable) = false];
|
||||
repeated sint32 Field7 = 7 [(gogoproto.nullable) = false];
|
||||
repeated sint64 Field8 = 8 [(gogoproto.nullable) = false];
|
||||
repeated fixed32 Field9 = 9 [(gogoproto.nullable) = false];
|
||||
repeated sfixed32 Field10 = 10 [(gogoproto.nullable) = false];
|
||||
repeated fixed64 Field11 = 11 [(gogoproto.nullable) = false];
|
||||
repeated sfixed64 Field12 = 12 [(gogoproto.nullable) = false];
|
||||
repeated bool Field13 = 13 [(gogoproto.nullable) = false];
|
||||
repeated string Field14 = 14 [(gogoproto.nullable) = false];
|
||||
repeated bytes Field15 = 15 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinRepNative {
|
||||
repeated double Field1 = 1;
|
||||
repeated float Field2 = 2;
|
||||
repeated int32 Field3 = 3;
|
||||
repeated int64 Field4 = 4;
|
||||
repeated uint32 Field5 = 5;
|
||||
repeated uint64 Field6 = 6;
|
||||
repeated sint32 Field7 = 7;
|
||||
repeated sint64 Field8 = 8;
|
||||
repeated fixed32 Field9 = 9;
|
||||
repeated sfixed32 Field10 = 10;
|
||||
repeated fixed64 Field11 = 11;
|
||||
repeated sfixed64 Field12 = 12;
|
||||
repeated bool Field13 = 13;
|
||||
repeated string Field14 = 14;
|
||||
repeated bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NidRepPackedNative {
|
||||
repeated double Field1 = 1 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated float Field2 = 2 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated int32 Field3 = 3 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated int64 Field4 = 4 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated uint32 Field5 = 5 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated uint64 Field6 = 6 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated sint32 Field7 = 7 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated sint64 Field8 = 8 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated fixed32 Field9 = 9 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated sfixed32 Field10 = 10 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated fixed64 Field11 = 11 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated sfixed64 Field12 = 12 [(gogoproto.nullable) = false, packed = true];
|
||||
repeated bool Field13 = 13 [(gogoproto.nullable) = false, packed = true];
|
||||
}
|
||||
|
||||
message NinRepPackedNative {
|
||||
repeated double Field1 = 1 [packed = true];
|
||||
repeated float Field2 = 2 [packed = true];
|
||||
repeated int32 Field3 = 3 [packed = true];
|
||||
repeated int64 Field4 = 4 [packed = true];
|
||||
repeated uint32 Field5 = 5 [packed = true];
|
||||
repeated uint64 Field6 = 6 [packed = true];
|
||||
repeated sint32 Field7 = 7 [packed = true];
|
||||
repeated sint64 Field8 = 8 [packed = true];
|
||||
repeated fixed32 Field9 = 9 [packed = true];
|
||||
repeated sfixed32 Field10 = 10 [packed = true];
|
||||
repeated fixed64 Field11 = 11 [packed = true];
|
||||
repeated sfixed64 Field12 = 12 [packed = true];
|
||||
repeated bool Field13 = 13 [packed = true];
|
||||
}
|
||||
|
||||
message NidOptStruct {
|
||||
optional double Field1 = 1 [(gogoproto.nullable) = false];
|
||||
optional float Field2 = 2 [(gogoproto.nullable) = false];
|
||||
optional NidOptNative Field3 = 3 [(gogoproto.nullable) = false];
|
||||
optional NinOptNative Field4 = 4 [(gogoproto.nullable) = false];
|
||||
optional uint64 Field6 = 6 [(gogoproto.nullable) = false];
|
||||
optional sint32 Field7 = 7 [(gogoproto.nullable) = false];
|
||||
optional NidOptNative Field8 = 8 [(gogoproto.nullable) = false];
|
||||
optional bool Field13 = 13 [(gogoproto.nullable) = false];
|
||||
optional string Field14 = 14 [(gogoproto.nullable) = false];
|
||||
optional bytes Field15 = 15 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinOptStruct {
|
||||
optional double Field1 = 1;
|
||||
optional float Field2 = 2;
|
||||
optional NidOptNative Field3 = 3;
|
||||
optional NinOptNative Field4 = 4;
|
||||
optional uint64 Field6 = 6;
|
||||
optional sint32 Field7 = 7;
|
||||
optional NidOptNative Field8 = 8;
|
||||
optional bool Field13 = 13;
|
||||
optional string Field14 = 14;
|
||||
optional bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NidRepStruct {
|
||||
repeated double Field1 = 1 [(gogoproto.nullable) = false];
|
||||
repeated float Field2 = 2 [(gogoproto.nullable) = false];
|
||||
repeated NidOptNative Field3 = 3 [(gogoproto.nullable) = false];
|
||||
repeated NinOptNative Field4 = 4 [(gogoproto.nullable) = false];
|
||||
repeated uint64 Field6 = 6 [(gogoproto.nullable) = false];
|
||||
repeated sint32 Field7 = 7 [(gogoproto.nullable) = false];
|
||||
repeated NidOptNative Field8 = 8 [(gogoproto.nullable) = false];
|
||||
repeated bool Field13 = 13 [(gogoproto.nullable) = false];
|
||||
repeated string Field14 = 14 [(gogoproto.nullable) = false];
|
||||
repeated bytes Field15 = 15 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinRepStruct {
|
||||
repeated double Field1 = 1;
|
||||
repeated float Field2 = 2;
|
||||
repeated NidOptNative Field3 = 3;
|
||||
repeated NinOptNative Field4 = 4;
|
||||
repeated uint64 Field6 = 6;
|
||||
repeated sint32 Field7 = 7;
|
||||
repeated NidOptNative Field8 = 8;
|
||||
repeated bool Field13 = 13;
|
||||
repeated string Field14 = 14;
|
||||
repeated bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NidEmbeddedStruct {
|
||||
optional NidOptNative Field1 = 1 [(gogoproto.embed) = true];
|
||||
optional NidOptNative Field200 = 200 [(gogoproto.nullable) = false];
|
||||
optional bool Field210 = 210 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinEmbeddedStruct {
|
||||
optional NidOptNative Field1 = 1 [(gogoproto.embed) = true];
|
||||
optional NidOptNative Field200 = 200;
|
||||
optional bool Field210 = 210;
|
||||
}
|
||||
|
||||
message NidNestedStruct {
|
||||
optional NidOptStruct Field1 = 1 [(gogoproto.nullable) = false];
|
||||
repeated NidRepStruct Field2 = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinNestedStruct {
|
||||
optional NinOptStruct Field1 = 1;
|
||||
repeated NinRepStruct Field2 = 2;
|
||||
}
|
||||
|
||||
message NidOptCustom {
|
||||
optional bytes Id = 1 [(gogoproto.customtype) = "Uuid", (gogoproto.nullable) = false];
|
||||
optional bytes Value = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message CustomDash {
|
||||
optional bytes Value = 1 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom-dash-type.Bytes"];
|
||||
}
|
||||
|
||||
message NinOptCustom {
|
||||
optional bytes Id = 1 [(gogoproto.customtype) = "Uuid"];
|
||||
optional bytes Value = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128"];
|
||||
}
|
||||
|
||||
message NidRepCustom {
|
||||
repeated bytes Id = 1 [(gogoproto.customtype) = "Uuid", (gogoproto.nullable) = false];
|
||||
repeated bytes Value = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinRepCustom {
|
||||
repeated bytes Id = 1 [(gogoproto.customtype) = "Uuid"];
|
||||
repeated bytes Value = 2 [(gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128"];
|
||||
}
|
||||
|
||||
message NinOptNativeUnion {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional double Field1 = 1;
|
||||
optional float Field2 = 2;
|
||||
optional int32 Field3 = 3;
|
||||
optional int64 Field4 = 4;
|
||||
optional uint32 Field5 = 5;
|
||||
optional uint64 Field6 = 6;
|
||||
optional bool Field13 = 13;
|
||||
optional string Field14 = 14;
|
||||
optional bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NinOptStructUnion {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional double Field1 = 1;
|
||||
optional float Field2 = 2;
|
||||
optional NidOptNative Field3 = 3;
|
||||
optional NinOptNative Field4 = 4;
|
||||
optional uint64 Field6 = 6;
|
||||
optional sint32 Field7 = 7;
|
||||
optional bool Field13 = 13;
|
||||
optional string Field14 = 14;
|
||||
optional bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message NinEmbeddedStructUnion {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional NidOptNative Field1 = 1 [(gogoproto.embed) = true];
|
||||
optional NinOptNative Field200 = 200;
|
||||
optional bool Field210 = 210;
|
||||
}
|
||||
|
||||
message NinNestedStructUnion {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional NinOptNativeUnion Field1 = 1;
|
||||
optional NinOptStructUnion Field2 = 2;
|
||||
optional NinEmbeddedStructUnion Field3 = 3;
|
||||
}
|
||||
|
||||
message Tree {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional OrBranch Or = 1;
|
||||
optional AndBranch And = 2;
|
||||
optional Leaf Leaf = 3;
|
||||
}
|
||||
|
||||
message OrBranch {
|
||||
optional Tree Left = 1 [(gogoproto.nullable) = false];
|
||||
optional Tree Right = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message AndBranch {
|
||||
optional Tree Left = 1 [(gogoproto.nullable) = false];
|
||||
optional Tree Right = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message Leaf {
|
||||
optional int64 Value = 1 [(gogoproto.nullable) = false];
|
||||
optional string StrValue = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message DeepTree {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional ADeepBranch Down = 1;
|
||||
optional AndDeepBranch And = 2;
|
||||
optional DeepLeaf Leaf = 3;
|
||||
}
|
||||
|
||||
message ADeepBranch {
|
||||
optional DeepTree Down = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message AndDeepBranch {
|
||||
optional DeepTree Left = 1 [(gogoproto.nullable) = false];
|
||||
optional DeepTree Right = 2 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message DeepLeaf {
|
||||
optional Tree Tree = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message Nil {
|
||||
|
||||
}
|
||||
|
||||
enum TheTestEnum {
|
||||
A = 0;
|
||||
B = 1;
|
||||
C = 2;
|
||||
}
|
||||
|
||||
enum AnotherTestEnum {
|
||||
option (gogoproto.goproto_enum_prefix) = false;
|
||||
D = 10;
|
||||
E = 11;
|
||||
}
|
||||
|
||||
// YetAnotherTestEnum is used to test cross-package import of custom name
|
||||
// fields and default resolution.
|
||||
enum YetAnotherTestEnum {
|
||||
option (gogoproto.goproto_enum_prefix) = false;
|
||||
AA = 0;
|
||||
BB = 1 [(gogoproto.enumvalue_customname) = "BetterYetBB"];
|
||||
}
|
||||
|
||||
// YetAnotherTestEnum is used to test cross-package import of custom name
|
||||
// fields and default resolution.
|
||||
enum YetYetAnotherTestEnum {
|
||||
option (gogoproto.goproto_enum_prefix) = true;
|
||||
CC = 0;
|
||||
DD = 1 [(gogoproto.enumvalue_customname) = "BetterYetDD"];
|
||||
}
|
||||
|
||||
message NidOptEnum {
|
||||
optional TheTestEnum Field1 = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinOptEnum {
|
||||
optional TheTestEnum Field1 = 1;
|
||||
optional YetAnotherTestEnum Field2 = 2;
|
||||
optional YetYetAnotherTestEnum Field3 = 3;
|
||||
}
|
||||
|
||||
message NidRepEnum {
|
||||
repeated TheTestEnum Field1 = 1 [(gogoproto.nullable) = false];
|
||||
repeated YetAnotherTestEnum Field2 = 2 [(gogoproto.nullable) = false];
|
||||
repeated YetYetAnotherTestEnum Field3 = 3 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinRepEnum {
|
||||
repeated TheTestEnum Field1 = 1;
|
||||
repeated YetAnotherTestEnum Field2 = 2;
|
||||
repeated YetYetAnotherTestEnum Field3 = 3;
|
||||
}
|
||||
|
||||
message NinOptEnumDefault {
|
||||
option (gogoproto.goproto_getters) = true;
|
||||
option (gogoproto.face) = false;
|
||||
optional TheTestEnum Field1 = 1 [default=C];
|
||||
optional YetAnotherTestEnum Field2 = 2 [default=BB];
|
||||
optional YetYetAnotherTestEnum Field3 = 3 [default=CC];
|
||||
}
|
||||
|
||||
message AnotherNinOptEnum {
|
||||
optional AnotherTestEnum Field1 = 1;
|
||||
optional YetAnotherTestEnum Field2 = 2;
|
||||
optional YetYetAnotherTestEnum Field3 = 3;
|
||||
}
|
||||
|
||||
message AnotherNinOptEnumDefault {
|
||||
option (gogoproto.goproto_getters) = true;
|
||||
option (gogoproto.face) = false;
|
||||
optional AnotherTestEnum Field1 = 1 [default=E];
|
||||
optional YetAnotherTestEnum Field2 = 2 [default=BB];
|
||||
optional YetYetAnotherTestEnum Field3 = 3 [default=CC];
|
||||
}
|
||||
|
||||
|
||||
message Timer {
|
||||
optional sfixed64 Time1 = 1 [(gogoproto.nullable) = false];
|
||||
optional sfixed64 Time2 = 2 [(gogoproto.nullable) = false];
|
||||
optional bytes Data = 3 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message MyExtendable {
|
||||
option (gogoproto.face) = false;
|
||||
optional int64 Field1 = 1;
|
||||
extensions 100 to 199;
|
||||
}
|
||||
|
||||
extend MyExtendable {
|
||||
optional double FieldA = 100;
|
||||
optional NinOptNative FieldB = 101;
|
||||
optional NinEmbeddedStruct FieldC = 102;
|
||||
repeated int64 FieldD = 104;
|
||||
repeated NinOptNative FieldE = 105;
|
||||
}
|
||||
|
||||
message OtherExtenable {
|
||||
option (gogoproto.face) = false;
|
||||
optional int64 Field2 = 2;
|
||||
extensions 14 to 16;
|
||||
optional int64 Field13 = 13;
|
||||
extensions 10 to 12;
|
||||
optional MyExtendable M = 1;
|
||||
}
|
||||
|
||||
message NestedDefinition {
|
||||
optional int64 Field1 = 1;
|
||||
message NestedMessage {
|
||||
optional fixed64 NestedField1 = 1;
|
||||
optional NestedNestedMsg NNM = 2;
|
||||
message NestedNestedMsg {
|
||||
optional string NestedNestedField1 = 10;
|
||||
}
|
||||
}
|
||||
enum NestedEnum {
|
||||
TYPE_NESTED = 1;
|
||||
}
|
||||
optional NestedEnum EnumField = 2;
|
||||
optional NestedMessage.NestedNestedMsg NNM = 3;
|
||||
optional NestedMessage NM = 4;
|
||||
}
|
||||
|
||||
message NestedScope {
|
||||
optional NestedDefinition.NestedMessage.NestedNestedMsg A = 1;
|
||||
optional NestedDefinition.NestedEnum B = 2;
|
||||
optional NestedDefinition.NestedMessage C = 3;
|
||||
}
|
||||
|
||||
message NinOptNativeDefault {
|
||||
option (gogoproto.goproto_getters) = true;
|
||||
option (gogoproto.face) = false;
|
||||
optional double Field1 = 1 [default = 1234.1234];
|
||||
optional float Field2 = 2 [default = 1234.1234];
|
||||
optional int32 Field3 = 3 [default = 1234];
|
||||
optional int64 Field4 = 4 [default = 1234];
|
||||
optional uint32 Field5 = 5 [default = 1234];
|
||||
optional uint64 Field6 = 6 [default = 1234];
|
||||
optional sint32 Field7 = 7 [default = 1234];
|
||||
optional sint64 Field8 = 8 [default = 1234];
|
||||
optional fixed32 Field9 = 9 [default = 1234];
|
||||
optional sfixed32 Field10 = 10 [default = 1234];
|
||||
optional fixed64 Field11 = 11 [default = 1234];
|
||||
optional sfixed64 Field12 = 12 [default = 1234];
|
||||
optional bool Field13 = 13 [default = true];
|
||||
optional string Field14 = 14 [default = "1234"];
|
||||
optional bytes Field15 = 15;
|
||||
}
|
||||
|
||||
message CustomContainer {
|
||||
optional NidOptCustom CustomStruct = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message CustomNameNidOptNative {
|
||||
optional double Field1 = 1 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldA"];
|
||||
optional float Field2 = 2 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldB"];
|
||||
optional int32 Field3 = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldC"];
|
||||
optional int64 Field4 = 4 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldD"];
|
||||
optional uint32 Field5 = 5 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldE"];
|
||||
optional uint64 Field6 = 6 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldF"];
|
||||
optional sint32 Field7 = 7 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldG"];
|
||||
optional sint64 Field8 = 8 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldH"];
|
||||
optional fixed32 Field9 = 9 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldI"];
|
||||
optional sfixed32 Field10 = 10 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldJ"];
|
||||
optional fixed64 Field11 = 11 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldK"];
|
||||
optional sfixed64 Field12 = 12 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldL"];
|
||||
optional bool Field13 = 13 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldM"];
|
||||
optional string Field14 = 14 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldN"];
|
||||
optional bytes Field15 = 15 [(gogoproto.nullable) = false, (gogoproto.customname) = "FieldO"];
|
||||
}
|
||||
|
||||
message CustomNameNinOptNative {
|
||||
optional double Field1 = 1 [(gogoproto.customname) = "FieldA"];
|
||||
optional float Field2 = 2 [(gogoproto.customname) = "FieldB"];
|
||||
optional int32 Field3 = 3 [(gogoproto.customname) = "FieldC"];
|
||||
optional int64 Field4 = 4 [(gogoproto.customname) = "FieldD"];
|
||||
optional uint32 Field5 = 5 [(gogoproto.customname) = "FieldE"];
|
||||
optional uint64 Field6 = 6 [(gogoproto.customname) = "FieldF"];
|
||||
optional sint32 Field7 = 7 [(gogoproto.customname) = "FieldG"];
|
||||
optional sint64 Field8 = 8 [(gogoproto.customname) = "FieldH"];
|
||||
optional fixed32 Field9 = 9 [(gogoproto.customname) = "FieldI"];
|
||||
optional sfixed32 Field10 = 10 [(gogoproto.customname) = "FieldJ"];
|
||||
optional fixed64 Field11 = 11 [(gogoproto.customname) = "FieldK"];
|
||||
optional sfixed64 Field12 = 12 [(gogoproto.customname) = "FielL"];
|
||||
optional bool Field13 = 13 [(gogoproto.customname) = "FieldM"];
|
||||
optional string Field14 = 14 [(gogoproto.customname) = "FieldN"];
|
||||
optional bytes Field15 = 15 [(gogoproto.customname) = "FieldO"];
|
||||
}
|
||||
|
||||
message CustomNameNinRepNative {
|
||||
repeated double Field1 = 1 [(gogoproto.customname) = "FieldA"];
|
||||
repeated float Field2 = 2 [(gogoproto.customname) = "FieldB"];
|
||||
repeated int32 Field3 = 3 [(gogoproto.customname) = "FieldC"];
|
||||
repeated int64 Field4 = 4 [(gogoproto.customname) = "FieldD"];
|
||||
repeated uint32 Field5 = 5 [(gogoproto.customname) = "FieldE"];
|
||||
repeated uint64 Field6 = 6 [(gogoproto.customname) = "FieldF"];
|
||||
repeated sint32 Field7 = 7 [(gogoproto.customname) = "FieldG"];
|
||||
repeated sint64 Field8 = 8 [(gogoproto.customname) = "FieldH"];
|
||||
repeated fixed32 Field9 = 9 [(gogoproto.customname) = "FieldI"];
|
||||
repeated sfixed32 Field10 = 10 [(gogoproto.customname) = "FieldJ"];
|
||||
repeated fixed64 Field11 = 11 [(gogoproto.customname) = "FieldK"];
|
||||
repeated sfixed64 Field12 = 12 [(gogoproto.customname) = "FieldL"];
|
||||
repeated bool Field13 = 13 [(gogoproto.customname) = "FieldM"];
|
||||
repeated string Field14 = 14 [(gogoproto.customname) = "FieldN"];
|
||||
repeated bytes Field15 = 15 [(gogoproto.customname) = "FieldO"];
|
||||
}
|
||||
|
||||
message CustomNameNinStruct {
|
||||
optional double Field1 = 1 [(gogoproto.customname) = "FieldA"];
|
||||
optional float Field2 = 2 [(gogoproto.customname) = "FieldB"];
|
||||
optional NidOptNative Field3 = 3 [(gogoproto.customname) = "FieldC"];
|
||||
repeated NinOptNative Field4 = 4 [(gogoproto.customname) = "FieldD"];
|
||||
optional uint64 Field6 = 6 [(gogoproto.customname) = "FieldE"];
|
||||
optional sint32 Field7 = 7 [(gogoproto.customname) = "FieldF"];
|
||||
optional NidOptNative Field8 = 8 [(gogoproto.customname) = "FieldG"];
|
||||
optional bool Field13 = 13 [(gogoproto.customname) = "FieldH"];
|
||||
optional string Field14 = 14 [(gogoproto.customname) = "FieldI"];
|
||||
optional bytes Field15 = 15 [(gogoproto.customname) = "FieldJ"];
|
||||
}
|
||||
|
||||
message CustomNameCustomType {
|
||||
optional bytes Id = 1 [(gogoproto.customname) = "FieldA", (gogoproto.customtype) = "Uuid"];
|
||||
optional bytes Value = 2 [(gogoproto.customname) = "FieldB", (gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128"];
|
||||
repeated bytes Ids = 3 [(gogoproto.customname) = "FieldC", (gogoproto.customtype) = "Uuid"];
|
||||
repeated bytes Values = 4 [(gogoproto.customname) = "FieldD", (gogoproto.customtype) = "github.com/gogo/protobuf/test/custom.Uint128"];
|
||||
}
|
||||
|
||||
message CustomNameNinEmbeddedStructUnion {
|
||||
option (gogoproto.onlyone) = true;
|
||||
optional NidOptNative Field1 = 1 [(gogoproto.embed) = true];
|
||||
optional NinOptNative Field200 = 200 [(gogoproto.customname) = "FieldA"];
|
||||
optional bool Field210 = 210 [(gogoproto.customname) = "FieldB"];
|
||||
}
|
||||
|
||||
message CustomNameEnum {
|
||||
optional TheTestEnum Field1 = 1 [(gogoproto.customname) = "FieldA"];
|
||||
repeated TheTestEnum Field2 = 2 [(gogoproto.customname) = "FieldB"];
|
||||
}
|
||||
|
||||
message NoExtensionsMap {
|
||||
option (gogoproto.face) = false;
|
||||
option (gogoproto.goproto_extensions_map) = false;
|
||||
optional int64 Field1 = 1;
|
||||
extensions 100 to 199;
|
||||
}
|
||||
|
||||
extend NoExtensionsMap {
|
||||
optional double FieldA1 = 100;
|
||||
optional NinOptNative FieldB1 = 101;
|
||||
optional NinEmbeddedStruct FieldC1 = 102;
|
||||
}
|
||||
|
||||
message Unrecognized {
|
||||
option (gogoproto.goproto_unrecognized) = false;
|
||||
optional string Field1 = 1;
|
||||
}
|
||||
|
||||
message UnrecognizedWithInner {
|
||||
message Inner {
|
||||
option (gogoproto.goproto_unrecognized) = false;
|
||||
optional uint32 Field1 = 1;
|
||||
}
|
||||
|
||||
repeated Inner embedded = 1;
|
||||
optional string Field2 = 2;
|
||||
}
|
||||
|
||||
message UnrecognizedWithEmbed {
|
||||
message Embedded {
|
||||
option (gogoproto.goproto_unrecognized) = false;
|
||||
optional uint32 Field1 = 1;
|
||||
}
|
||||
|
||||
optional Embedded embedded = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false];
|
||||
optional string Field2 = 2;
|
||||
}
|
||||
|
||||
message Node {
|
||||
optional string Label = 1;
|
||||
repeated Node Children = 2;
|
||||
}
|
||||
|
||||
message NonByteCustomType {
|
||||
optional ProtoType Field1 = 1 [(gogoproto.customtype) = "T"];
|
||||
}
|
||||
|
||||
message NidOptNonByteCustomType {
|
||||
optional ProtoType Field1 = 1 [(gogoproto.customtype) = "T", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinOptNonByteCustomType {
|
||||
optional ProtoType Field1 = 1 [(gogoproto.customtype) = "T"];
|
||||
}
|
||||
|
||||
message NidRepNonByteCustomType {
|
||||
repeated ProtoType Field1 = 1 [(gogoproto.customtype) = "T", (gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinRepNonByteCustomType {
|
||||
repeated ProtoType Field1 = 1 [(gogoproto.customtype) = "T"];
|
||||
}
|
||||
|
||||
message ProtoType {
|
||||
optional string Field2 = 1;
|
||||
}
|
15974
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/thetestpb_test.go
generated
vendored
Normal file
15974
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/thetestpb_test.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
137
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/uuid.go
generated
vendored
Normal file
137
vendor/github.com/gogo/protobuf/test/combos/unmarshaler/uuid.go
generated
vendored
Normal file
@ -0,0 +1,137 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
func PutLittleEndianUint64(b []byte, offset int, v uint64) {
|
||||
b[offset] = byte(v)
|
||||
b[offset+1] = byte(v >> 8)
|
||||
b[offset+2] = byte(v >> 16)
|
||||
b[offset+3] = byte(v >> 24)
|
||||
b[offset+4] = byte(v >> 32)
|
||||
b[offset+5] = byte(v >> 40)
|
||||
b[offset+6] = byte(v >> 48)
|
||||
b[offset+7] = byte(v >> 56)
|
||||
}
|
||||
|
||||
type Uuid []byte
|
||||
|
||||
func (uuid Uuid) Bytes() []byte {
|
||||
return uuid
|
||||
}
|
||||
|
||||
func (uuid Uuid) Marshal() ([]byte, error) {
|
||||
if len(uuid) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
return []byte(uuid), nil
|
||||
}
|
||||
|
||||
func (uuid Uuid) MarshalTo(data []byte) (n int, err error) {
|
||||
if len(uuid) == 0 {
|
||||
return 0, nil
|
||||
}
|
||||
copy(data, uuid)
|
||||
return 16, nil
|
||||
}
|
||||
|
||||
func (uuid *Uuid) Unmarshal(data []byte) error {
|
||||
if len(data) == 0 {
|
||||
uuid = nil
|
||||
return nil
|
||||
}
|
||||
id := Uuid(make([]byte, 16))
|
||||
copy(id, data)
|
||||
*uuid = id
|
||||
return nil
|
||||
}
|
||||
|
||||
func (uuid *Uuid) Size() int {
|
||||
if uuid == nil {
|
||||
return 0
|
||||
}
|
||||
if len(*uuid) == 0 {
|
||||
return 0
|
||||
}
|
||||
return 16
|
||||
}
|
||||
|
||||
func (uuid Uuid) MarshalJSON() ([]byte, error) {
|
||||
s := hex.EncodeToString([]byte(uuid))
|
||||
return json.Marshal(s)
|
||||
}
|
||||
|
||||
func (uuid *Uuid) UnmarshalJSON(data []byte) error {
|
||||
var s string
|
||||
err := json.Unmarshal(data, &s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
d, err := hex.DecodeString(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*uuid = Uuid(d)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (uuid Uuid) Equal(other Uuid) bool {
|
||||
return bytes.Equal(uuid[0:], other[0:])
|
||||
}
|
||||
|
||||
func (uuid Uuid) Compare(other Uuid) int {
|
||||
return bytes.Compare(uuid[0:], other[0:])
|
||||
}
|
||||
|
||||
type int63 interface {
|
||||
Int63() int64
|
||||
}
|
||||
|
||||
func NewPopulatedUuid(r int63) *Uuid {
|
||||
u := RandV4(r)
|
||||
return &u
|
||||
}
|
||||
|
||||
func RandV4(r int63) Uuid {
|
||||
uuid := make(Uuid, 16)
|
||||
uuid.RandV4(r)
|
||||
return uuid
|
||||
}
|
||||
|
||||
func (uuid Uuid) RandV4(r int63) {
|
||||
PutLittleEndianUint64(uuid, 0, uint64(r.Int63()))
|
||||
PutLittleEndianUint64(uuid, 8, uint64(r.Int63()))
|
||||
uuid[6] = (uuid[6] & 0xf) | 0x40
|
||||
uuid[8] = (uuid[8] & 0x3f) | 0x80
|
||||
}
|
104
vendor/github.com/gogo/protobuf/test/custom-dash-type/customdash.go
generated
vendored
Normal file
104
vendor/github.com/gogo/protobuf/test/custom-dash-type/customdash.go
generated
vendored
Normal file
@ -0,0 +1,104 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
/*
|
||||
Package custom contains custom types for test and example purposes.
|
||||
These types are used by the test structures generated by gogoprotobuf.
|
||||
*/
|
||||
package custom
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
type Bytes []byte
|
||||
|
||||
func (b Bytes) Marshal() ([]byte, error) {
|
||||
buffer := make([]byte, len(b))
|
||||
_, err := b.MarshalTo(buffer)
|
||||
return buffer, err
|
||||
}
|
||||
|
||||
func (b Bytes) MarshalTo(data []byte) (n int, err error) {
|
||||
copy(data, b)
|
||||
return len(b), nil
|
||||
}
|
||||
|
||||
func (b *Bytes) Unmarshal(data []byte) error {
|
||||
if data == nil {
|
||||
b = nil
|
||||
return nil
|
||||
}
|
||||
pb := make([]byte, len(data))
|
||||
copy(pb, data)
|
||||
*b = pb
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b Bytes) MarshalJSON() ([]byte, error) {
|
||||
data, err := b.Marshal()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return json.Marshal(data)
|
||||
}
|
||||
|
||||
func (b *Bytes) Size() int {
|
||||
return len(*b)
|
||||
}
|
||||
|
||||
func (b *Bytes) UnmarshalJSON(data []byte) error {
|
||||
v := new([]byte)
|
||||
err := json.Unmarshal(data, v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return b.Unmarshal(*v)
|
||||
}
|
||||
|
||||
func (this Bytes) Equal(that Bytes) bool {
|
||||
return bytes.Equal(this, that)
|
||||
}
|
||||
|
||||
func (this Bytes) Compare(that Bytes) int {
|
||||
return bytes.Compare(this, that)
|
||||
}
|
||||
|
||||
type randy interface {
|
||||
Intn(n int) int
|
||||
}
|
||||
|
||||
func NewPopulatedBytes(r randy) *Bytes {
|
||||
l := r.Intn(100)
|
||||
data := Bytes(make([]byte, l))
|
||||
for i := 0; i < l; i++ {
|
||||
data[i] = byte(r.Intn(255))
|
||||
}
|
||||
return &data
|
||||
}
|
154
vendor/github.com/gogo/protobuf/test/custom/custom.go
generated
vendored
Normal file
154
vendor/github.com/gogo/protobuf/test/custom/custom.go
generated
vendored
Normal file
@ -0,0 +1,154 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
/*
|
||||
Package custom contains custom types for test and example purposes.
|
||||
These types are used by the test structures generated by gogoprotobuf.
|
||||
*/
|
||||
package custom
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
)
|
||||
|
||||
type Uint128 [2]uint64
|
||||
|
||||
func (u Uint128) Marshal() ([]byte, error) {
|
||||
buffer := make([]byte, 16)
|
||||
_, err := u.MarshalTo(buffer)
|
||||
return buffer, err
|
||||
}
|
||||
|
||||
func (u Uint128) MarshalTo(data []byte) (n int, err error) {
|
||||
PutLittleEndianUint128(data, 0, u)
|
||||
return 16, nil
|
||||
}
|
||||
|
||||
func GetLittleEndianUint64(b []byte, offset int) uint64 {
|
||||
v := uint64(b[offset+7]) << 56
|
||||
v += uint64(b[offset+6]) << 48
|
||||
v += uint64(b[offset+5]) << 40
|
||||
v += uint64(b[offset+4]) << 32
|
||||
v += uint64(b[offset+3]) << 24
|
||||
v += uint64(b[offset+2]) << 16
|
||||
v += uint64(b[offset+1]) << 8
|
||||
v += uint64(b[offset])
|
||||
return v
|
||||
}
|
||||
|
||||
func PutLittleEndianUint64(b []byte, offset int, v uint64) {
|
||||
b[offset] = byte(v)
|
||||
b[offset+1] = byte(v >> 8)
|
||||
b[offset+2] = byte(v >> 16)
|
||||
b[offset+3] = byte(v >> 24)
|
||||
b[offset+4] = byte(v >> 32)
|
||||
b[offset+5] = byte(v >> 40)
|
||||
b[offset+6] = byte(v >> 48)
|
||||
b[offset+7] = byte(v >> 56)
|
||||
}
|
||||
|
||||
func PutLittleEndianUint128(buffer []byte, offset int, v [2]uint64) {
|
||||
PutLittleEndianUint64(buffer, offset, v[0])
|
||||
PutLittleEndianUint64(buffer, offset+8, v[1])
|
||||
}
|
||||
|
||||
func GetLittleEndianUint128(buffer []byte, offset int) (value [2]uint64) {
|
||||
value[0] = GetLittleEndianUint64(buffer, offset)
|
||||
value[1] = GetLittleEndianUint64(buffer, offset+8)
|
||||
return
|
||||
}
|
||||
|
||||
func (u *Uint128) Unmarshal(data []byte) error {
|
||||
if data == nil {
|
||||
u = nil
|
||||
return nil
|
||||
}
|
||||
if len(data) == 0 {
|
||||
pu := Uint128{}
|
||||
*u = pu
|
||||
return nil
|
||||
}
|
||||
if len(data) != 16 {
|
||||
return errors.New("Uint128: invalid length")
|
||||
}
|
||||
pu := Uint128(GetLittleEndianUint128(data, 0))
|
||||
*u = pu
|
||||
return nil
|
||||
}
|
||||
|
||||
func (u Uint128) MarshalJSON() ([]byte, error) {
|
||||
data, err := u.Marshal()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return json.Marshal(data)
|
||||
}
|
||||
|
||||
func (u Uint128) Size() int {
|
||||
return 16
|
||||
}
|
||||
|
||||
func (u *Uint128) UnmarshalJSON(data []byte) error {
|
||||
v := new([]byte)
|
||||
err := json.Unmarshal(data, v)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return u.Unmarshal(*v)
|
||||
}
|
||||
|
||||
func (this Uint128) Equal(that Uint128) bool {
|
||||
return this == that
|
||||
}
|
||||
|
||||
func (this Uint128) Compare(that Uint128) int {
|
||||
thisdata, err := this.Marshal()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
thatdata, err := that.Marshal()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return bytes.Compare(thisdata, thatdata)
|
||||
}
|
||||
|
||||
type randy interface {
|
||||
Intn(n int) int
|
||||
}
|
||||
|
||||
func NewPopulatedUint128(r randy) *Uint128 {
|
||||
data := make([]byte, 16)
|
||||
for i := 0; i < 16; i++ {
|
||||
data[i] = byte(r.Intn(255))
|
||||
}
|
||||
u := Uint128(GetLittleEndianUint128(data, 0))
|
||||
return &u
|
||||
}
|
43
vendor/github.com/gogo/protobuf/test/custom/custom_test.go
generated
vendored
Normal file
43
vendor/github.com/gogo/protobuf/test/custom/custom_test.go
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package custom
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestUint128(t *testing.T) {
|
||||
var uint128a = Uint128{0, 1}
|
||||
buf := make([]byte, 16)
|
||||
PutLittleEndianUint128(buf, 0, uint128a)
|
||||
uint128b := GetLittleEndianUint128(buf, 0)
|
||||
if !uint128a.Equal(uint128b) {
|
||||
t.Fatalf("%v != %v", uint128a, uint128b)
|
||||
}
|
||||
}
|
30
vendor/github.com/gogo/protobuf/test/custombytesnonstruct/Makefile
generated
vendored
Normal file
30
vendor/github.com/gogo/protobuf/test/custombytesnonstruct/Makefile
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
# Protocol Buffers for Go with Gadgets
|
||||
#
|
||||
# Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
# http://github.com/gogo/protobuf
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
regenerate:
|
||||
(protoc --proto_path=../../../../../:../../protobuf/:. --gogo_out=. proto.proto)
|
34
vendor/github.com/gogo/protobuf/test/custombytesnonstruct/custombytesnonstruct_test.go
generated
vendored
Normal file
34
vendor/github.com/gogo/protobuf/test/custombytesnonstruct/custombytesnonstruct_test.go
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package custombytesnonstruct
|
||||
|
||||
import testing "testing"
|
||||
|
||||
func TestCustomBytesNonStruct(t *testing.T) {
|
||||
}
|
36
vendor/github.com/gogo/protobuf/test/custombytesnonstruct/customtype.go
generated
vendored
Normal file
36
vendor/github.com/gogo/protobuf/test/custombytesnonstruct/customtype.go
generated
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package custombytesnonstruct
|
||||
|
||||
type CustomType int
|
||||
|
||||
func (c *CustomType) Unmarshal(data []byte) error {
|
||||
data[0] = 42
|
||||
return nil
|
||||
}
|
293
vendor/github.com/gogo/protobuf/test/custombytesnonstruct/proto.pb.go
generated
vendored
Normal file
293
vendor/github.com/gogo/protobuf/test/custombytesnonstruct/proto.pb.go
generated
vendored
Normal file
@ -0,0 +1,293 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: proto.proto
|
||||
|
||||
package custombytesnonstruct
|
||||
|
||||
import proto "github.com/gogo/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "github.com/gogo/protobuf/gogoproto"
|
||||
|
||||
import io "io"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type Object struct {
|
||||
CustomField1 *CustomType `protobuf:"bytes,1,opt,name=CustomField1,customtype=CustomType" json:"CustomField1,omitempty"`
|
||||
CustomField2 []CustomType `protobuf:"bytes,2,rep,name=CustomField2,customtype=CustomType" json:"CustomField2,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Object) Reset() { *m = Object{} }
|
||||
func (m *Object) String() string { return proto.CompactTextString(m) }
|
||||
func (*Object) ProtoMessage() {}
|
||||
func (*Object) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_proto_ae179068cc9a7711, []int{0}
|
||||
}
|
||||
func (m *Object) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *Object) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Object.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Object) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Object.Merge(dst, src)
|
||||
}
|
||||
func (m *Object) XXX_Size() int {
|
||||
return xxx_messageInfo_Object.Size(m)
|
||||
}
|
||||
func (m *Object) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Object.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Object proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*Object)(nil), "custombytesnonstruct.Object")
|
||||
}
|
||||
func (m *Object) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowProto
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: Object: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: Object: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field CustomField1", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowProto
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
return ErrInvalidLengthProto
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
var v CustomType
|
||||
m.CustomField1 = &v
|
||||
if err := m.CustomField1.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
case 2:
|
||||
if wireType != 2 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field CustomField2", wireType)
|
||||
}
|
||||
var byteLen int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowProto
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
byteLen |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if byteLen < 0 {
|
||||
return ErrInvalidLengthProto
|
||||
}
|
||||
postIndex := iNdEx + byteLen
|
||||
if postIndex > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
var v CustomType
|
||||
m.CustomField2 = append(m.CustomField2, v)
|
||||
if err := m.CustomField2[len(m.CustomField2)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
|
||||
return err
|
||||
}
|
||||
iNdEx = postIndex
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipProto(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthProto
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipProto(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowProto
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
wireType := int(wire & 0x7)
|
||||
switch wireType {
|
||||
case 0:
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowProto
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx++
|
||||
if dAtA[iNdEx-1] < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
return iNdEx, nil
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowProto
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
length |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
iNdEx += length
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthProto
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 3:
|
||||
for {
|
||||
var innerWire uint64
|
||||
var start int = iNdEx
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowProto
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
innerWire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
innerWireType := int(innerWire & 0x7)
|
||||
if innerWireType == 4 {
|
||||
break
|
||||
}
|
||||
next, err := skipProto(dAtA[start:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
iNdEx = start + next
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 4:
|
||||
return iNdEx, nil
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
return iNdEx, nil
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthProto = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowProto = fmt.Errorf("proto: integer overflow")
|
||||
)
|
||||
|
||||
func init() { proto.RegisterFile("proto.proto", fileDescriptor_proto_ae179068cc9a7711) }
|
||||
|
||||
var fileDescriptor_proto_ae179068cc9a7711 = []byte{
|
||||
// 147 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2e, 0x28, 0xca, 0x2f,
|
||||
0xc9, 0xd7, 0x03, 0x93, 0x42, 0x22, 0xc9, 0xa5, 0xc5, 0x25, 0xf9, 0xb9, 0x49, 0x95, 0x25, 0xa9,
|
||||
0xc5, 0x79, 0xf9, 0x79, 0xc5, 0x25, 0x45, 0xa5, 0xc9, 0x25, 0x52, 0xba, 0xe9, 0x99, 0x25, 0x19,
|
||||
0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xe9, 0xf9, 0xe9, 0xf9, 0xfa, 0x60, 0xc5, 0x49, 0xa5,
|
||||
0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0x0c, 0x51, 0x2a, 0xe0, 0x62, 0xf3, 0x4f, 0xca, 0x4a,
|
||||
0x4d, 0x2e, 0x11, 0x32, 0xe2, 0xe2, 0x71, 0x06, 0x1b, 0xe8, 0x96, 0x99, 0x9a, 0x93, 0x62, 0x28,
|
||||
0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0xe3, 0xc4, 0x77, 0xeb, 0x9e, 0x3c, 0x17, 0x44, 0x3c, 0xa4, 0xb2,
|
||||
0x20, 0x35, 0x08, 0x45, 0x0d, 0x9a, 0x1e, 0x23, 0x09, 0x26, 0x05, 0x66, 0x02, 0x7a, 0x8c, 0x9c,
|
||||
0x58, 0x2e, 0x3c, 0x92, 0x63, 0x04, 0x04, 0x00, 0x00, 0xff, 0xff, 0xdd, 0xc6, 0xf3, 0xe3, 0xca,
|
||||
0x00, 0x00, 0x00,
|
||||
}
|
39
vendor/github.com/gogo/protobuf/test/custombytesnonstruct/proto.proto
generated
vendored
Normal file
39
vendor/github.com/gogo/protobuf/test/custombytesnonstruct/proto.proto
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
package custombytesnonstruct;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.unmarshaler_all) = true;
|
||||
|
||||
message Object {
|
||||
optional bytes CustomField1 = 1 [(gogoproto.customtype) = "CustomType"];
|
||||
repeated bytes CustomField2 = 2 [(gogoproto.customtype) = "CustomType"];
|
||||
}
|
38
vendor/github.com/gogo/protobuf/test/dashfilename/dash-filename.proto
generated
vendored
Normal file
38
vendor/github.com/gogo/protobuf/test/dashfilename/dash-filename.proto
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
package dashfilename;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.marshaler_all) = true;
|
||||
|
||||
message test {
|
||||
|
||||
}
|
48
vendor/github.com/gogo/protobuf/test/dashfilename/df_test.go
generated
vendored
Normal file
48
vendor/github.com/gogo/protobuf/test/dashfilename/df_test.go
generated
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package dashfilename
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"testing"
|
||||
)
|
||||
|
||||
//Issue 16 : https://github.com/gogo/protobuf/issues/detail?id=16
|
||||
func TestDashFilename(t *testing.T) {
|
||||
name := "dash-filename"
|
||||
cmd := exec.Command("protoc", "--gogo_out=.", "-I=../../../../../:../../protobuf/:.", name+".proto")
|
||||
data, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
t.Fatalf("err = %v: %s", err, string(data))
|
||||
}
|
||||
if err := os.Remove(name + ".pb.go"); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
1
vendor/github.com/gogo/protobuf/test/dashfilename/doc.go
generated
vendored
Normal file
1
vendor/github.com/gogo/protobuf/test/dashfilename/doc.go
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
package dashfilename
|
33
vendor/github.com/gogo/protobuf/test/data/Makefile
generated
vendored
Normal file
33
vendor/github.com/gogo/protobuf/test/data/Makefile
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
# Protocol Buffers for Go with Gadgets
|
||||
#
|
||||
# Copyright (c) 2016, The GoGo Authors. All rights reserved.
|
||||
# http://github.com/gogo/protobuf
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
regenerate:
|
||||
go install github.com/gogo/protobuf/protoc-min-version
|
||||
go install github.com/gogo/protobuf/protoc-gen-gogo
|
||||
protoc-min-version --version="3.0.0" --gogo_out=. \
|
||||
--proto_path=../../../../../:../../protobuf/:. data.proto
|
511
vendor/github.com/gogo/protobuf/test/data/data.pb.go
generated
vendored
Normal file
511
vendor/github.com/gogo/protobuf/test/data/data.pb.go
generated
vendored
Normal file
@ -0,0 +1,511 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: data.proto
|
||||
|
||||
package data
|
||||
|
||||
import proto "github.com/gogo/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "github.com/gogo/protobuf/gogoproto"
|
||||
|
||||
import bytes "bytes"
|
||||
|
||||
import strings "strings"
|
||||
import reflect "reflect"
|
||||
|
||||
import io "io"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type MyMessage struct {
|
||||
MyData uint32 `protobuf:"varint,1,opt,name=my_data,json=myData,proto3" json:"my_data,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *MyMessage) Reset() { *m = MyMessage{} }
|
||||
func (*MyMessage) ProtoMessage() {}
|
||||
func (*MyMessage) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_data_ad073f7719d49453, []int{0}
|
||||
}
|
||||
func (m *MyMessage) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *MyMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
if deterministic {
|
||||
return xxx_messageInfo_MyMessage.Marshal(b, m, deterministic)
|
||||
} else {
|
||||
b = b[:cap(b)]
|
||||
n, err := m.MarshalTo(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b[:n], nil
|
||||
}
|
||||
}
|
||||
func (dst *MyMessage) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_MyMessage.Merge(dst, src)
|
||||
}
|
||||
func (m *MyMessage) XXX_Size() int {
|
||||
return m.Size()
|
||||
}
|
||||
func (m *MyMessage) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_MyMessage.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_MyMessage proto.InternalMessageInfo
|
||||
|
||||
func (m *MyMessage) GetMyData() uint32 {
|
||||
if m != nil {
|
||||
return m.MyData
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*MyMessage)(nil), "data.MyMessage")
|
||||
}
|
||||
func (this *MyMessage) VerboseEqual(that interface{}) error {
|
||||
if that == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that == nil && this != nil")
|
||||
}
|
||||
|
||||
that1, ok := that.(*MyMessage)
|
||||
if !ok {
|
||||
that2, ok := that.(MyMessage)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return fmt.Errorf("that is not of type *MyMessage")
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
if this == nil {
|
||||
return nil
|
||||
}
|
||||
return fmt.Errorf("that is type *MyMessage but is nil && this != nil")
|
||||
} else if this == nil {
|
||||
return fmt.Errorf("that is type *MyMessage but is not nil && this == nil")
|
||||
}
|
||||
if this.MyData != that1.MyData {
|
||||
return fmt.Errorf("MyData this(%v) Not Equal that(%v)", this.MyData, that1.MyData)
|
||||
}
|
||||
if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
|
||||
return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func (this *MyMessage) Equal(that interface{}) bool {
|
||||
if that == nil {
|
||||
return this == nil
|
||||
}
|
||||
|
||||
that1, ok := that.(*MyMessage)
|
||||
if !ok {
|
||||
that2, ok := that.(MyMessage)
|
||||
if ok {
|
||||
that1 = &that2
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
if that1 == nil {
|
||||
return this == nil
|
||||
} else if this == nil {
|
||||
return false
|
||||
}
|
||||
if this.MyData != that1.MyData {
|
||||
return false
|
||||
}
|
||||
if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
func (this *MyMessage) GoString() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := make([]string, 0, 5)
|
||||
s = append(s, "&data.MyMessage{")
|
||||
s = append(s, "MyData: "+fmt.Sprintf("%#v", this.MyData)+",\n")
|
||||
if this.XXX_unrecognized != nil {
|
||||
s = append(s, "XXX_unrecognized:"+fmt.Sprintf("%#v", this.XXX_unrecognized)+",\n")
|
||||
}
|
||||
s = append(s, "}")
|
||||
return strings.Join(s, "")
|
||||
}
|
||||
func valueToGoStringData(v interface{}, typ string) string {
|
||||
rv := reflect.ValueOf(v)
|
||||
if rv.IsNil() {
|
||||
return "nil"
|
||||
}
|
||||
pv := reflect.Indirect(rv).Interface()
|
||||
return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv)
|
||||
}
|
||||
func (m *MyMessage) Marshal() (dAtA []byte, err error) {
|
||||
size := m.Size()
|
||||
dAtA = make([]byte, size)
|
||||
n, err := m.MarshalTo(dAtA)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return dAtA[:n], nil
|
||||
}
|
||||
|
||||
func (m *MyMessage) MarshalTo(dAtA []byte) (int, error) {
|
||||
var i int
|
||||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.MyData != 0 {
|
||||
dAtA[i] = 0x8
|
||||
i++
|
||||
i = encodeVarintData(dAtA, i, uint64(m.MyData))
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
i += copy(dAtA[i:], m.XXX_unrecognized)
|
||||
}
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func encodeVarintData(dAtA []byte, offset int, v uint64) int {
|
||||
for v >= 1<<7 {
|
||||
dAtA[offset] = uint8(v&0x7f | 0x80)
|
||||
v >>= 7
|
||||
offset++
|
||||
}
|
||||
dAtA[offset] = uint8(v)
|
||||
return offset + 1
|
||||
}
|
||||
func NewPopulatedMyMessage(r randyData, easy bool) *MyMessage {
|
||||
this := &MyMessage{}
|
||||
this.MyData = uint32(r.Uint32())
|
||||
if !easy && r.Intn(10) != 0 {
|
||||
this.XXX_unrecognized = randUnrecognizedData(r, 2)
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
type randyData interface {
|
||||
Float32() float32
|
||||
Float64() float64
|
||||
Int63() int64
|
||||
Int31() int32
|
||||
Uint32() uint32
|
||||
Intn(n int) int
|
||||
}
|
||||
|
||||
func randUTF8RuneData(r randyData) rune {
|
||||
ru := r.Intn(62)
|
||||
if ru < 10 {
|
||||
return rune(ru + 48)
|
||||
} else if ru < 36 {
|
||||
return rune(ru + 55)
|
||||
}
|
||||
return rune(ru + 61)
|
||||
}
|
||||
func randStringData(r randyData) string {
|
||||
v1 := r.Intn(100)
|
||||
tmps := make([]rune, v1)
|
||||
for i := 0; i < v1; i++ {
|
||||
tmps[i] = randUTF8RuneData(r)
|
||||
}
|
||||
return string(tmps)
|
||||
}
|
||||
func randUnrecognizedData(r randyData, maxFieldNumber int) (dAtA []byte) {
|
||||
l := r.Intn(5)
|
||||
for i := 0; i < l; i++ {
|
||||
wire := r.Intn(4)
|
||||
if wire == 3 {
|
||||
wire = 5
|
||||
}
|
||||
fieldNumber := maxFieldNumber + r.Intn(100)
|
||||
dAtA = randFieldData(dAtA, r, fieldNumber, wire)
|
||||
}
|
||||
return dAtA
|
||||
}
|
||||
func randFieldData(dAtA []byte, r randyData, fieldNumber int, wire int) []byte {
|
||||
key := uint32(fieldNumber)<<3 | uint32(wire)
|
||||
switch wire {
|
||||
case 0:
|
||||
dAtA = encodeVarintPopulateData(dAtA, uint64(key))
|
||||
v2 := r.Int63()
|
||||
if r.Intn(2) == 0 {
|
||||
v2 *= -1
|
||||
}
|
||||
dAtA = encodeVarintPopulateData(dAtA, uint64(v2))
|
||||
case 1:
|
||||
dAtA = encodeVarintPopulateData(dAtA, uint64(key))
|
||||
dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
|
||||
case 2:
|
||||
dAtA = encodeVarintPopulateData(dAtA, uint64(key))
|
||||
ll := r.Intn(100)
|
||||
dAtA = encodeVarintPopulateData(dAtA, uint64(ll))
|
||||
for j := 0; j < ll; j++ {
|
||||
dAtA = append(dAtA, byte(r.Intn(256)))
|
||||
}
|
||||
default:
|
||||
dAtA = encodeVarintPopulateData(dAtA, uint64(key))
|
||||
dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
|
||||
}
|
||||
return dAtA
|
||||
}
|
||||
func encodeVarintPopulateData(dAtA []byte, v uint64) []byte {
|
||||
for v >= 1<<7 {
|
||||
dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80))
|
||||
v >>= 7
|
||||
}
|
||||
dAtA = append(dAtA, uint8(v))
|
||||
return dAtA
|
||||
}
|
||||
func (m *MyMessage) Size() (n int) {
|
||||
if m == nil {
|
||||
return 0
|
||||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.MyData != 0 {
|
||||
n += 1 + sovData(uint64(m.MyData))
|
||||
}
|
||||
if m.XXX_unrecognized != nil {
|
||||
n += len(m.XXX_unrecognized)
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
func sovData(x uint64) (n int) {
|
||||
for {
|
||||
n++
|
||||
x >>= 7
|
||||
if x == 0 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
func sozData(x uint64) (n int) {
|
||||
return sovData(uint64((x << 1) ^ uint64((int64(x) >> 63))))
|
||||
}
|
||||
func (this *MyMessage) String() string {
|
||||
if this == nil {
|
||||
return "nil"
|
||||
}
|
||||
s := strings.Join([]string{`&MyMessage{`,
|
||||
`MyData:` + fmt.Sprintf("%v", this.MyData) + `,`,
|
||||
`XXX_unrecognized:` + fmt.Sprintf("%v", this.XXX_unrecognized) + `,`,
|
||||
`}`,
|
||||
}, "")
|
||||
return s
|
||||
}
|
||||
func valueToStringData(v interface{}) string {
|
||||
rv := reflect.ValueOf(v)
|
||||
if rv.IsNil() {
|
||||
return "nil"
|
||||
}
|
||||
pv := reflect.Indirect(rv).Interface()
|
||||
return fmt.Sprintf("*%v", pv)
|
||||
}
|
||||
func (m *MyMessage) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowData
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: MyMessage: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: MyMessage: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field MyData", wireType)
|
||||
}
|
||||
m.MyData = 0
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowData
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
m.MyData |= (uint32(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipData(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthData
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipData(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowData
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
wireType := int(wire & 0x7)
|
||||
switch wireType {
|
||||
case 0:
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowData
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx++
|
||||
if dAtA[iNdEx-1] < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
return iNdEx, nil
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowData
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
length |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
iNdEx += length
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthData
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 3:
|
||||
for {
|
||||
var innerWire uint64
|
||||
var start int = iNdEx
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowData
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
innerWire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
innerWireType := int(innerWire & 0x7)
|
||||
if innerWireType == 4 {
|
||||
break
|
||||
}
|
||||
next, err := skipData(dAtA[start:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
iNdEx = start + next
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 4:
|
||||
return iNdEx, nil
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
return iNdEx, nil
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthData = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowData = fmt.Errorf("proto: integer overflow")
|
||||
)
|
||||
|
||||
func init() { proto.RegisterFile("data.proto", fileDescriptor_data_ad073f7719d49453) }
|
||||
|
||||
var fileDescriptor_data_ad073f7719d49453 = []byte{
|
||||
// 160 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4a, 0x49, 0x2c, 0x49,
|
||||
0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x01, 0xb1, 0xa5, 0x74, 0xd3, 0x33, 0x4b, 0x32,
|
||||
0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5, 0xc1, 0x92, 0x49, 0xa5,
|
||||
0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0x34, 0x29, 0xa9, 0x70, 0x71, 0xfa, 0x56, 0xfa, 0xa6,
|
||||
0x16, 0x17, 0x27, 0xa6, 0xa7, 0x0a, 0x89, 0x73, 0xb1, 0xe7, 0x56, 0xc6, 0x83, 0x8c, 0x91, 0x60,
|
||||
0x54, 0x60, 0xd4, 0xe0, 0x0d, 0x62, 0xcb, 0xad, 0x74, 0x49, 0x2c, 0x49, 0x74, 0xd2, 0xb9, 0xf1,
|
||||
0x50, 0x8e, 0xe1, 0xc1, 0x43, 0x39, 0xc6, 0x0f, 0x0f, 0xe5, 0x18, 0x7f, 0x3c, 0x94, 0x63, 0x6c,
|
||||
0x78, 0x24, 0xc7, 0xb8, 0xe2, 0x91, 0x1c, 0xe3, 0x8e, 0x47, 0x72, 0x8c, 0x07, 0x1e, 0xc9, 0x31,
|
||||
0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x49, 0x6c, 0x60,
|
||||
0xa3, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xfd, 0x4f, 0xfb, 0xa7, 0x9d, 0x00, 0x00, 0x00,
|
||||
}
|
49
vendor/github.com/gogo/protobuf/test/data/data.proto
generated
vendored
Normal file
49
vendor/github.com/gogo/protobuf/test/data/data.proto
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2016, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
package data;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.gostring_all) = true;
|
||||
option (gogoproto.equal_all) = true;
|
||||
option (gogoproto.verbose_equal_all) = true;
|
||||
option (gogoproto.goproto_stringer_all) = false;
|
||||
option (gogoproto.stringer_all) = true;
|
||||
option (gogoproto.populate_all) = true;
|
||||
option (gogoproto.testgen_all) = true;
|
||||
option (gogoproto.benchgen_all) = true;
|
||||
option (gogoproto.marshaler_all) = true;
|
||||
option (gogoproto.sizer_all) = true;
|
||||
option (gogoproto.unmarshaler_all) = true;
|
||||
|
||||
message MyMessage {
|
||||
uint32 my_data = 1;
|
||||
}
|
253
vendor/github.com/gogo/protobuf/test/data/datapb_test.go
generated
vendored
Normal file
253
vendor/github.com/gogo/protobuf/test/data/datapb_test.go
generated
vendored
Normal file
@ -0,0 +1,253 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: data.proto
|
||||
|
||||
package data
|
||||
|
||||
import testing "testing"
|
||||
import math_rand "math/rand"
|
||||
import time "time"
|
||||
import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
|
||||
import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb"
|
||||
import fmt "fmt"
|
||||
import go_parser "go/parser"
|
||||
import proto "github.com/gogo/protobuf/proto"
|
||||
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 TestMyMessageProto(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedMyMessage(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &MyMessage{}
|
||||
if err := github_com_gogo_protobuf_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
|
||||
_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMyMessageMarshalTo(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedMyMessage(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 := &MyMessage{}
|
||||
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))
|
||||
}
|
||||
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 BenchmarkMyMessageProtoMarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*MyMessage, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
pops[i] = NewPopulatedMyMessage(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(pops[i%10000])
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
total += len(dAtA)
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func BenchmarkMyMessageProtoUnmarshal(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
datas := make([][]byte, 10000)
|
||||
for i := 0; i < 10000; i++ {
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(NewPopulatedMyMessage(popr, false))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
datas[i] = dAtA
|
||||
}
|
||||
msg := &MyMessage{}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += len(datas[i%10000])
|
||||
if err := github_com_gogo_protobuf_proto.Unmarshal(datas[i%10000], msg); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestMyMessageJSON(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedMyMessage(popr, true)
|
||||
marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
|
||||
jsondata, err := marshaler.MarshalToString(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &MyMessage{}
|
||||
err = github_com_gogo_protobuf_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 TestMyMessageProtoText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedMyMessage(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
||||
msg := &MyMessage{}
|
||||
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("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 TestMyMessageProtoCompactText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedMyMessage(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
||||
msg := &MyMessage{}
|
||||
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("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 TestMyMessageVerboseEqual(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedMyMessage(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
msg := &MyMessage{}
|
||||
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 TestMyMessageGoString(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedMyMessage(popr, false)
|
||||
s1 := p.GoString()
|
||||
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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
func TestMyMessageSize(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedMyMessage(popr, true)
|
||||
size2 := github_com_gogo_protobuf_proto.Size(p)
|
||||
dAtA, err := github_com_gogo_protobuf_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 := github_com_gogo_protobuf_proto.Size(p)
|
||||
if size3 != size {
|
||||
t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
|
||||
}
|
||||
}
|
||||
|
||||
func BenchmarkMyMessageSize(b *testing.B) {
|
||||
popr := math_rand.New(math_rand.NewSource(616))
|
||||
total := 0
|
||||
pops := make([]*MyMessage, 1000)
|
||||
for i := 0; i < 1000; i++ {
|
||||
pops[i] = NewPopulatedMyMessage(popr, false)
|
||||
}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
total += pops[i%1000].Size()
|
||||
}
|
||||
b.SetBytes(int64(total / b.N))
|
||||
}
|
||||
|
||||
func TestMyMessageStringer(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedMyMessage(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
|
40
vendor/github.com/gogo/protobuf/test/defaultconflict/df.proto
generated
vendored
Normal file
40
vendor/github.com/gogo/protobuf/test/defaultconflict/df.proto
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
package defaultcheck;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.face_all) = true;
|
||||
option (gogoproto.goproto_getters_all) = false;
|
||||
|
||||
message A {
|
||||
optional int64 Field1 = 1 [default=1234];
|
||||
}
|
||||
|
39
vendor/github.com/gogo/protobuf/test/defaultconflict/dg.proto
generated
vendored
Normal file
39
vendor/github.com/gogo/protobuf/test/defaultconflict/dg.proto
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
package defaultcheck;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.goproto_getters_all) = false;
|
||||
|
||||
message A {
|
||||
optional int64 Field1 = 1 [default=1234];
|
||||
}
|
||||
|
1
vendor/github.com/gogo/protobuf/test/defaultconflict/doc.go
generated
vendored
Normal file
1
vendor/github.com/gogo/protobuf/test/defaultconflict/doc.go
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
package defaultcheck
|
37
vendor/github.com/gogo/protobuf/test/defaultconflict/nc.proto
generated
vendored
Normal file
37
vendor/github.com/gogo/protobuf/test/defaultconflict/nc.proto
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
package defaultcheck;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
message A {
|
||||
optional int64 Field1 = 1 [default = 1234, (gogoproto.nullable) = false];;
|
||||
}
|
||||
|
68
vendor/github.com/gogo/protobuf/test/defaultconflict/nc_test.go
generated
vendored
Normal file
68
vendor/github.com/gogo/protobuf/test/defaultconflict/nc_test.go
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package defaultcheck
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func testDefaultConflict(t *testing.T, name string) {
|
||||
cmd := exec.Command("protoc", "--gogo_out=.", "-I=../../../../../:../../protobuf/:.", name+".proto")
|
||||
data, err := cmd.CombinedOutput()
|
||||
if err == nil && !strings.Contains(string(data), "Plugin failed with status code 1") {
|
||||
t.Errorf("Expected error, got: %s", data)
|
||||
if err = os.Remove(name + ".pb.go"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
t.Logf("received expected error = %v and output = %v", err, string(data))
|
||||
}
|
||||
|
||||
func TestNullableDefault(t *testing.T) {
|
||||
testDefaultConflict(t, "nc")
|
||||
}
|
||||
|
||||
func TestNullableExtension(t *testing.T) {
|
||||
testDefaultConflict(t, "nx")
|
||||
}
|
||||
|
||||
func TestNullableEnum(t *testing.T) {
|
||||
testDefaultConflict(t, "ne")
|
||||
}
|
||||
|
||||
func TestFaceDefault(t *testing.T) {
|
||||
testDefaultConflict(t, "df")
|
||||
}
|
||||
|
||||
func TestNoGettersDefault(t *testing.T) {
|
||||
testDefaultConflict(t, "dg")
|
||||
}
|
42
vendor/github.com/gogo/protobuf/test/defaultconflict/ne.proto
generated
vendored
Normal file
42
vendor/github.com/gogo/protobuf/test/defaultconflict/ne.proto
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
package defaultcheck;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
enum E {
|
||||
P = 10;
|
||||
Q = 11;
|
||||
}
|
||||
|
||||
message A {
|
||||
optional E Field1 = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
41
vendor/github.com/gogo/protobuf/test/defaultconflict/nx.proto
generated
vendored
Normal file
41
vendor/github.com/gogo/protobuf/test/defaultconflict/nx.proto
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
package defaultcheck;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
message A {
|
||||
extensions 1 to max;
|
||||
}
|
||||
|
||||
extend A {
|
||||
optional int64 Field1 = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
32
vendor/github.com/gogo/protobuf/test/deterministic/Makefile
generated
vendored
Normal file
32
vendor/github.com/gogo/protobuf/test/deterministic/Makefile
generated
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
# Protocol Buffers for Go with Gadgets
|
||||
#
|
||||
# Copyright (c) 2018, The GoGo Authors. All rights reserved.
|
||||
# http://github.com/gogo/protobuf
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
regenerate:
|
||||
go install github.com/gogo/protobuf/protoc-min-version
|
||||
protoc-min-version --version="3.0.0" --gogo_out=:. \
|
||||
--proto_path=../../../../../:../../protobuf/:. deterministic.proto
|
1331
vendor/github.com/gogo/protobuf/test/deterministic/deterministic.pb.go
generated
vendored
Normal file
1331
vendor/github.com/gogo/protobuf/test/deterministic/deterministic.pb.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
81
vendor/github.com/gogo/protobuf/test/deterministic/deterministic.proto
generated
vendored
Normal file
81
vendor/github.com/gogo/protobuf/test/deterministic/deterministic.proto
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2018, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto3";
|
||||
package deterministic;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.verbose_equal_all) = true;
|
||||
option (gogoproto.equal_all) = true;
|
||||
option (gogoproto.sizer_all) = true;
|
||||
|
||||
option (gogoproto.enum_stringer_all) = true;
|
||||
|
||||
message OrderedMap {
|
||||
option (gogoproto.marshaler) = true;
|
||||
option (gogoproto.stable_marshaler) = true;
|
||||
map<string, string> StringMap = 1;
|
||||
}
|
||||
|
||||
message UnorderedMap {
|
||||
option (gogoproto.marshaler) = true;
|
||||
option (gogoproto.stable_marshaler) = false;
|
||||
map<string, string> StringMap = 1;
|
||||
}
|
||||
|
||||
message MapNoMarshaler {
|
||||
option (gogoproto.marshaler) = false;
|
||||
map<string, string> StringMap = 1;
|
||||
}
|
||||
|
||||
message NestedOrderedMap {
|
||||
option (gogoproto.marshaler) = true;
|
||||
option (gogoproto.stable_marshaler) = true;
|
||||
map<string, string> StringMap = 1;
|
||||
NestedMap1 NestedMap = 2;
|
||||
}
|
||||
|
||||
message NestedMap1 {
|
||||
option (gogoproto.marshaler) = true;
|
||||
option (gogoproto.stable_marshaler) = true;
|
||||
map<string, string> NestedStringMap = 1;
|
||||
}
|
||||
|
||||
message NestedUnorderedMap {
|
||||
option (gogoproto.marshaler) = true;
|
||||
option (gogoproto.stable_marshaler) = false;
|
||||
map<string, string> StringMap = 1;
|
||||
NestedMap2 NestedMap = 2;
|
||||
}
|
||||
|
||||
message NestedMap2 {
|
||||
option (gogoproto.marshaler) = true;
|
||||
option (gogoproto.stable_marshaler) = false;
|
||||
map<string, string> NestedStringMap = 1;
|
||||
}
|
207
vendor/github.com/gogo/protobuf/test/deterministic/deterministic_test.go
generated
vendored
Normal file
207
vendor/github.com/gogo/protobuf/test/deterministic/deterministic_test.go
generated
vendored
Normal file
@ -0,0 +1,207 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2018, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package deterministic
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/gogo/protobuf/proto"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func getTestMap() map[string]string {
|
||||
return map[string]string{
|
||||
"a": "1",
|
||||
"b": "2",
|
||||
"c": "3",
|
||||
"d": "4",
|
||||
"e": "5",
|
||||
"f": "6",
|
||||
"g": "7",
|
||||
"h": "8",
|
||||
"i": "9",
|
||||
"j": "10",
|
||||
"k": "11",
|
||||
"l": "12",
|
||||
"m": "13",
|
||||
"n": "14",
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestOrderedMap(t *testing.T) {
|
||||
var b proto.Buffer
|
||||
m := getTestMap()
|
||||
in := &OrderedMap{
|
||||
StringMap: m,
|
||||
}
|
||||
if err := b.Marshal(in); err != nil {
|
||||
t.Fatalf("Marshal failed: %v", err)
|
||||
}
|
||||
data1 := b.Bytes()
|
||||
out := &OrderedMap{}
|
||||
if err := proto.Unmarshal(data1, out); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := in.VerboseEqual(out); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
data2, err := proto.Marshal(in)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if bytes.Compare(data1, data2) != 0 {
|
||||
t.Fatal("byte arrays are not the same\n", data1, "\n", data2)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnorderedMap(t *testing.T) {
|
||||
m := getTestMap()
|
||||
in := &UnorderedMap{
|
||||
StringMap: m,
|
||||
}
|
||||
var b proto.Buffer
|
||||
b.SetDeterministic(true)
|
||||
if err := b.Marshal(in); err == nil {
|
||||
t.Fatalf("Expected Marshal to return error rejecting deterministic flag")
|
||||
}
|
||||
}
|
||||
|
||||
func TestMapNoMarshaler(t *testing.T) {
|
||||
m := getTestMap()
|
||||
in := &MapNoMarshaler{
|
||||
StringMap: m,
|
||||
}
|
||||
|
||||
var b1 proto.Buffer
|
||||
b1.SetDeterministic(true)
|
||||
if err := b1.Marshal(in); err != nil {
|
||||
t.Fatalf("Marshal failed: %v", err)
|
||||
}
|
||||
data1 := b1.Bytes()
|
||||
|
||||
out := &MapNoMarshaler{}
|
||||
err := proto.Unmarshal(data1, out)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := in.VerboseEqual(out); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
var b2 proto.Buffer
|
||||
b2.SetDeterministic(true)
|
||||
if err := b2.Marshal(in); err != nil {
|
||||
t.Fatalf("Marshal failed: %v", err)
|
||||
}
|
||||
data2 := b2.Bytes()
|
||||
|
||||
if bytes.Compare(data1, data2) != 0 {
|
||||
t.Fatal("byte arrays are not the same:\n", data1, "\n", data2)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOrderedNestedMap(t *testing.T) {
|
||||
var b proto.Buffer
|
||||
in := &NestedOrderedMap{
|
||||
StringMap: getTestMap(),
|
||||
NestedMap: &NestedMap1{
|
||||
NestedStringMap: getTestMap(),
|
||||
},
|
||||
}
|
||||
if err := b.Marshal(in); err != nil {
|
||||
t.Fatalf("Marshal failed: %v", err)
|
||||
}
|
||||
data1 := b.Bytes()
|
||||
out := &NestedOrderedMap{}
|
||||
if err := proto.Unmarshal(data1, out); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := in.VerboseEqual(out); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
data2, err := proto.Marshal(in)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if bytes.Compare(data1, data2) != 0 {
|
||||
t.Fatal("byte arrays are not the same\n", data1, "\n", data2)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnorderedNestedMap(t *testing.T) {
|
||||
in := &NestedUnorderedMap{
|
||||
StringMap: getTestMap(),
|
||||
NestedMap: &NestedMap2{
|
||||
NestedStringMap: getTestMap(),
|
||||
},
|
||||
}
|
||||
var b proto.Buffer
|
||||
b.SetDeterministic(true)
|
||||
if err := b.Marshal(in); err == nil {
|
||||
t.Fatalf("Expected Marshal to return error rejecting deterministic flag")
|
||||
}
|
||||
}
|
||||
|
||||
func TestOrderedNestedStructMap(t *testing.T) {
|
||||
var b proto.Buffer
|
||||
m := getTestMap()
|
||||
in := &NestedMap1{
|
||||
NestedStringMap: m,
|
||||
}
|
||||
if err := b.Marshal(in); err != nil {
|
||||
t.Fatalf("Marshal failed: %v", err)
|
||||
}
|
||||
data1 := b.Bytes()
|
||||
out := &NestedMap1{}
|
||||
if err := proto.Unmarshal(data1, out); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := in.VerboseEqual(out); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
data2, err := proto.Marshal(in)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if bytes.Compare(data1, data2) != 0 {
|
||||
t.Fatal("byte arrays are not the same\n", data1, "\n", data2)
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnorderedNestedStructMap(t *testing.T) {
|
||||
m := getTestMap()
|
||||
in := &NestedMap2{
|
||||
NestedStringMap: m,
|
||||
}
|
||||
var b proto.Buffer
|
||||
b.SetDeterministic(true)
|
||||
if err := b.Marshal(in); err == nil {
|
||||
t.Fatalf("Expected Marshal to return error rejecting deterministic flag")
|
||||
}
|
||||
}
|
1
vendor/github.com/gogo/protobuf/test/embedconflict/.gitignore
generated
vendored
Normal file
1
vendor/github.com/gogo/protobuf/test/embedconflict/.gitignore
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.pb.go
|
1
vendor/github.com/gogo/protobuf/test/embedconflict/doc.go
generated
vendored
Normal file
1
vendor/github.com/gogo/protobuf/test/embedconflict/doc.go
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
package embedconflict
|
38
vendor/github.com/gogo/protobuf/test/embedconflict/eb.proto
generated
vendored
Normal file
38
vendor/github.com/gogo/protobuf/test/embedconflict/eb.proto
generated
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
|
||||
package embedconflict;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
message TakesLongTooDebug {
|
||||
optional bytes Field1 = 1;
|
||||
optional bytes Field2 = 2 [(gogoproto.nullable)=false, (gogoproto.embed)=true];
|
||||
}
|
40
vendor/github.com/gogo/protobuf/test/embedconflict/ec.proto
generated
vendored
Normal file
40
vendor/github.com/gogo/protobuf/test/embedconflict/ec.proto
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package embedconflict;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
message A {
|
||||
optional int64 Field1 = 1;
|
||||
optional B B = 2 [(gogoproto.embed) = true];
|
||||
}
|
||||
|
||||
message B {
|
||||
optional double Field1 = 1;
|
||||
}
|
119
vendor/github.com/gogo/protobuf/test/embedconflict/ec_test.go
generated
vendored
Normal file
119
vendor/github.com/gogo/protobuf/test/embedconflict/ec_test.go
generated
vendored
Normal file
@ -0,0 +1,119 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package embedconflict
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestEmbedConflict(t *testing.T) {
|
||||
cmd := exec.Command("protoc", "--gogo_out=.", "-I=../../../../../:../../protobuf/:.", "ec.proto")
|
||||
data, err := cmd.CombinedOutput()
|
||||
if err == nil && !strings.Contains(string(data), "Plugin failed with status code 1") {
|
||||
t.Errorf("Expected error, got: %s", data)
|
||||
if err = os.Remove("ec.pb.go"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
t.Logf("received expected error = %v and output = %v", err, string(data))
|
||||
}
|
||||
|
||||
func TestEmbedMarshaler(t *testing.T) {
|
||||
cmd := exec.Command("protoc", "--gogo_out=.", "-I=../../../../../:../../protobuf/:.", "em.proto")
|
||||
data, err := cmd.CombinedOutput()
|
||||
dataStr := string(data)
|
||||
t.Logf("received error = %v and output = %v", err, dataStr)
|
||||
if !strings.Contains(dataStr, "WARNING: found non-") || !strings.Contains(dataStr, "unsafe_marshaler") {
|
||||
t.Errorf("Expected WARNING: found non-[marshaler unsafe_marshaler] C with embedded marshaler D")
|
||||
}
|
||||
if err = os.Remove("em.pb.go"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEmbedExtend(t *testing.T) {
|
||||
cmd := exec.Command("protoc", "--gogo_out=.", "-I=../../../../../:../../protobuf/:.", "ee.proto")
|
||||
data, err := cmd.CombinedOutput()
|
||||
if err == nil && !strings.Contains(string(data), "Plugin failed with status code 1") {
|
||||
t.Errorf("Expected error, got: %s", data)
|
||||
if err = os.Remove("ee.pb.go"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
t.Logf("received expected error = %v and output = %v", err, string(data))
|
||||
}
|
||||
|
||||
func TestCustomName(t *testing.T) {
|
||||
cmd := exec.Command("protoc", "--gogo_out=.", "-I=../../../../../:../../protobuf/:.", "en.proto")
|
||||
data, err := cmd.CombinedOutput()
|
||||
if err == nil && !strings.Contains(string(data), "Plugin failed with status code 1") {
|
||||
t.Errorf("Expected error, got: %s", data)
|
||||
if err = os.Remove("en.pb.go"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
t.Logf("received expected error = %v and output = %v", err, string(data))
|
||||
}
|
||||
|
||||
func TestRepeatedEmbed(t *testing.T) {
|
||||
cmd := exec.Command("protoc", "--gogo_out=.", "-I=../../../../../:../../protobuf/:.", "er.proto")
|
||||
data, err := cmd.CombinedOutput()
|
||||
if err == nil && !strings.Contains(string(data), "Plugin failed with status code 1") {
|
||||
t.Errorf("Expected error, got: %s", data)
|
||||
if err = os.Remove("er.pb.go"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
dataStr := string(data)
|
||||
t.Logf("received error = %v and output = %v", err, dataStr)
|
||||
warning := "ERROR: found repeated embedded field B in message A"
|
||||
if !strings.Contains(dataStr, warning) {
|
||||
t.Errorf("Expected " + warning)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTakesTooLongToDebug(t *testing.T) {
|
||||
cmd := exec.Command("protoc", "--gogo_out=.", "-I=../../../../../:../../protobuf/:.", "eb.proto")
|
||||
data, err := cmd.CombinedOutput()
|
||||
if err == nil && !strings.Contains(string(data), "Plugin failed with status code 1") {
|
||||
t.Errorf("Expected error, got: %s", data)
|
||||
if err = os.Remove("eb.pb.go"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
dataStr := string(data)
|
||||
t.Logf("received error = %v and output = %v", err, dataStr)
|
||||
warning := "ERROR: found embedded bytes field"
|
||||
if !strings.Contains(dataStr, warning) {
|
||||
t.Errorf("Expected " + warning)
|
||||
}
|
||||
}
|
41
vendor/github.com/gogo/protobuf/test/embedconflict/ee.proto
generated
vendored
Normal file
41
vendor/github.com/gogo/protobuf/test/embedconflict/ee.proto
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
package embedconflict;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
message E {
|
||||
optional int64 Field1 = 1;
|
||||
extensions 100 to 199;
|
||||
}
|
||||
|
||||
extend E {
|
||||
optional int64 Field1 = 100 [(gogoproto.embed) = true];
|
||||
}
|
42
vendor/github.com/gogo/protobuf/test/embedconflict/em.proto
generated
vendored
Normal file
42
vendor/github.com/gogo/protobuf/test/embedconflict/em.proto
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
package embedconflict;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
message C {
|
||||
optional int64 Field1 = 1;
|
||||
optional D D = 2 [(gogoproto.embed) = true];
|
||||
}
|
||||
|
||||
message D {
|
||||
option (gogoproto.marshaler) = true;
|
||||
optional double Field2 = 2;
|
||||
}
|
40
vendor/github.com/gogo/protobuf/test/embedconflict/en.proto
generated
vendored
Normal file
40
vendor/github.com/gogo/protobuf/test/embedconflict/en.proto
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
package embedconflict;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
message F {
|
||||
optional G G = 2 [(gogoproto.embed) = true, (gogoproto.customname) = "G"];
|
||||
}
|
||||
|
||||
message G {
|
||||
optional int64 Field1 = 1;
|
||||
}
|
41
vendor/github.com/gogo/protobuf/test/embedconflict/er.proto
generated
vendored
Normal file
41
vendor/github.com/gogo/protobuf/test/embedconflict/er.proto
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax = "proto2";
|
||||
package embedconflict;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
message A {
|
||||
optional int64 Field1 = 1;
|
||||
repeated B B = 2 [(gogoproto.embed) = true];
|
||||
}
|
||||
|
||||
message B {
|
||||
optional double Field2 = 2;
|
||||
}
|
30
vendor/github.com/gogo/protobuf/test/empty-issue70/Makefile
generated
vendored
Normal file
30
vendor/github.com/gogo/protobuf/test/empty-issue70/Makefile
generated
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
# Protocol Buffers for Go with Gadgets
|
||||
#
|
||||
# Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
# http://github.com/gogo/protobuf
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
regenerate:
|
||||
(protoc --proto_path=../../../../../:../../protobuf/:. --gogo_out=. empty.proto)
|
223
vendor/github.com/gogo/protobuf/test/empty-issue70/empty.pb.go
generated
vendored
Normal file
223
vendor/github.com/gogo/protobuf/test/empty-issue70/empty.pb.go
generated
vendored
Normal file
@ -0,0 +1,223 @@
|
||||
// Code generated by protoc-gen-gogo. DO NOT EDIT.
|
||||
// source: empty.proto
|
||||
|
||||
package empty
|
||||
|
||||
import proto "github.com/gogo/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import _ "github.com/gogo/protobuf/gogoproto"
|
||||
|
||||
import io "io"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ = proto.Marshal
|
||||
var _ = fmt.Errorf
|
||||
var _ = math.Inf
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the proto package it is being compiled against.
|
||||
// A compilation error at this line likely means your copy of the
|
||||
// proto package needs to be updated.
|
||||
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type TestRequest struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *TestRequest) Reset() { *m = TestRequest{} }
|
||||
func (m *TestRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*TestRequest) ProtoMessage() {}
|
||||
func (*TestRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_empty_5bb98b2f7e13ce4b, []int{0}
|
||||
}
|
||||
func (m *TestRequest) XXX_Unmarshal(b []byte) error {
|
||||
return m.Unmarshal(b)
|
||||
}
|
||||
func (m *TestRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_TestRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *TestRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_TestRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *TestRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_TestRequest.Size(m)
|
||||
}
|
||||
func (m *TestRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_TestRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_TestRequest proto.InternalMessageInfo
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*TestRequest)(nil), "empty.TestRequest")
|
||||
}
|
||||
func (m *TestRequest) Unmarshal(dAtA []byte) error {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
preIndex := iNdEx
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowEmpty
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
fieldNum := int32(wire >> 3)
|
||||
wireType := int(wire & 0x7)
|
||||
if wireType == 4 {
|
||||
return fmt.Errorf("proto: TestRequest: wiretype end group for non-group")
|
||||
}
|
||||
if fieldNum <= 0 {
|
||||
return fmt.Errorf("proto: TestRequest: illegal tag %d (wire type %d)", fieldNum, wire)
|
||||
}
|
||||
switch fieldNum {
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipEmpty(dAtA[iNdEx:])
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if skippy < 0 {
|
||||
return ErrInvalidLengthEmpty
|
||||
}
|
||||
if (iNdEx + skippy) > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...)
|
||||
iNdEx += skippy
|
||||
}
|
||||
}
|
||||
|
||||
if iNdEx > l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
return nil
|
||||
}
|
||||
func skipEmpty(dAtA []byte) (n int, err error) {
|
||||
l := len(dAtA)
|
||||
iNdEx := 0
|
||||
for iNdEx < l {
|
||||
var wire uint64
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowEmpty
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
wire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
wireType := int(wire & 0x7)
|
||||
switch wireType {
|
||||
case 0:
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowEmpty
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
iNdEx++
|
||||
if dAtA[iNdEx-1] < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 1:
|
||||
iNdEx += 8
|
||||
return iNdEx, nil
|
||||
case 2:
|
||||
var length int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowEmpty
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
length |= (int(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
iNdEx += length
|
||||
if length < 0 {
|
||||
return 0, ErrInvalidLengthEmpty
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 3:
|
||||
for {
|
||||
var innerWire uint64
|
||||
var start int = iNdEx
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return 0, ErrIntOverflowEmpty
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return 0, io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
innerWire |= (uint64(b) & 0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
innerWireType := int(innerWire & 0x7)
|
||||
if innerWireType == 4 {
|
||||
break
|
||||
}
|
||||
next, err := skipEmpty(dAtA[start:])
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
iNdEx = start + next
|
||||
}
|
||||
return iNdEx, nil
|
||||
case 4:
|
||||
return iNdEx, nil
|
||||
case 5:
|
||||
iNdEx += 4
|
||||
return iNdEx, nil
|
||||
default:
|
||||
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
|
||||
}
|
||||
}
|
||||
panic("unreachable")
|
||||
}
|
||||
|
||||
var (
|
||||
ErrInvalidLengthEmpty = fmt.Errorf("proto: negative length found during unmarshaling")
|
||||
ErrIntOverflowEmpty = fmt.Errorf("proto: integer overflow")
|
||||
)
|
||||
|
||||
func init() { proto.RegisterFile("empty.proto", fileDescriptor_empty_5bb98b2f7e13ce4b) }
|
||||
|
||||
var fileDescriptor_empty_5bb98b2f7e13ce4b = []byte{
|
||||
// 92 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4e, 0xcd, 0x2d, 0x28,
|
||||
0xa9, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x05, 0x73, 0xa4, 0x74, 0xd3, 0x33, 0x4b,
|
||||
0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5, 0xc1, 0xb2, 0x49,
|
||||
0xa5, 0x69, 0x60, 0x1e, 0x98, 0x03, 0x66, 0x41, 0x74, 0x29, 0xf1, 0x72, 0x71, 0x87, 0xa4, 0x16,
|
||||
0x97, 0x04, 0xa5, 0x16, 0x96, 0xa6, 0x16, 0x97, 0x38, 0xb1, 0x5c, 0x78, 0x24, 0xc7, 0x08, 0x08,
|
||||
0x00, 0x00, 0xff, 0xff, 0x0e, 0xe3, 0x23, 0x3d, 0x58, 0x00, 0x00, 0x00,
|
||||
}
|
39
vendor/github.com/gogo/protobuf/test/empty-issue70/empty.proto
generated
vendored
Normal file
39
vendor/github.com/gogo/protobuf/test/empty-issue70/empty.proto
generated
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
// Protocol Buffers for Go with Gadgets
|
||||
//
|
||||
// Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
// http://github.com/gogo/protobuf
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
syntax="proto2";
|
||||
|
||||
package empty;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.unmarshaler_all) = true;
|
||||
|
||||
message TestRequest {
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user