Updated vednor files

This commit is contained in:
Serguei Bezverkhi
2018-02-15 08:50:31 -05:00
parent 18a4ce4439
commit 1f1e8cea37
3299 changed files with 834 additions and 1051200 deletions

View File

@ -1 +0,0 @@
*.dat

View File

@ -1,39 +0,0 @@
# 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/

View File

@ -1,30 +0,0 @@
# 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)

View File

@ -1,607 +0,0 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: asym.proto
/*
Package asym is a generated protocol buffer package.
It is generated from these files:
asym.proto
It has these top-level messages:
M
MyType
*/
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_unrecognized []byte `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 fileDescriptorAsym, []int{0} }
type MyType struct {
XXX_unrecognized []byte `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 fileDescriptorAsym, []int{1} }
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 {
if this == nil {
return true
}
return false
}
that1, ok := that.(*M)
if !ok {
that2, ok := that.(M)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
if this == nil {
return true
}
return false
} 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 {
if this == nil {
return true
}
return false
}
that1, ok := that.(*MyType)
if !ok {
that2, ok := that.(MyType)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
if this == nil {
return true
}
return false
} 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) {
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", fileDescriptorAsym) }
var fileDescriptorAsym = []byte{
// 163 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, 0xc9, 0x3c, 0x78, 0x28, 0xc7, 0xf8, 0xe3, 0xa1, 0x1c, 0xe3,
0x8a, 0x47, 0x72, 0x8c, 0x3b, 0x1e, 0xc9, 0x31, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c,
0xe3, 0x83, 0x47, 0x72, 0x8c, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9c, 0x0b, 0x12, 0x6c, 0xa2,
0x00, 0x00, 0x00,
}

View File

@ -1,52 +0,0 @@
// 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;
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;
}

View File

@ -1,40 +0,0 @@
// 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{[]MyType{{}, {}}, nil}
if err := m.VerboseEqual(m); err != nil {
t.Fatalf("should be equal: %v", err)
}
}

View File

@ -1,185 +0,0 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: asym.proto
/*
Package asym is a generated protocol buffer package.
It is generated from these files:
asym.proto
It has these top-level messages:
M
MyType
*/
package asym
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 proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
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 TestMProto(t *testing.T) {
seed := time.Now().UnixNano()
popr := math_rand.New(math_rand.NewSource(seed))
p := NewPopulatedM(popr, false)
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
if err != nil {
t.Fatalf("seed = %d, err = %v", seed, err)
}
msg := &M{}
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 TestMMarshalTo(t *testing.T) {
seed := time.Now().UnixNano()
popr := math_rand.New(math_rand.NewSource(seed))
p := NewPopulatedM(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 := &M{}
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 TestMJSON(t *testing.T) {
seed := time.Now().UnixNano()
popr := math_rand.New(math_rand.NewSource(seed))
p := NewPopulatedM(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 := &M{}
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 TestMProtoText(t *testing.T) {
seed := time.Now().UnixNano()
popr := math_rand.New(math_rand.NewSource(seed))
p := NewPopulatedM(popr, true)
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
msg := &M{}
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 TestMProtoCompactText(t *testing.T) {
seed := time.Now().UnixNano()
popr := math_rand.New(math_rand.NewSource(seed))
p := NewPopulatedM(popr, true)
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
msg := &M{}
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 TestMVerboseEqual(t *testing.T) {
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
p := NewPopulatedM(popr, false)
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
if err != nil {
panic(err)
}
msg := &M{}
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 TestMSize(t *testing.T) {
seed := time.Now().UnixNano()
popr := math_rand.New(math_rand.NewSource(seed))
p := NewPopulatedM(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)
}
}
//These tests are generated by github.com/gogo/protobuf/plugin/testgen

View File

@ -1,64 +0,0 @@
// 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
}
func (m MyType) 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 *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
}

View File

@ -1,252 +0,0 @@
// 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.Fatal("expected equal")
}
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.Fatal("expected equal")
}
data2, err2 := proto.Marshal(output)
if err2 != nil {
t.Fatal(err2)
}
if len(data) != len(data2) {
t.Fatal("expected equal length buffers")
}
}

View File

@ -1,32 +0,0 @@
# 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

View File

@ -1,80 +0,0 @@
// 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;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,80 +0,0 @@
// 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;
}

View File

@ -1,512 +0,0 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: combos/both/casttype.proto
/*
Package casttype is a generated protocol buffer package.
It is generated from these files:
combos/both/casttype.proto
It has these top-level messages:
Castaway
Wilson
*/
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

File diff suppressed because it is too large Load Diff

View File

@ -1,80 +0,0 @@
// 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;
}

View File

@ -1,512 +0,0 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: combos/marshaler/casttype.proto
/*
Package casttype is a generated protocol buffer package.
It is generated from these files:
combos/marshaler/casttype.proto
It has these top-level messages:
Castaway
Wilson
*/
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

File diff suppressed because it is too large Load Diff

View File

@ -1,80 +0,0 @@
// 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;
}

View File

@ -1,456 +0,0 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: combos/neither/casttype.proto
/*
Package casttype is a generated protocol buffer package.
It is generated from these files:
combos/neither/casttype.proto
It has these top-level messages:
Castaway
Wilson
*/
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

File diff suppressed because it is too large Load Diff

View File

@ -1,80 +0,0 @@
// 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;
}

View File

@ -1,456 +0,0 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: combos/unmarshaler/casttype.proto
/*
Package casttype is a generated protocol buffer package.
It is generated from these files:
combos/unmarshaler/casttype.proto
It has these top-level messages:
Castaway
Wilson
*/
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

View File

@ -1,59 +0,0 @@
// 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

View File

@ -1,40 +0,0 @@
# 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

View File

