vendor: Update github.com/gogo/protobuf
Also tweaks the proto definitions: - [packed=false] on the block_indexes field to retain compat with v0.14.16 and earlier. - Uses the vendored protobuf package in include paths. And, "build.go setup" will install the vendored protoc-gen-gogofast. This should ensure that a proto rebuild isn't so dependent on whatever version of the compiler and package the developer has installed... GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3864
This commit is contained in:
committed by
Audrius Butkevicius
parent
4fb9c143ac
commit
987718baf8
30
vendor/github.com/gogo/protobuf/test/enumstringer/Makefile
generated
vendored
Normal file
30
vendor/github.com/gogo/protobuf/test/enumstringer/Makefile
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
# Protocol Buffers for Go with Gadgets
|
||||
#
|
||||
# Copyright (c) 2013, The GoGo Authors. All rights reserved.
|
||||
# http://github.com/gogo/protobuf
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following disclaimer
|
||||
# in the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
regenerate:
|
||||
(protoc --proto_path=../../../../../:../../protobuf/:. --gogo_out=. enumstringer.proto)
|
||||
70
vendor/github.com/gogo/protobuf/test/enumstringer/enumstringer.pb.go
generated
vendored
70
vendor/github.com/gogo/protobuf/test/enumstringer/enumstringer.pb.go
generated
vendored
@@ -30,7 +30,9 @@ 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.
|
||||
const _ = proto.GoGoProtoPackageIsVersion1
|
||||
// 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 TheTestEnum int32
|
||||
|
||||
@@ -70,7 +72,7 @@ func (x *TheTestEnum) UnmarshalJSON(data []byte) error {
|
||||
func (TheTestEnum) EnumDescriptor() ([]byte, []int) { return fileDescriptorEnumstringer, []int{0} }
|
||||
|
||||
type NidOptEnum struct {
|
||||
Field1 TheTestEnum `protobuf:"varint,1,opt,name=Field1,json=field1,enum=enumstringer.TheTestEnum" json:"Field1"`
|
||||
Field1 TheTestEnum `protobuf:"varint,1,opt,name=Field1,enum=enumstringer.TheTestEnum" json:"Field1"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
@@ -87,7 +89,7 @@ func (m *NidOptEnum) GetField1() TheTestEnum {
|
||||
}
|
||||
|
||||
type NinOptEnum struct {
|
||||
Field1 *TheTestEnum `protobuf:"varint,1,opt,name=Field1,json=field1,enum=enumstringer.TheTestEnum" json:"Field1,omitempty"`
|
||||
Field1 *TheTestEnum `protobuf:"varint,1,opt,name=Field1,enum=enumstringer.TheTestEnum" json:"Field1,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
@@ -104,7 +106,7 @@ func (m *NinOptEnum) GetField1() TheTestEnum {
|
||||
}
|
||||
|
||||
type NidRepEnum struct {
|
||||
Field1 []TheTestEnum `protobuf:"varint,1,rep,name=Field1,json=field1,enum=enumstringer.TheTestEnum" json:"Field1,omitempty"`
|
||||
Field1 []TheTestEnum `protobuf:"varint,1,rep,name=Field1,enum=enumstringer.TheTestEnum" json:"Field1,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
@@ -121,7 +123,7 @@ func (m *NidRepEnum) GetField1() []TheTestEnum {
|
||||
}
|
||||
|
||||
type NinRepEnum struct {
|
||||
Field1 []TheTestEnum `protobuf:"varint,1,rep,name=Field1,json=field1,enum=enumstringer.TheTestEnum" json:"Field1,omitempty"`
|
||||
Field1 []TheTestEnum `protobuf:"varint,1,rep,name=Field1,enum=enumstringer.TheTestEnum" json:"Field1,omitempty"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
}
|
||||
|
||||
@@ -517,7 +519,7 @@ func randStringEnumstringer(r randyEnumstringer) string {
|
||||
}
|
||||
return string(tmps)
|
||||
}
|
||||
func randUnrecognizedEnumstringer(r randyEnumstringer, maxFieldNumber int) (data []byte) {
|
||||
func randUnrecognizedEnumstringer(r randyEnumstringer, maxFieldNumber int) (dAtA []byte) {
|
||||
l := r.Intn(5)
|
||||
for i := 0; i < l; i++ {
|
||||
wire := r.Intn(4)
|
||||
@@ -525,58 +527,60 @@ func randUnrecognizedEnumstringer(r randyEnumstringer, maxFieldNumber int) (data
|
||||
wire = 5
|
||||
}
|
||||
fieldNumber := maxFieldNumber + r.Intn(100)
|
||||
data = randFieldEnumstringer(data, r, fieldNumber, wire)
|
||||
dAtA = randFieldEnumstringer(dAtA, r, fieldNumber, wire)
|
||||
}
|
||||
return data
|
||||
return dAtA
|
||||
}
|
||||
func randFieldEnumstringer(data []byte, r randyEnumstringer, fieldNumber int, wire int) []byte {
|
||||
func randFieldEnumstringer(dAtA []byte, r randyEnumstringer, fieldNumber int, wire int) []byte {
|
||||
key := uint32(fieldNumber)<<3 | uint32(wire)
|
||||
switch wire {
|
||||
case 0:
|
||||
data = encodeVarintPopulateEnumstringer(data, uint64(key))
|
||||
dAtA = encodeVarintPopulateEnumstringer(dAtA, uint64(key))
|
||||
v5 := r.Int63()
|
||||
if r.Intn(2) == 0 {
|
||||
v5 *= -1
|
||||
}
|
||||
data = encodeVarintPopulateEnumstringer(data, uint64(v5))
|
||||
dAtA = encodeVarintPopulateEnumstringer(dAtA, uint64(v5))
|
||||
case 1:
|
||||
data = encodeVarintPopulateEnumstringer(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)))
|
||||
dAtA = encodeVarintPopulateEnumstringer(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 = encodeVarintPopulateEnumstringer(data, uint64(key))
|
||||
dAtA = encodeVarintPopulateEnumstringer(dAtA, uint64(key))
|
||||
ll := r.Intn(100)
|
||||
data = encodeVarintPopulateEnumstringer(data, uint64(ll))
|
||||
dAtA = encodeVarintPopulateEnumstringer(dAtA, uint64(ll))
|
||||
for j := 0; j < ll; j++ {
|
||||
data = append(data, byte(r.Intn(256)))
|
||||
dAtA = append(dAtA, byte(r.Intn(256)))
|
||||
}
|
||||
default:
|
||||
data = encodeVarintPopulateEnumstringer(data, uint64(key))
|
||||
data = append(data, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
|
||||
dAtA = encodeVarintPopulateEnumstringer(dAtA, uint64(key))
|
||||
dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
|
||||
}
|
||||
return data
|
||||
return dAtA
|
||||
}
|
||||
func encodeVarintPopulateEnumstringer(data []byte, v uint64) []byte {
|
||||
func encodeVarintPopulateEnumstringer(dAtA []byte, v uint64) []byte {
|
||||
for v >= 1<<7 {
|
||||
data = append(data, uint8(uint64(v)&0x7f|0x80))
|
||||
dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80))
|
||||
v >>= 7
|
||||
}
|
||||
data = append(data, uint8(v))
|
||||
return data
|
||||
dAtA = append(dAtA, uint8(v))
|
||||
return dAtA
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("enumstringer.proto", fileDescriptorEnumstringer) }
|
||||
|
||||
var fileDescriptorEnumstringer = []byte{
|
||||
// 206 bytes of a gzipped FileDescriptorProto
|
||||
// 208 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xe2, 0x12, 0x4a, 0xcd, 0x2b, 0xcd,
|
||||
0x2d, 0x2e, 0x29, 0xca, 0xcc, 0x4b, 0x4f, 0x2d, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2,
|
||||
0x41, 0x16, 0x93, 0xd2, 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f,
|
||||
0xcf, 0x4f, 0xcf, 0xd7, 0x07, 0x2b, 0x4a, 0x2a, 0x4d, 0x03, 0xf3, 0xc0, 0x1c, 0x30, 0x0b, 0xa2,
|
||||
0x59, 0xc9, 0x95, 0x8b, 0xcb, 0x2f, 0x33, 0xc5, 0xbf, 0xa0, 0xc4, 0x15, 0x68, 0x88, 0x90, 0x39,
|
||||
0x17, 0x9b, 0x5b, 0x66, 0x6a, 0x4e, 0x8a, 0xa1, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x9f, 0x91, 0xa4,
|
||||
0x1e, 0x8a, 0x7d, 0x21, 0x19, 0xa9, 0x21, 0xa9, 0xc5, 0x60, 0xa5, 0x4e, 0x2c, 0x27, 0xee, 0xc9,
|
||||
0x33, 0x04, 0xb1, 0xa5, 0x81, 0x95, 0x2b, 0xd9, 0x83, 0x8c, 0xc9, 0x83, 0x19, 0x63, 0x48, 0xb4,
|
||||
0x31, 0x70, 0x03, 0x20, 0xee, 0x08, 0x4a, 0x2d, 0xc0, 0x70, 0x07, 0x33, 0xe9, 0xee, 0x80, 0x19,
|
||||
0x63, 0x48, 0xb4, 0x31, 0x30, 0x03, 0xb4, 0x94, 0xb8, 0xb8, 0x91, 0x84, 0x85, 0x58, 0xb9, 0x18,
|
||||
0x1d, 0x05, 0x18, 0x40, 0x94, 0x93, 0x00, 0x23, 0x88, 0x72, 0x16, 0x60, 0x72, 0x12, 0x79, 0xf0,
|
||||
0x50, 0x8e, 0xf1, 0x07, 0x10, 0xaf, 0x78, 0x24, 0xc7, 0xb8, 0x03, 0x88, 0x5f, 0x3c, 0x92, 0x63,
|
||||
0x00, 0x04, 0x00, 0x00, 0xff, 0xff, 0x1d, 0xb1, 0xac, 0x38, 0x9b, 0x01, 0x00, 0x00,
|
||||
0x59, 0xc9, 0x95, 0x8b, 0xcb, 0x2f, 0x33, 0xc5, 0xbf, 0xa0, 0xc4, 0x35, 0xaf, 0x34, 0x57, 0xc8,
|
||||
0x9c, 0x8b, 0xcd, 0x2d, 0x33, 0x35, 0x27, 0xc5, 0x50, 0x82, 0x51, 0x81, 0x51, 0x83, 0xcf, 0x48,
|
||||
0x52, 0x0f, 0xc5, 0xbe, 0x90, 0x8c, 0xd4, 0x90, 0xd4, 0x62, 0xb0, 0x52, 0x27, 0x96, 0x13, 0xf7,
|
||||
0xe4, 0x19, 0x82, 0xa0, 0xca, 0x95, 0xec, 0x41, 0xc6, 0xe4, 0xc1, 0x8c, 0x31, 0x24, 0xda, 0x18,
|
||||
0xb8, 0x01, 0x10, 0x77, 0x04, 0xa5, 0x16, 0x60, 0xb8, 0x83, 0x99, 0x74, 0x77, 0xc0, 0x8c, 0x31,
|
||||
0x24, 0xda, 0x18, 0x98, 0x01, 0x5a, 0x4a, 0x5c, 0xdc, 0x48, 0xc2, 0x42, 0xac, 0x5c, 0x8c, 0x8e,
|
||||
0x02, 0x0c, 0x20, 0xca, 0x49, 0x80, 0x11, 0x44, 0x39, 0x0b, 0x30, 0x39, 0x89, 0x3c, 0x78, 0x28,
|
||||
0xc7, 0xf8, 0xe3, 0xa1, 0x1c, 0xe3, 0x8a, 0x47, 0x72, 0x8c, 0x3b, 0x1e, 0xc9, 0x31, 0xbe, 0x78,
|
||||
0x24, 0xc7, 0x00, 0x08, 0x00, 0x00, 0xff, 0xff, 0x2c, 0xb2, 0x8f, 0xc2, 0x9b, 0x01, 0x00, 0x00,
|
||||
}
|
||||
|
||||
62
vendor/github.com/gogo/protobuf/test/enumstringer/enumstringer.proto
generated
vendored
Normal file
62
vendor/github.com/gogo/protobuf/test/enumstringer/enumstringer.proto
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
// 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 enumstringer;
|
||||
|
||||
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
|
||||
|
||||
option (gogoproto.goproto_enum_stringer_all) = false;
|
||||
|
||||
option (gogoproto.equal_all) = true;
|
||||
option (gogoproto.verbose_equal_all) = true;
|
||||
|
||||
option (gogoproto.testgen_all) = true;
|
||||
option (gogoproto.populate_all) = true;
|
||||
|
||||
enum TheTestEnum {
|
||||
A = 0;
|
||||
B = 1;
|
||||
C = 2;
|
||||
}
|
||||
|
||||
message NidOptEnum {
|
||||
optional TheTestEnum Field1 = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinOptEnum {
|
||||
optional TheTestEnum Field1 = 1;
|
||||
}
|
||||
|
||||
message NidRepEnum {
|
||||
repeated TheTestEnum Field1 = 1 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
message NinRepEnum {
|
||||
repeated TheTestEnum Field1 = 1;
|
||||
}
|
||||
451
vendor/github.com/gogo/protobuf/test/enumstringer/enumstringerpb_test.go
generated
vendored
Normal file
451
vendor/github.com/gogo/protobuf/test/enumstringer/enumstringerpb_test.go
generated
vendored
Normal file
@@ -0,0 +1,451 @@
|
||||
// Code generated by protoc-gen-gogo.
|
||||
// source: enumstringer.proto
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package enumstringer is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
enumstringer.proto
|
||||
|
||||
It has these top-level messages:
|
||||
NidOptEnum
|
||||
NinOptEnum
|
||||
NidRepEnum
|
||||
NinRepEnum
|
||||
*/
|
||||
package enumstringer
|
||||
|
||||
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 TestNidOptEnumProto(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedNidOptEnum(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &NidOptEnum{}
|
||||
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 TestNinOptEnumProto(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedNinOptEnum(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &NinOptEnum{}
|
||||
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 TestNidRepEnumProto(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedNidRepEnum(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &NidRepEnum{}
|
||||
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 TestNinRepEnumProto(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedNinRepEnum(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
t.Fatalf("seed = %d, err = %v", seed, err)
|
||||
}
|
||||
msg := &NinRepEnum{}
|
||||
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 TestNidOptEnumJSON(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedNidOptEnum(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 := &NidOptEnum{}
|
||||
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 TestNinOptEnumJSON(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedNinOptEnum(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 := &NinOptEnum{}
|
||||
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 TestNidRepEnumJSON(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedNidRepEnum(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 := &NidRepEnum{}
|
||||
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 TestNinRepEnumJSON(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedNinRepEnum(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 := &NinRepEnum{}
|
||||
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 TestNidOptEnumProtoText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedNidOptEnum(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
||||
msg := &NidOptEnum{}
|
||||
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 TestNidOptEnumProtoCompactText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedNidOptEnum(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
||||
msg := &NidOptEnum{}
|
||||
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 TestNinOptEnumProtoText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedNinOptEnum(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
||||
msg := &NinOptEnum{}
|
||||
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 TestNinOptEnumProtoCompactText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedNinOptEnum(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
||||
msg := &NinOptEnum{}
|
||||
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 TestNidRepEnumProtoText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedNidRepEnum(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
||||
msg := &NidRepEnum{}
|
||||
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 TestNidRepEnumProtoCompactText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedNidRepEnum(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
||||
msg := &NidRepEnum{}
|
||||
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 TestNinRepEnumProtoText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedNinRepEnum(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
|
||||
msg := &NinRepEnum{}
|
||||
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 TestNinRepEnumProtoCompactText(t *testing.T) {
|
||||
seed := time.Now().UnixNano()
|
||||
popr := math_rand.New(math_rand.NewSource(seed))
|
||||
p := NewPopulatedNinRepEnum(popr, true)
|
||||
dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
|
||||
msg := &NinRepEnum{}
|
||||
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 TestNidOptEnumVerboseEqual(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedNidOptEnum(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
msg := &NidOptEnum{}
|
||||
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 TestNinOptEnumVerboseEqual(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedNinOptEnum(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
msg := &NinOptEnum{}
|
||||
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 TestNidRepEnumVerboseEqual(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedNidRepEnum(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
msg := &NidRepEnum{}
|
||||
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 TestNinRepEnumVerboseEqual(t *testing.T) {
|
||||
popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
|
||||
p := NewPopulatedNinRepEnum(popr, false)
|
||||
dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
msg := &NinRepEnum{}
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
//These tests are generated by github.com/gogo/protobuf/plugin/testgen
|
||||
6
vendor/github.com/gogo/protobuf/test/enumstringer/string.go
generated
vendored
6
vendor/github.com/gogo/protobuf/test/enumstringer/string.go
generated
vendored
@@ -1,5 +1,7 @@
|
||||
// Copyright (c) 2013, Vastech SA (PTY) LTD. All rights reserved.
|
||||
// http://github.com/gogo/protobuf/gogoproto
|
||||
// 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
|
||||
|
||||
Reference in New Issue
Block a user