@ -1,867 +0,0 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: castvalue.proto
/*
Package castvalue is a generated protocol buffer package.
It is generated from these files:
castvalue.proto
It has these top-level messages:
Castaway
Wilson
*/
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_unrecognized []byte `json:"-"`
}
func (m *Castaway) Reset() { *m = Castaway{} }
func (*Castaway) ProtoMessage() {}
func (*Castaway) Descriptor() ([]byte, []int) { return fileDescriptorCastvalue, []int{0} }
type Wilson struct {
Int64 *int64 `protobuf:"varint,1,opt,name=Int64" json:"Int64,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *Wilson) Reset() { *m = Wilson{} }
func (*Wilson) ProtoMessage() {}
func (*Wilson) Descriptor() ([]byte, []int) { return fileDescriptorCastvalue, []int{1} }
func init() {
proto.RegisterType((*Castaway)(nil), "castvalue.Castaway")
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{
// 3858 bytes of a gzipped FileDescriptorSet
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5a, 0x5d, 0x70, 0x1b, 0xd7,
0x75, 0xe6, 0xe2, 0x87, 0x04, 0x0e, 0x40, 0x70, 0x79, 0x49, 0x4b, 0x10, 0x1d, 0x43, 0x12, 0xfd,
0x23, 0xda, 0x4e, 0xa8, 0x8c, 0x2c, 0xc9, 0x32, 0xd4, 0xc4, 0x05, 0x41, 0x88, 0x81, 0xca, 0x1f,
0x64, 0x41, 0xc6, 0x52, 0xfa, 0xb0, 0xb3, 0x5c, 0x5c, 0x80, 0x2b, 0x2d, 0x76, 0x37, 0xbb, 0x0b,
0xc9, 0xd4, 0xf4, 0x41, 0x1d, 0xa7, 0xed, 0xa4, 0x9d, 0xfe, 0x77, 0xa6, 0x89, 0xeb, 0xb8, 0x6d,
0x66, 0x5a, 0xa7, 0x49, 0x7f, 0x92, 0xa6, 0x4d, 0xd3, 0x3e, 0xa5, 0x0f, 0x69, 0xfd, 0xd4, 0x49,
0xde, 0xfa, 0xd0, 0x69, 0x2d, 0xd6, 0x33, 0x75, 0x5b, 0xb7, 0x75, 0x1b, 0x3f, 0x64, 0xc6, 0xd3,
0x99, 0xce, 0xfd, 0x5b, 0xec, 0x02, 0x20, 0x17, 0x4c, 0xc7, 0xce, 0x13, 0x71, 0xcf, 0x3d, 0xdf,
0x77, 0xcf, 0x3d, 0xf7, 0xdc, 0x7b, 0xce, 0xbd, 0x4b, 0xf8, 0xea, 0x15, 0x38, 0xd3, 0xb1, 0xed,
0x8e, 0x89, 0xcf, 0x3b, 0xae, 0xed, 0xdb, 0xbb, 0xbd, 0xf6, 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, 0x32,
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 {
if this == nil {
return true
}
return false
}
that1, ok := that.(*Castaway)
if !ok {
that2, ok := that.(Castaway)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
if this == nil {
return true
}
return false
} 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 {
if this == nil {
return true
}
return false
}
that1, ok := that.(*Wilson)
if !ok {
that2, ok := that.(Wilson)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
if this == nil {
return true
}
return false
} 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) {
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) {
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", fileDescriptorCastvalue) }
var fileDescriptorCastvalue = []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,
}

View File

@ -1,66 +0,0 @@
// 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;
}

View File

@ -1,456 +0,0 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: castvalue.proto
/*
Package castvalue is a generated protocol buffer package.
It is generated from these files:
castvalue.proto
It has these top-level messages:
Castaway
Wilson
*/
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

File diff suppressed because it is too large Load Diff

View File

@ -1,66 +0,0 @@
// 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;
}

View File

@ -1,512 +0,0 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: combos/both/castvalue.proto
/*
Package castvalue is a generated protocol buffer package.
It is generated from these files:
combos/both/castvalue.proto
It has these top-level messages:
Castaway
Wilson
*/
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

View File

@ -1,31 +0,0 @@
// 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

View File

@ -1,976 +0,0 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: combos/marshaler/castvalue.proto
/*
Package castvalue is a generated protocol buffer package.
It is generated from these files:
combos/marshaler/castvalue.proto
It has these top-level messages:
Castaway
Wilson
*/
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_unrecognized []byte `json:"-"`
}
func (m *Castaway) Reset() { *m = Castaway{} }
func (*Castaway) ProtoMessage() {}
func (*Castaway) Descriptor() ([]byte, []int) { return fileDescriptorCastvalue, []int{0} }
type Wilson struct {
Int64 *int64 `protobuf:"varint,1,opt,name=Int64" json:"Int64,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *Wilson) Reset() { *m = Wilson{} }
func (*Wilson) ProtoMessage() {}
func (*Wilson) Descriptor() ([]byte, []int) { return fileDescriptorCastvalue, []int{1} }
func init() {
proto.RegisterType((*Castaway)(nil), "castvalue.Castaway")
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{
// 3867 bytes of a gzipped FileDescriptorSet
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x5a, 0x5d, 0x70, 0x24, 0xd7,
0x55, 0x56, 0xcf, 0x8f, 0x34, 0x73, 0x66, 0x34, 0x6a, 0x5d, 0xc9, 0xbb, 0xb3, 0x72, 0x3c, 0xab,
0x95, 0x7f, 0x56, 0xb6, 0x13, 0x29, 0xb5, 0xde, 0x5d, 0xaf, 0x67, 0x49, 0xcc, 0x68, 0x34, 0xab,
0xcc, 0xa2, 0xbf, 0xf4, 0x48, 0xf1, 0x6e, 0x78, 0xe8, 0x6a, 0xf5, 0xdc, 0x19, 0xf5, 0x6e, 0x4f,
0x77, 0xa7, 0xbb, 0x67, 0xd7, 0xda, 0xe2, 0x61, 0x29, 0x07, 0xa8, 0x40, 0x11, 0x7e, 0xab, 0x48,
0x8c, 0x63, 0x20, 0x55, 0xe0, 0x90, 0xf0, 0x93, 0x10, 0x08, 0x81, 0xa7, 0xf0, 0x10, 0xf0, 0x13,
0x95, 0xbc, 0xf1, 0x40, 0x81, 0x57, 0xb8, 0x0a, 0x03, 0x06, 0x0c, 0xf1, 0x43, 0xaa, 0xfc, 0x42,
0xdd, 0xbf, 0x9e, 0x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 0x25, 0xe9, 0x87, 0x0f, 0x4a, 0xd2, 0xfd, 0xc3, 0x92, 0xf4,
0x95, 0xc3, 0x92, 0xf4, 0xf5, 0xc3, 0x92, 0xf4, 0xed, 0xc3, 0x92, 0xf4, 0x9d, 0xc3, 0x92, 0xf4,
0xfa, 0x61, 0x49, 0xfa, 0xde, 0x61, 0x69, 0xec, 0x8d, 0xc3, 0x92, 0xf4, 0xd6, 0x61, 0x69, 0xec,
0x9d, 0xc3, 0x92, 0xf4, 0xc3, 0xc3, 0xd2, 0xd8, 0xfd, 0x7f, 0x29, 0x8d, 0xfd, 0x5f, 0x00, 0x00,
0x00, 0xff, 0xff, 0x6b, 0x71, 0xc7, 0xce, 0x35, 0x32, 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 {
if this == nil {
return true
}
return false
}
that1, ok := that.(*Castaway)
if !ok {
that2, ok := that.(Castaway)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
if this == nil {
return true
}
return false
} 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 {
if this == nil {
return true
}
return false
}
that1, ok := that.(*Wilson)
if !ok {
that2, ok := that.(Wilson)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
if this == nil {
return true
}
return false
} 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 (m *Castaway) 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 *Castaway) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if len(m.CastMapValueMessage) > 0 {
for k := range m.CastMapValueMessage {
dAtA[i] = 0xa
i++
v := m.CastMapValueMessage[k]
msgSize := 0
if ((*Wilson)(&v)) != nil {
msgSize = ((*Wilson)(&v)).Size()
msgSize += 1 + sovCastvalue(uint64(msgSize))
}
mapSize := 1 + sovCastvalue(uint64(k)) + msgSize
i = encodeVarintCastvalue(dAtA, i, uint64(mapSize))
dAtA[i] = 0x8
i++
i = encodeVarintCastvalue(dAtA, i, uint64(k))
dAtA[i] = 0x12
i++
i = encodeVarintCastvalue(dAtA, i, uint64(((*Wilson)(&v)).Size()))
n1, err := ((*Wilson)(&v)).MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n1
}
}
if len(m.CastMapValueMessageNullable) > 0 {
for k := range m.CastMapValueMessageNullable {
dAtA[i] = 0x12
i++
v := m.CastMapValueMessageNullable[k]
msgSize := 0
if ((*Wilson)(v)) != nil {
msgSize = ((*Wilson)(v)).Size()
msgSize += 1 + sovCastvalue(uint64(msgSize))
}
mapSize := 1 + sovCastvalue(uint64(k)) + msgSize
i = encodeVarintCastvalue(dAtA, i, uint64(mapSize))
dAtA[i] = 0x8
i++
i = encodeVarintCastvalue(dAtA, i, uint64(k))
if ((*Wilson)(v)) != nil {
dAtA[i] = 0x12
i++
i = encodeVarintCastvalue(dAtA, i, uint64(((*Wilson)(v)).Size()))
n2, err := ((*Wilson)(v)).MarshalTo(dAtA[i:])
if err != nil {
return 0, err
}
i += n2
}
}
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
}
func (m *Wilson) 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 *Wilson) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if m.Int64 != nil {
dAtA[i] = 0x8
i++
i = encodeVarintCastvalue(dAtA, i, uint64(*m.Int64))
}
if m.XXX_unrecognized != nil {
i += copy(dAtA[i:], m.XXX_unrecognized)
}
return i, nil
}
func encodeVarintCastvalue(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 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) {
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) {
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("combos/marshaler/castvalue.proto", fileDescriptorCastvalue) }
var fileDescriptorCastvalue = []byte{
// 358 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x8f, 0xbd, 0x4f, 0x2a, 0x41,
0x14, 0xc5, 0xe7, 0xb2, 0xe1, 0x85, 0x37, 0xbc, 0x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, 0xc7, 0xbe, 0xcf, 0x1c, 0xdf, 0x35, 0x32, 0x0a, 0x5d, 0xfb, 0x26, 0x7a, 0x61, 0x4b, 0x2b,
0xfc, 0x79, 0x87, 0xff, 0x0c, 0x53, 0x3c, 0xa2, 0xc6, 0x47, 0x3f, 0xd1, 0x0b, 0x54, 0x3b, 0x71,
0x13, 0x03, 0x4c, 0xa8, 0x64, 0x9b, 0xf3, 0x51, 0x5f, 0xa5, 0x59, 0xd5, 0xc5, 0xc8, 0x98, 0x50,
0xc9, 0x57, 0xff, 0xbe, 0x69, 0xf7, 0x0c, 0x4b, 0xdf, 0xb7, 0x32, 0x9b, 0x50, 0x64, 0xd4, 0xfc,
0xaa, 0xe9, 0x0f, 0x11, 0x65, 0xa4, 0xbf, 0x52, 0x51, 0xff, 0x4f, 0xb3, 0xbb, 0xbd, 0x68, 0xa3,
0xa6, 0xa2, 0xb4, 0x66, 0xba, 0xd4, 0xf7, 0x86, 0x02, 0xc9, 0x48, 0x20, 0xb9, 0x13, 0x48, 0xc6,
0x02, 0x61, 0x22, 0x10, 0xa6, 0x02, 0x61, 0x26, 0x10, 0x06, 0x12, 0xe1, 0x52, 0x22, 0x5c, 0x49,
0x84, 0x6b, 0x89, 0x70, 0x23, 0x11, 0x86, 0x12, 0x61, 0x24, 0x91, 0x8c, 0x25, 0xc2, 0x44, 0x22,
0x99, 0x4a, 0x84, 0x99, 0x44, 0x32, 0x78, 0x44, 0xf2, 0x14, 0x00, 0x00, 0xff, 0xff, 0xc3, 0x22,
0x8c, 0x46, 0x8e, 0x02, 0x00, 0x00,
}

View File

@ -1,66 +0,0 @@
// 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;
}

View File

@ -1,512 +0,0 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: combos/marshaler/castvalue.proto
/*
Package castvalue is a generated protocol buffer package.
It is generated from these files:
combos/marshaler/castvalue.proto
It has these top-level messages:
Castaway
Wilson
*/
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

View File

@ -1,31 +0,0 @@
// 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

File diff suppressed because it is too large Load Diff

View File

@ -1,66 +0,0 @@
// 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;
}

View File

@ -1,456 +0,0 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: combos/unmarshaler/castvalue.proto
/*
Package castvalue is a generated protocol buffer package.
It is generated from these files:
combos/unmarshaler/castvalue.proto
It has these top-level messages:
Castaway
Wilson
*/
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

View File

@ -1,31 +0,0 @@
// 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

View File

@ -1,31 +0,0 @@
// 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

View File

@ -1,252 +0,0 @@
// 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.Fatal("expected equal")
}
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.Fatal("expected equal")
}
data2, err2 := proto.Marshal(output)
if err2 != nil {
t.Fatal(err2)
}
if len(data) != len(data2) {
t.Fatal("expected equal length buffers")
}
}

View File

@ -1,77 +0,0 @@
package test
import (
"encoding/json"
"strings"
"github.com/gogo/protobuf/proto"
)
type T struct {
Data string
}
func (gt *T) protoType() *ProtoType {
return &ProtoType{
Field2: &gt.Data,
}
}
func (gt T) Equal(other T) bool {
return gt.protoType().Equal(other.protoType())
}
func (gt *T) Size() int {
proto := &ProtoType{
Field2: &gt.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)
}

File diff suppressed because it is too large Load Diff

View File

@ -1,649 +0,0 @@
// 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;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,133 +0,0 @@
// 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) 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
}

View File

@ -1,252 +0,0 @@
// 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.Fatal("expected equal")
}
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.Fatal("expected equal")
}
data2, err2 := proto.Marshal(output)
if err2 != nil {
t.Fatal(err2)
}
if len(data) != len(data2) {
t.Fatal("expected equal length buffers")
}
}

View File

@ -1,77 +0,0 @@
package test
import (
"encoding/json"
"strings"
"github.com/gogo/protobuf/proto"
)
type T struct {
Data string
}
func (gt *T) protoType() *ProtoType {
return &ProtoType{
Field2: &gt.Data,
}
}
func (gt T) Equal(other T) bool {
return gt.protoType().Equal(other.protoType())
}
func (gt *T) Size() int {
proto := &ProtoType{
Field2: &gt.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)
}

File diff suppressed because it is too large Load Diff

View File

@ -1,649 +0,0 @@
// 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;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,133 +0,0 @@
// 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) 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
}

View File

@ -1,252 +0,0 @@
// 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.Fatal("expected equal")
}
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.Fatal("expected equal")
}
data2, err2 := proto.Marshal(output)
if err2 != nil {
t.Fatal(err2)
}
if len(data) != len(data2) {
t.Fatal("expected equal length buffers")
}
}

View File

@ -1,73 +0,0 @@
package test
import (
"encoding/json"
"strings"
"github.com/gogo/protobuf/proto"
)
type T struct {
Data string
}
func (gt *T) protoType() *ProtoType {
return &ProtoType{
Field2: &gt.Data,
}
}
func (gt T) Equal(other T) bool {
return gt.protoType().Equal(other.protoType())
}
func (gt *T) Size() int {
proto := &ProtoType{
Field2: &gt.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)
}

File diff suppressed because it is too large Load Diff

View File

@ -1,649 +0,0 @@
// 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;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,133 +0,0 @@
// 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) 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
}

View File

@ -1,104 +0,0 @@
// 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
}

View File

@ -1,154 +0,0 @@
// 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
}

View File

@ -1,43 +0,0 @@
// 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)
}
}

View File

@ -1,30 +0,0 @@
# 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)

View File

@ -1,34 +0,0 @@
// 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) {
}

View File

@ -1,36 +0,0 @@
// 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
}

View File

@ -1,281 +0,0 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: proto.proto
/*
Package custombytesnonstruct is a generated protocol buffer package.
It is generated from these files:
proto.proto
It has these top-level messages:
Object
*/
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_unrecognized []byte `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 fileDescriptorProto, []int{0} }
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", fileDescriptorProto) }
var fileDescriptorProto = []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,
}

View File

@ -1,39 +0,0 @@
// 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"];
}

View File

@ -1,38 +0,0 @@
// 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 {
}

View File

@ -1,48 +0,0 @@
// 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)
}
}

View File

@ -1 +0,0 @@
package dashfilename

View File

@ -1,33 +0,0 @@
# 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

View File

@ -1,472 +0,0 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: data.proto
/*
Package data is a generated protocol buffer package.
It is generated from these files:
data.proto
It has these top-level messages:
MyMessage
*/
package data
import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
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"`
}
func (m *MyMessage) Reset() { *m = MyMessage{} }
func (*MyMessage) ProtoMessage() {}
func (*MyMessage) Descriptor() ([]byte, []int) { return fileDescriptorData, []int{0} }
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)
}
return nil
}
func (this *MyMessage) Equal(that interface{}) bool {
if that == nil {
if this == nil {
return true
}
return false
}
that1, ok := that.(*MyMessage)
if !ok {
that2, ok := that.(MyMessage)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
if this == nil {
return true
}
return false
} else if this == nil {
return false
}
if this.MyData != that1.MyData {
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")
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))
}
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 {
}
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) {
var l int
_ = l
if m.MyData != 0 {
n += 1 + sovData(uint64(m.MyData))
}
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) + `,`,
`}`,
}, "")
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
}
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", fileDescriptorData) }
var fileDescriptorData = []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,
}

View File

@ -1,49 +0,0 @@
// 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;
}

View File

@ -1,262 +0,0 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: data.proto
/*
Package data is a generated protocol buffer package.
It is generated from these files:
data.proto
It has these top-level messages:
MyMessage
*/
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

View File

@ -1,40 +0,0 @@
// 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];
}

View File

@ -1,39 +0,0 @@
// 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];
}

View File

@ -1 +0,0 @@
package defaultcheck

View File

@ -1,37 +0,0 @@
// 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];;
}

View File

@ -1,68 +0,0 @@
// 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")
}

View File

@ -1,42 +0,0 @@
// 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];
}

View File

@ -1,41 +0,0 @@
// 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];
}

View File

@ -1 +0,0 @@
*.pb.go

View File

@ -1 +0,0 @@
package embedconflict

View File

@ -1,38 +0,0 @@
// 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];
}

View File

@ -1,40 +0,0 @@
// 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;
}

View File

@ -1,119 +0,0 @@
// 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)
}
}

View File

@ -1,41 +0,0 @@
// 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];
}

View File

@ -1,42 +0,0 @@
// 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;
}

View File

@ -1,40 +0,0 @@
// 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;
}

View File

@ -1,41 +0,0 @@
// 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;
}

View File

@ -1,30 +0,0 @@
# 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)

View File

@ -1,211 +0,0 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: empty.proto
/*
Package empty is a generated protocol buffer package.
It is generated from these files:
empty.proto
It has these top-level messages:
TestRequest
*/
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_unrecognized []byte `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 fileDescriptorEmpty, []int{0} }
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", fileDescriptorEmpty) }
var fileDescriptorEmpty = []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,
}

View File

@ -1,39 +0,0 @@
// 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 {
}

View File

@ -1,37 +0,0 @@
// 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 empty
import (
"testing"
)
func TestEmpty(t *testing.T) {
}

View File

@ -1,30 +0,0 @@
# 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=. enumcustomname.proto)

View File

@ -1,312 +0,0 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: enumcustomname.proto
/*
Package enumcustomname is a generated protocol buffer package.
Package enumcustomname tests the behavior of enum_customname and
enumvalue_customname extensions.
It is generated from these files:
enumcustomname.proto
It has these top-level messages:
OnlyEnums
*/
package enumcustomname
import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
import test "github.com/gogo/protobuf/test"
import strconv "strconv"
// 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 MyCustomEnum int32
const (
// The following field will take on the custom name and the prefix, joined
// by an underscore.
MyCustomEnum_MyBetterNameA MyCustomEnum = 0
MyCustomEnum_B MyCustomEnum = 1
)
var MyCustomEnum_name = map[int32]string{
0: "A",
1: "B",
}
var MyCustomEnum_value = map[string]int32{
"A": 0,
"B": 1,
}
func (x MyCustomEnum) Enum() *MyCustomEnum {
p := new(MyCustomEnum)
*p = x
return p
}
func (x MyCustomEnum) String() string {
return proto.EnumName(MyCustomEnum_name, int32(x))
}
func (x *MyCustomEnum) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(MyCustomEnum_value, data, "MyCustomEnum")
if err != nil {
return err
}
*x = MyCustomEnum(value)
return nil
}
func (MyCustomEnum) EnumDescriptor() ([]byte, []int) { return fileDescriptorEnumcustomname, []int{0} }
type MyCustomUnprefixedEnum int32
const (
MyBetterNameUnprefixedA MyCustomUnprefixedEnum = 0
UNPREFIXED_B MyCustomUnprefixedEnum = 1
)
var MyCustomUnprefixedEnum_name = map[int32]string{
0: "UNPREFIXED_A",
1: "UNPREFIXED_B",
}
var MyCustomUnprefixedEnum_value = map[string]int32{
"UNPREFIXED_A": 0,
"UNPREFIXED_B": 1,
}
func (x MyCustomUnprefixedEnum) Enum() *MyCustomUnprefixedEnum {
p := new(MyCustomUnprefixedEnum)
*p = x
return p
}
func (x MyCustomUnprefixedEnum) MarshalJSON() ([]byte, error) {
return proto.MarshalJSONEnum(MyCustomUnprefixedEnum_name, int32(x))
}
func (x *MyCustomUnprefixedEnum) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(MyCustomUnprefixedEnum_value, data, "MyCustomUnprefixedEnum")
if err != nil {
return err
}
*x = MyCustomUnprefixedEnum(value)
return nil
}
func (MyCustomUnprefixedEnum) EnumDescriptor() ([]byte, []int) {
return fileDescriptorEnumcustomname, []int{1}
}
type MyEnumWithEnumStringer int32
const (
MyEnumWithEnumStringer_EnumValueStringerA MyEnumWithEnumStringer = 0
MyEnumWithEnumStringer_STRINGER_B MyEnumWithEnumStringer = 1
)
var MyEnumWithEnumStringer_name = map[int32]string{
0: "STRINGER_A",
1: "STRINGER_B",
}
var MyEnumWithEnumStringer_value = map[string]int32{
"STRINGER_A": 0,
"STRINGER_B": 1,
}
func (x MyEnumWithEnumStringer) Enum() *MyEnumWithEnumStringer {
p := new(MyEnumWithEnumStringer)
*p = x
return p
}
func (x MyEnumWithEnumStringer) MarshalJSON() ([]byte, error) {
return proto.MarshalJSONEnum(MyEnumWithEnumStringer_name, int32(x))
}
func (x *MyEnumWithEnumStringer) UnmarshalJSON(data []byte) error {
value, err := proto.UnmarshalJSONEnum(MyEnumWithEnumStringer_value, data, "MyEnumWithEnumStringer")
if err != nil {
return err
}
*x = MyEnumWithEnumStringer(value)
return nil
}
func (MyEnumWithEnumStringer) EnumDescriptor() ([]byte, []int) {
return fileDescriptorEnumcustomname, []int{2}
}
type OnlyEnums struct {
MyEnum *MyCustomEnum `protobuf:"varint,1,opt,name=my_enum,json=myEnum,enum=enumcustomname.MyCustomEnum" json:"my_enum,omitempty"`
MyEnumDefaultA *MyCustomEnum `protobuf:"varint,2,opt,name=my_enum_default_a,json=myEnumDefaultA,enum=enumcustomname.MyCustomEnum,def=0" json:"my_enum_default_a,omitempty"`
MyEnumDefaultB *MyCustomEnum `protobuf:"varint,3,opt,name=my_enum_default_b,json=myEnumDefaultB,enum=enumcustomname.MyCustomEnum,def=1" json:"my_enum_default_b,omitempty"`
MyUnprefixedEnum *MyCustomUnprefixedEnum `protobuf:"varint,4,opt,name=my_unprefixed_enum,json=myUnprefixedEnum,enum=enumcustomname.MyCustomUnprefixedEnum" json:"my_unprefixed_enum,omitempty"`
MyUnprefixedEnumDefaultA *MyCustomUnprefixedEnum `protobuf:"varint,5,opt,name=my_unprefixed_enum_default_a,json=myUnprefixedEnumDefaultA,enum=enumcustomname.MyCustomUnprefixedEnum,def=0" json:"my_unprefixed_enum_default_a,omitempty"`
MyUnprefixedEnumDefaultB *MyCustomUnprefixedEnum `protobuf:"varint,6,opt,name=my_unprefixed_enum_default_b,json=myUnprefixedEnumDefaultB,enum=enumcustomname.MyCustomUnprefixedEnum,def=1" json:"my_unprefixed_enum_default_b,omitempty"`
YetAnotherTestEnum *test.YetAnotherTestEnum `protobuf:"varint,7,opt,name=yet_another_test_enum,json=yetAnotherTestEnum,enum=test.YetAnotherTestEnum" json:"yet_another_test_enum,omitempty"`
YetAnotherTestEnumDefaultAa *test.YetAnotherTestEnum `protobuf:"varint,8,opt,name=yet_another_test_enum_default_aa,json=yetAnotherTestEnumDefaultAa,enum=test.YetAnotherTestEnum,def=0" json:"yet_another_test_enum_default_aa,omitempty"`
YetAnotherTestEnumDefaultBb *test.YetAnotherTestEnum `protobuf:"varint,9,opt,name=yet_another_test_enum_default_bb,json=yetAnotherTestEnumDefaultBb,enum=test.YetAnotherTestEnum,def=1" json:"yet_another_test_enum_default_bb,omitempty"`
YetYetAnotherTestEnum *test.YetYetAnotherTestEnum `protobuf:"varint,10,opt,name=yet_yet_another_test_enum,json=yetYetAnotherTestEnum,enum=test.YetYetAnotherTestEnum" json:"yet_yet_another_test_enum,omitempty"`
YetYetAnotherTestEnumDefaultCc *test.YetYetAnotherTestEnum `protobuf:"varint,11,opt,name=yet_yet_another_test_enum_default_cc,json=yetYetAnotherTestEnumDefaultCc,enum=test.YetYetAnotherTestEnum,def=0" json:"yet_yet_another_test_enum_default_cc,omitempty"`
YetYetAnotherTestEnumDefaultDd *test.YetYetAnotherTestEnum `protobuf:"varint,12,opt,name=yet_yet_another_test_enum_default_dd,json=yetYetAnotherTestEnumDefaultDd,enum=test.YetYetAnotherTestEnum,def=1" json:"yet_yet_another_test_enum_default_dd,omitempty"`
XXX_unrecognized []byte `json:"-"`
}
func (m *OnlyEnums) Reset() { *m = OnlyEnums{} }
func (m *OnlyEnums) String() string { return proto.CompactTextString(m) }
func (*OnlyEnums) ProtoMessage() {}
func (*OnlyEnums) Descriptor() ([]byte, []int) { return fileDescriptorEnumcustomname, []int{0} }
const Default_OnlyEnums_MyEnumDefaultA MyCustomEnum = MyCustomEnum_MyBetterNameA
const Default_OnlyEnums_MyEnumDefaultB MyCustomEnum = MyCustomEnum_B
const Default_OnlyEnums_MyUnprefixedEnumDefaultA MyCustomUnprefixedEnum = MyBetterNameUnprefixedA
const Default_OnlyEnums_MyUnprefixedEnumDefaultB MyCustomUnprefixedEnum = UNPREFIXED_B
const Default_OnlyEnums_YetAnotherTestEnumDefaultAa test.YetAnotherTestEnum = test.AA
const Default_OnlyEnums_YetAnotherTestEnumDefaultBb test.YetAnotherTestEnum = test.BetterYetBB
const Default_OnlyEnums_YetYetAnotherTestEnumDefaultCc test.YetYetAnotherTestEnum = test.YetYetAnotherTestEnum_CC
const Default_OnlyEnums_YetYetAnotherTestEnumDefaultDd test.YetYetAnotherTestEnum = test.YetYetAnotherTestEnum_BetterYetDD
func (m *OnlyEnums) GetMyEnum() MyCustomEnum {
if m != nil && m.MyEnum != nil {
return *m.MyEnum
}
return MyCustomEnum_MyBetterNameA
}
func (m *OnlyEnums) GetMyEnumDefaultA() MyCustomEnum {
if m != nil && m.MyEnumDefaultA != nil {
return *m.MyEnumDefaultA
}
return Default_OnlyEnums_MyEnumDefaultA
}
func (m *OnlyEnums) GetMyEnumDefaultB() MyCustomEnum {
if m != nil && m.MyEnumDefaultB != nil {
return *m.MyEnumDefaultB
}
return Default_OnlyEnums_MyEnumDefaultB
}
func (m *OnlyEnums) GetMyUnprefixedEnum() MyCustomUnprefixedEnum {
if m != nil && m.MyUnprefixedEnum != nil {
return *m.MyUnprefixedEnum
}
return MyBetterNameUnprefixedA
}
func (m *OnlyEnums) GetMyUnprefixedEnumDefaultA() MyCustomUnprefixedEnum {
if m != nil && m.MyUnprefixedEnumDefaultA != nil {
return *m.MyUnprefixedEnumDefaultA
}
return Default_OnlyEnums_MyUnprefixedEnumDefaultA
}
func (m *OnlyEnums) GetMyUnprefixedEnumDefaultB() MyCustomUnprefixedEnum {
if m != nil && m.MyUnprefixedEnumDefaultB != nil {
return *m.MyUnprefixedEnumDefaultB
}
return Default_OnlyEnums_MyUnprefixedEnumDefaultB
}
func (m *OnlyEnums) GetYetAnotherTestEnum() test.YetAnotherTestEnum {
if m != nil && m.YetAnotherTestEnum != nil {
return *m.YetAnotherTestEnum
}
return test.AA
}
func (m *OnlyEnums) GetYetAnotherTestEnumDefaultAa() test.YetAnotherTestEnum {
if m != nil && m.YetAnotherTestEnumDefaultAa != nil {
return *m.YetAnotherTestEnumDefaultAa
}
return Default_OnlyEnums_YetAnotherTestEnumDefaultAa
}
func (m *OnlyEnums) GetYetAnotherTestEnumDefaultBb() test.YetAnotherTestEnum {
if m != nil && m.YetAnotherTestEnumDefaultBb != nil {
return *m.YetAnotherTestEnumDefaultBb
}
return Default_OnlyEnums_YetAnotherTestEnumDefaultBb
}
func (m *OnlyEnums) GetYetYetAnotherTestEnum() test.YetYetAnotherTestEnum {
if m != nil && m.YetYetAnotherTestEnum != nil {
return *m.YetYetAnotherTestEnum
}
return test.YetYetAnotherTestEnum_CC
}
func (m *OnlyEnums) GetYetYetAnotherTestEnumDefaultCc() test.YetYetAnotherTestEnum {
if m != nil && m.YetYetAnotherTestEnumDefaultCc != nil {
return *m.YetYetAnotherTestEnumDefaultCc
}
return Default_OnlyEnums_YetYetAnotherTestEnumDefaultCc
}
func (m *OnlyEnums) GetYetYetAnotherTestEnumDefaultDd() test.YetYetAnotherTestEnum {
if m != nil && m.YetYetAnotherTestEnumDefaultDd != nil {
return *m.YetYetAnotherTestEnumDefaultDd
}
return Default_OnlyEnums_YetYetAnotherTestEnumDefaultDd
}
func init() {
proto.RegisterType((*OnlyEnums)(nil), "enumcustomname.OnlyEnums")
proto.RegisterEnum("enumcustomname.MyCustomEnum", MyCustomEnum_name, MyCustomEnum_value)
proto.RegisterEnum("enumcustomname.MyCustomUnprefixedEnum", MyCustomUnprefixedEnum_name, MyCustomUnprefixedEnum_value)
proto.RegisterEnum("enumcustomname.MyEnumWithEnumStringer", MyEnumWithEnumStringer_name, MyEnumWithEnumStringer_value)
}
func (x MyEnumWithEnumStringer) String() string {
s, ok := MyEnumWithEnumStringer_name[int32(x)]
if ok {
return s
}
return strconv.Itoa(int(x))
}
func init() { proto.RegisterFile("enumcustomname.proto", fileDescriptorEnumcustomname) }
var fileDescriptorEnumcustomname = []byte{
// 551 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0x4f, 0x8f, 0xd2, 0x40,
0x18, 0xc6, 0x29, 0xba, 0x2c, 0x3b, 0x22, 0xe9, 0x4e, 0x14, 0x47, 0x30, 0x4d, 0xb3, 0x31, 0xc6,
0x60, 0x16, 0x12, 0x8f, 0x78, 0x9a, 0x52, 0x34, 0x1b, 0x03, 0x9a, 0xee, 0xe2, 0xbf, 0x4b, 0xd3,
0x96, 0xe1, 0x4f, 0xc2, 0xb4, 0x9b, 0x32, 0x8d, 0xf6, 0x1b, 0x18, 0xbe, 0x03, 0x27, 0x39, 0x78,
0xf4, 0xbc, 0x67, 0x3f, 0x98, 0x99, 0xe9, 0xc2, 0x42, 0x5b, 0x0a, 0xf1, 0x34, 0xed, 0x9b, 0xe7,
0x7d, 0x7e, 0xf3, 0x3e, 0x79, 0x07, 0x3c, 0x22, 0x6e, 0x40, 0x9d,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9f, 0x6c, 0x3a, 0xde, 0x75,
0x60, 0x28, 0x6f, 0xc9, 0x39, 0xe6, 0xec, 0xe7, 0x2f, 0x25, 0xf7, 0x7b, 0xa9, 0xe4, 0x6e, 0x96,
0x4a, 0x65, 0x85, 0xdb, 0x86, 0xd4, 0xbf, 0x81, 0x4a, 0x74, 0xeb, 0xcf, 0x13, 0x36, 0xe6, 0xe7,
0x25, 0xf3, 0x27, 0xee, 0x88, 0xf8, 0xf0, 0x05, 0x00, 0x97, 0x57, 0xc6, 0x45, 0xef, 0x5d, 0xc7,
0x10, 0xf0, 0xca, 0x7c, 0xa1, 0x42, 0xae, 0xf8, 0x64, 0x4d, 0x03, 0xb2, 0x92, 0x61, 0x58, 0xde,
0xd0, 0x71, 0x6a, 0x91, 0x13, 0xff, 0x2c, 0x15, 0xe9, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbe,
0x65, 0x55, 0xe7, 0xdb, 0x05, 0x00, 0x00,
}

View File

@ -1,75 +0,0 @@
// 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 enumcustomname tests the behavior of enum_customname and
// enumvalue_customname extensions.
package enumcustomname;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "github.com/gogo/protobuf/test/thetest.proto";
enum MyEnum {
option (gogoproto.enum_customname) = "MyCustomEnum";
// The following field will take on the custom name and the prefix, joined
// by an underscore.
A = 0 [(gogoproto.enumvalue_customname) = "MyBetterNameA"];
B = 1; // Should be MyCustomEnum_B
}
enum MyUnprefixedEnum {
option (gogoproto.goproto_enum_prefix) = false;
option (gogoproto.goproto_enum_stringer) = false; // ensure it behaves correctly without stringer.
option (gogoproto.enum_customname) = "MyCustomUnprefixedEnum"; // no prefix added but type gets name
UNPREFIXED_A = 0 [(gogoproto.enumvalue_customname) = "MyBetterNameUnprefixedA"];
UNPREFIXED_B = 1 ; // Should not pick up prefix above
}
enum MyEnumWithEnumStringer {
option (gogoproto.goproto_enum_stringer) = false; // ensure it behaves correctly without stringer.
option (gogoproto.enum_stringer) = true; // ensure it behaves correctly without stringer.
STRINGER_A = 0 [(gogoproto.enumvalue_customname) = "EnumValueStringerA"];
STRINGER_B = 1;
}
message OnlyEnums {
optional MyEnum my_enum = 1;
optional MyEnum my_enum_default_a = 2 [default=A];
optional MyEnum my_enum_default_b = 3 [default=B];
optional MyUnprefixedEnum my_unprefixed_enum = 4;
optional MyUnprefixedEnum my_unprefixed_enum_default_a = 5 [default=UNPREFIXED_A];
optional MyUnprefixedEnum my_unprefixed_enum_default_b = 6 [default=UNPREFIXED_B];
optional test.YetAnotherTestEnum yet_another_test_enum = 7;
optional test.YetAnotherTestEnum yet_another_test_enum_default_aa = 8 [default=AA];
optional test.YetAnotherTestEnum yet_another_test_enum_default_bb = 9 [default=BB];
optional test.YetYetAnotherTestEnum yet_yet_another_test_enum = 10;
optional test.YetYetAnotherTestEnum yet_yet_another_test_enum_default_cc = 11 [default=CC];
optional test.YetYetAnotherTestEnum yet_yet_another_test_enum_default_dd = 12 [default=DD];
}

View File

@ -1,3 +0,0 @@
regenerate:
go install github.com/gogo/protobuf/protoc-gen-gogo
protoc-min-version --version="3.0.0" --gogo_out=. --proto_path=../../../../../:../../protobuf/:. enumdecl.proto

View File

@ -1,452 +0,0 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: enumdecl.proto
/*
Package enumdecl is a generated protocol buffer package.
It is generated from these files:
enumdecl.proto
It has these top-level messages:
Message
*/
package enumdecl
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
var MyEnum_name = map[int32]string{
0: "A",
1: "B",
}
var MyEnum_value = map[string]int32{
"A": 0,
"B": 1,
}
func (x MyEnum) String() string {
return proto.EnumName(MyEnum_name, int32(x))
}
func (MyEnum) EnumDescriptor() ([]byte, []int) { return fileDescriptorEnumdecl, []int{0} }
type Message struct {
EnumeratedField MyEnum `protobuf:"varint,1,opt,name=enumerated_field,json=enumeratedField,proto3,enum=enumdecl.MyEnum" json:"enumerated_field,omitempty"`
}
func (m *Message) Reset() { *m = Message{} }
func (m *Message) String() string { return proto.CompactTextString(m) }
func (*Message) ProtoMessage() {}
func (*Message) Descriptor() ([]byte, []int) { return fileDescriptorEnumdecl, []int{0} }
func (m *Message) GetEnumeratedField() MyEnum {
if m != nil {
return m.EnumeratedField
}
return A
}
func init() {
proto.RegisterType((*Message)(nil), "enumdecl.Message")
proto.RegisterEnum("enumdecl.MyEnum", MyEnum_name, MyEnum_value)
}
func (this *Message) VerboseEqual(that interface{}) error {
if that == nil {
if this == nil {
return nil
}
return fmt.Errorf("that == nil && this != nil")
}
that1, ok := that.(*Message)
if !ok {
that2, ok := that.(Message)
if ok {
that1 = &that2
} else {
return fmt.Errorf("that is not of type *Message")
}
}
if that1 == nil {
if this == nil {
return nil
}
return fmt.Errorf("that is type *Message but is nil && this != nil")
} else if this == nil {
return fmt.Errorf("that is type *Message but is not nil && this == nil")
}
if this.EnumeratedField != that1.EnumeratedField {
return fmt.Errorf("EnumeratedField this(%v) Not Equal that(%v)", this.EnumeratedField, that1.EnumeratedField)
}
return nil
}
func (this *Message) Equal(that interface{}) bool {
if that == nil {
if this == nil {
return true
}
return false
}
that1, ok := that.(*Message)
if !ok {
that2, ok := that.(Message)
if ok {
that1 = &that2
} else {
return false
}
}
if that1 == nil {
if this == nil {
return true
}
return false
} else if this == nil {
return false
}
if this.EnumeratedField != that1.EnumeratedField {
return false
}
return true
}
func (m *Message) 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 *Message) MarshalTo(dAtA []byte) (int, error) {
var i int
_ = i
var l int
_ = l
if m.EnumeratedField != 0 {
dAtA[i] = 0x8
i++
i = encodeVarintEnumdecl(dAtA, i, uint64(m.EnumeratedField))
}
return i, nil
}
func encodeVarintEnumdecl(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 NewPopulatedMessage(r randyEnumdecl, easy bool) *Message {
this := &Message{}
this.EnumeratedField = MyEnum([]int32{0, 1}[r.Intn(2)])
if !easy && r.Intn(10) != 0 {
}
return this
}
type randyEnumdecl interface {
Float32() float32
Float64() float64
Int63() int64
Int31() int32
Uint32() uint32
Intn(n int) int
}
func randUTF8RuneEnumdecl(r randyEnumdecl) 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 randStringEnumdecl(r randyEnumdecl) string {
v1 := r.Intn(100)
tmps := make([]rune, v1)
for i := 0; i < v1; i++ {
tmps[i] = randUTF8RuneEnumdecl(r)
}
return string(tmps)
}
func randUnrecognizedEnumdecl(r randyEnumdecl, 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 = randFieldEnumdecl(dAtA, r, fieldNumber, wire)
}
return dAtA
}
func randFieldEnumdecl(dAtA []byte, r randyEnumdecl, fieldNumber int, wire int) []byte {
key := uint32(fieldNumber)<<3 | uint32(wire)
switch wire {
case 0:
dAtA = encodeVarintPopulateEnumdecl(dAtA, uint64(key))
v2 := r.Int63()
if r.Intn(2) == 0 {
v2 *= -1
}
dAtA = encodeVarintPopulateEnumdecl(dAtA, uint64(v2))
case 1:
dAtA = encodeVarintPopulateEnumdecl(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 = encodeVarintPopulateEnumdecl(dAtA, uint64(key))
ll := r.Intn(100)
dAtA = encodeVarintPopulateEnumdecl(dAtA, uint64(ll))
for j := 0; j < ll; j++ {
dAtA = append(dAtA, byte(r.Intn(256)))
}
default:
dAtA = encodeVarintPopulateEnumdecl(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 encodeVarintPopulateEnumdecl(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 *Message) Size() (n int) {
var l int
_ = l
if m.EnumeratedField != 0 {
n += 1 + sovEnumdecl(uint64(m.EnumeratedField))
}
return n
}
func sovEnumdecl(x uint64) (n int) {
for {
n++
x >>= 7
if x == 0 {
break
}
}
return n
}
func sozEnumdecl(x uint64) (n int) {
return sovEnumdecl(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *Message) 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 ErrIntOverflowEnumdecl
}
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: Message: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Message: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 0 {
return fmt.Errorf("proto: wrong wireType = %d for field EnumeratedField", wireType)
}
m.EnumeratedField = 0
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowEnumdecl
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
m.EnumeratedField |= (MyEnum(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
default:
iNdEx = preIndex
skippy, err := skipEnumdecl(dAtA[iNdEx:])
if err != nil {
return err
}
if skippy < 0 {
return ErrInvalidLengthEnumdecl
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipEnumdecl(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, ErrIntOverflowEnumdecl
}
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, ErrIntOverflowEnumdecl
}
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, ErrIntOverflowEnumdecl
}
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, ErrInvalidLengthEnumdecl
}
return iNdEx, nil
case 3:
for {
var innerWire uint64
var start int = iNdEx
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowEnumdecl
}
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 := skipEnumdecl(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 (
ErrInvalidLengthEnumdecl = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowEnumdecl = fmt.Errorf("proto: integer overflow")
)
func init() { proto.RegisterFile("enumdecl.proto", fileDescriptorEnumdecl) }
var fileDescriptorEnumdecl = []byte{
// 205 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x4b, 0xcd, 0x2b, 0xcd,
0x4d, 0x49, 0x4d, 0xce, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x80, 0xf1, 0xa5, 0x74,
0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xd3, 0xf3, 0xd3, 0xf3, 0xf5,
0xc1, 0x0a, 0x92, 0x4a, 0xd3, 0xc0, 0x3c, 0x30, 0x07, 0xcc, 0x82, 0x68, 0x54, 0x72, 0xe3, 0x62,
0xf7, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0x15, 0xb2, 0xe6, 0x12, 0x00, 0x99, 0x92, 0x5a, 0x94,
0x58, 0x92, 0x9a, 0x12, 0x9f, 0x96, 0x99, 0x9a, 0x93, 0x22, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x67,
0x24, 0xa0, 0x07, 0xb7, 0xce, 0xb7, 0xd2, 0x35, 0xaf, 0x34, 0x37, 0x88, 0x1f, 0xa1, 0xd2, 0x0d,
0xa4, 0x50, 0x4b, 0x81, 0x8b, 0x0d, 0x22, 0x25, 0xc4, 0xca, 0xc5, 0xe8, 0x28, 0xc0, 0x00, 0xa2,
0x9c, 0x04, 0x18, 0xa5, 0x38, 0x3a, 0x16, 0xcb, 0x31, 0x1c, 0x58, 0x22, 0xc7, 0xe0, 0xa4, 0xf1,
0xe0, 0xa1, 0x1c, 0xe3, 0x8f, 0x87, 0x72, 0x8c, 0x2b, 0x1e, 0xc9, 0x31, 0xee, 0x78, 0x24, 0xc7,
0x78, 0xe0, 0x91, 0x1c, 0xe3, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24,
0xc7, 0xf8, 0xe3, 0x91, 0x1c, 0x43, 0xc3, 0x63, 0x39, 0x86, 0x24, 0x36, 0xb0, 0xd3, 0x8c, 0x01,
0x01, 0x00, 0x00, 0xff, 0xff, 0x76, 0x04, 0x55, 0xb7, 0xe5, 0x00, 0x00, 0x00,
}

View File

@ -1,27 +0,0 @@
syntax = "proto3";
package enumdecl;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
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.equal_all) = true;
option (gogoproto.verbose_equal_all) = true;
option (gogoproto.unsafe_marshaler_all) = false;
option (gogoproto.unsafe_unmarshaler_all) = false;
enum MyEnum {
option (gogoproto.enumdecl) = false;
option (gogoproto.goproto_enum_prefix) = false;
A = 0;
B = 1;
}
message Message {
MyEnum enumerated_field = 1;
}

Some files were not shown because too many files have changed in this diff Show More