...

Source file src/github.com/gogo/protobuf/test/enumstringer/enumstringer.pb.go

Documentation: github.com/gogo/protobuf/test/enumstringer

     1  // Code generated by protoc-gen-gogo. DO NOT EDIT.
     2  // source: enumstringer.proto
     3  
     4  package enumstringer
     5  
     6  import (
     7  	bytes "bytes"
     8  	fmt "fmt"
     9  	_ "github.com/gogo/protobuf/gogoproto"
    10  	proto "github.com/gogo/protobuf/proto"
    11  	math "math"
    12  )
    13  
    14  // Reference imports to suppress errors if they are not otherwise used.
    15  var _ = proto.Marshal
    16  var _ = fmt.Errorf
    17  var _ = math.Inf
    18  
    19  // This is a compile-time assertion to ensure that this generated file
    20  // is compatible with the proto package it is being compiled against.
    21  // A compilation error at this line likely means your copy of the
    22  // proto package needs to be updated.
    23  const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package
    24  
    25  type TheTestEnum int32
    26  
    27  const (
    28  	TheTestEnum_A TheTestEnum = 0
    29  	TheTestEnum_B TheTestEnum = 1
    30  	TheTestEnum_C TheTestEnum = 2
    31  )
    32  
    33  var TheTestEnum_name = map[int32]string{
    34  	0: "A",
    35  	1: "B",
    36  	2: "C",
    37  }
    38  
    39  var TheTestEnum_value = map[string]int32{
    40  	"A": 0,
    41  	"B": 1,
    42  	"C": 2,
    43  }
    44  
    45  func (x TheTestEnum) Enum() *TheTestEnum {
    46  	p := new(TheTestEnum)
    47  	*p = x
    48  	return p
    49  }
    50  
    51  func (x TheTestEnum) MarshalJSON() ([]byte, error) {
    52  	return proto.MarshalJSONEnum(TheTestEnum_name, int32(x))
    53  }
    54  
    55  func (x *TheTestEnum) UnmarshalJSON(data []byte) error {
    56  	value, err := proto.UnmarshalJSONEnum(TheTestEnum_value, data, "TheTestEnum")
    57  	if err != nil {
    58  		return err
    59  	}
    60  	*x = TheTestEnum(value)
    61  	return nil
    62  }
    63  
    64  func (TheTestEnum) EnumDescriptor() ([]byte, []int) {
    65  	return fileDescriptor_59d933db60b09d07, []int{0}
    66  }
    67  
    68  type NidOptEnum struct {
    69  	Field1               TheTestEnum `protobuf:"varint,1,opt,name=Field1,enum=enumstringer.TheTestEnum" json:"Field1"`
    70  	XXX_NoUnkeyedLiteral struct{}    `json:"-"`
    71  	XXX_unrecognized     []byte      `json:"-"`
    72  	XXX_sizecache        int32       `json:"-"`
    73  }
    74  
    75  func (m *NidOptEnum) Reset()         { *m = NidOptEnum{} }
    76  func (m *NidOptEnum) String() string { return proto.CompactTextString(m) }
    77  func (*NidOptEnum) ProtoMessage()    {}
    78  func (*NidOptEnum) Descriptor() ([]byte, []int) {
    79  	return fileDescriptor_59d933db60b09d07, []int{0}
    80  }
    81  func (m *NidOptEnum) XXX_Unmarshal(b []byte) error {
    82  	return xxx_messageInfo_NidOptEnum.Unmarshal(m, b)
    83  }
    84  func (m *NidOptEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
    85  	return xxx_messageInfo_NidOptEnum.Marshal(b, m, deterministic)
    86  }
    87  func (m *NidOptEnum) XXX_Merge(src proto.Message) {
    88  	xxx_messageInfo_NidOptEnum.Merge(m, src)
    89  }
    90  func (m *NidOptEnum) XXX_Size() int {
    91  	return xxx_messageInfo_NidOptEnum.Size(m)
    92  }
    93  func (m *NidOptEnum) XXX_DiscardUnknown() {
    94  	xxx_messageInfo_NidOptEnum.DiscardUnknown(m)
    95  }
    96  
    97  var xxx_messageInfo_NidOptEnum proto.InternalMessageInfo
    98  
    99  func (m *NidOptEnum) GetField1() TheTestEnum {
   100  	if m != nil {
   101  		return m.Field1
   102  	}
   103  	return TheTestEnum_A
   104  }
   105  
   106  type NinOptEnum struct {
   107  	Field1               *TheTestEnum `protobuf:"varint,1,opt,name=Field1,enum=enumstringer.TheTestEnum" json:"Field1,omitempty"`
   108  	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
   109  	XXX_unrecognized     []byte       `json:"-"`
   110  	XXX_sizecache        int32        `json:"-"`
   111  }
   112  
   113  func (m *NinOptEnum) Reset()         { *m = NinOptEnum{} }
   114  func (m *NinOptEnum) String() string { return proto.CompactTextString(m) }
   115  func (*NinOptEnum) ProtoMessage()    {}
   116  func (*NinOptEnum) Descriptor() ([]byte, []int) {
   117  	return fileDescriptor_59d933db60b09d07, []int{1}
   118  }
   119  func (m *NinOptEnum) XXX_Unmarshal(b []byte) error {
   120  	return xxx_messageInfo_NinOptEnum.Unmarshal(m, b)
   121  }
   122  func (m *NinOptEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
   123  	return xxx_messageInfo_NinOptEnum.Marshal(b, m, deterministic)
   124  }
   125  func (m *NinOptEnum) XXX_Merge(src proto.Message) {
   126  	xxx_messageInfo_NinOptEnum.Merge(m, src)
   127  }
   128  func (m *NinOptEnum) XXX_Size() int {
   129  	return xxx_messageInfo_NinOptEnum.Size(m)
   130  }
   131  func (m *NinOptEnum) XXX_DiscardUnknown() {
   132  	xxx_messageInfo_NinOptEnum.DiscardUnknown(m)
   133  }
   134  
   135  var xxx_messageInfo_NinOptEnum proto.InternalMessageInfo
   136  
   137  func (m *NinOptEnum) GetField1() TheTestEnum {
   138  	if m != nil && m.Field1 != nil {
   139  		return *m.Field1
   140  	}
   141  	return TheTestEnum_A
   142  }
   143  
   144  type NidRepEnum struct {
   145  	Field1               []TheTestEnum `protobuf:"varint,1,rep,name=Field1,enum=enumstringer.TheTestEnum" json:"Field1,omitempty"`
   146  	XXX_NoUnkeyedLiteral struct{}      `json:"-"`
   147  	XXX_unrecognized     []byte        `json:"-"`
   148  	XXX_sizecache        int32         `json:"-"`
   149  }
   150  
   151  func (m *NidRepEnum) Reset()         { *m = NidRepEnum{} }
   152  func (m *NidRepEnum) String() string { return proto.CompactTextString(m) }
   153  func (*NidRepEnum) ProtoMessage()    {}
   154  func (*NidRepEnum) Descriptor() ([]byte, []int) {
   155  	return fileDescriptor_59d933db60b09d07, []int{2}
   156  }
   157  func (m *NidRepEnum) XXX_Unmarshal(b []byte) error {
   158  	return xxx_messageInfo_NidRepEnum.Unmarshal(m, b)
   159  }
   160  func (m *NidRepEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
   161  	return xxx_messageInfo_NidRepEnum.Marshal(b, m, deterministic)
   162  }
   163  func (m *NidRepEnum) XXX_Merge(src proto.Message) {
   164  	xxx_messageInfo_NidRepEnum.Merge(m, src)
   165  }
   166  func (m *NidRepEnum) XXX_Size() int {
   167  	return xxx_messageInfo_NidRepEnum.Size(m)
   168  }
   169  func (m *NidRepEnum) XXX_DiscardUnknown() {
   170  	xxx_messageInfo_NidRepEnum.DiscardUnknown(m)
   171  }
   172  
   173  var xxx_messageInfo_NidRepEnum proto.InternalMessageInfo
   174  
   175  func (m *NidRepEnum) GetField1() []TheTestEnum {
   176  	if m != nil {
   177  		return m.Field1
   178  	}
   179  	return nil
   180  }
   181  
   182  type NinRepEnum struct {
   183  	Field1               []TheTestEnum `protobuf:"varint,1,rep,name=Field1,enum=enumstringer.TheTestEnum" json:"Field1,omitempty"`
   184  	XXX_NoUnkeyedLiteral struct{}      `json:"-"`
   185  	XXX_unrecognized     []byte        `json:"-"`
   186  	XXX_sizecache        int32         `json:"-"`
   187  }
   188  
   189  func (m *NinRepEnum) Reset()         { *m = NinRepEnum{} }
   190  func (m *NinRepEnum) String() string { return proto.CompactTextString(m) }
   191  func (*NinRepEnum) ProtoMessage()    {}
   192  func (*NinRepEnum) Descriptor() ([]byte, []int) {
   193  	return fileDescriptor_59d933db60b09d07, []int{3}
   194  }
   195  func (m *NinRepEnum) XXX_Unmarshal(b []byte) error {
   196  	return xxx_messageInfo_NinRepEnum.Unmarshal(m, b)
   197  }
   198  func (m *NinRepEnum) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
   199  	return xxx_messageInfo_NinRepEnum.Marshal(b, m, deterministic)
   200  }
   201  func (m *NinRepEnum) XXX_Merge(src proto.Message) {
   202  	xxx_messageInfo_NinRepEnum.Merge(m, src)
   203  }
   204  func (m *NinRepEnum) XXX_Size() int {
   205  	return xxx_messageInfo_NinRepEnum.Size(m)
   206  }
   207  func (m *NinRepEnum) XXX_DiscardUnknown() {
   208  	xxx_messageInfo_NinRepEnum.DiscardUnknown(m)
   209  }
   210  
   211  var xxx_messageInfo_NinRepEnum proto.InternalMessageInfo
   212  
   213  func (m *NinRepEnum) GetField1() []TheTestEnum {
   214  	if m != nil {
   215  		return m.Field1
   216  	}
   217  	return nil
   218  }
   219  
   220  func init() {
   221  	proto.RegisterEnum("enumstringer.TheTestEnum", TheTestEnum_name, TheTestEnum_value)
   222  	proto.RegisterType((*NidOptEnum)(nil), "enumstringer.NidOptEnum")
   223  	proto.RegisterType((*NinOptEnum)(nil), "enumstringer.NinOptEnum")
   224  	proto.RegisterType((*NidRepEnum)(nil), "enumstringer.NidRepEnum")
   225  	proto.RegisterType((*NinRepEnum)(nil), "enumstringer.NinRepEnum")
   226  }
   227  
   228  func init() { proto.RegisterFile("enumstringer.proto", fileDescriptor_59d933db60b09d07) }
   229  
   230  var fileDescriptor_59d933db60b09d07 = []byte{
   231  	// 208 bytes of a gzipped FileDescriptorProto
   232  	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4a, 0xcd, 0x2b, 0xcd,
   233  	0x2d, 0x2e, 0x29, 0xca, 0xcc, 0x4b, 0x4f, 0x2d, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2,
   234  	0x41, 0x16, 0x93, 0xd2, 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f,
   235  	0xcf, 0x4f, 0xcf, 0xd7, 0x07, 0x2b, 0x4a, 0x2a, 0x4d, 0x03, 0xf3, 0xc0, 0x1c, 0x30, 0x0b, 0xa2,
   236  	0x59, 0xc9, 0x95, 0x8b, 0xcb, 0x2f, 0x33, 0xc5, 0xbf, 0xa0, 0xc4, 0x35, 0xaf, 0x34, 0x57, 0xc8,
   237  	0x9c, 0x8b, 0xcd, 0x2d, 0x33, 0x35, 0x27, 0xc5, 0x50, 0x82, 0x51, 0x81, 0x51, 0x83, 0xcf, 0x48,
   238  	0x52, 0x0f, 0xc5, 0xbe, 0x90, 0x8c, 0xd4, 0x90, 0xd4, 0x62, 0xb0, 0x52, 0x27, 0x96, 0x13, 0xf7,
   239  	0xe4, 0x19, 0x82, 0xa0, 0xca, 0x95, 0xec, 0x41, 0xc6, 0xe4, 0xc1, 0x8c, 0x31, 0x24, 0xda, 0x18,
   240  	0xb8, 0x01, 0x10, 0x77, 0x04, 0xa5, 0x16, 0x60, 0xb8, 0x83, 0x99, 0x74, 0x77, 0xc0, 0x8c, 0x31,
   241  	0x24, 0xda, 0x18, 0x98, 0x01, 0x5a, 0x4a, 0x5c, 0xdc, 0x48, 0xc2, 0x42, 0xac, 0x5c, 0x8c, 0x8e,
   242  	0x02, 0x0c, 0x20, 0xca, 0x49, 0x80, 0x11, 0x44, 0x39, 0x0b, 0x30, 0x39, 0x89, 0x3c, 0x78, 0x28,
   243  	0xc7, 0xf8, 0xe3, 0xa1, 0x1c, 0xe3, 0x8a, 0x47, 0x72, 0x8c, 0x3b, 0x1e, 0xc9, 0x31, 0xbe, 0x78,
   244  	0x24, 0xc7, 0x00, 0x08, 0x00, 0x00, 0xff, 0xff, 0x2c, 0xb2, 0x8f, 0xc2, 0x9b, 0x01, 0x00, 0x00,
   245  }
   246  
   247  func (this *NidOptEnum) VerboseEqual(that interface{}) error {
   248  	if that == nil {
   249  		if this == nil {
   250  			return nil
   251  		}
   252  		return fmt.Errorf("that == nil && this != nil")
   253  	}
   254  
   255  	that1, ok := that.(*NidOptEnum)
   256  	if !ok {
   257  		that2, ok := that.(NidOptEnum)
   258  		if ok {
   259  			that1 = &that2
   260  		} else {
   261  			return fmt.Errorf("that is not of type *NidOptEnum")
   262  		}
   263  	}
   264  	if that1 == nil {
   265  		if this == nil {
   266  			return nil
   267  		}
   268  		return fmt.Errorf("that is type *NidOptEnum but is nil && this != nil")
   269  	} else if this == nil {
   270  		return fmt.Errorf("that is type *NidOptEnum but is not nil && this == nil")
   271  	}
   272  	if this.Field1 != that1.Field1 {
   273  		return fmt.Errorf("Field1 this(%v) Not Equal that(%v)", this.Field1, that1.Field1)
   274  	}
   275  	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
   276  		return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
   277  	}
   278  	return nil
   279  }
   280  func (this *NidOptEnum) Equal(that interface{}) bool {
   281  	if that == nil {
   282  		return this == nil
   283  	}
   284  
   285  	that1, ok := that.(*NidOptEnum)
   286  	if !ok {
   287  		that2, ok := that.(NidOptEnum)
   288  		if ok {
   289  			that1 = &that2
   290  		} else {
   291  			return false
   292  		}
   293  	}
   294  	if that1 == nil {
   295  		return this == nil
   296  	} else if this == nil {
   297  		return false
   298  	}
   299  	if this.Field1 != that1.Field1 {
   300  		return false
   301  	}
   302  	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
   303  		return false
   304  	}
   305  	return true
   306  }
   307  func (this *NinOptEnum) VerboseEqual(that interface{}) error {
   308  	if that == nil {
   309  		if this == nil {
   310  			return nil
   311  		}
   312  		return fmt.Errorf("that == nil && this != nil")
   313  	}
   314  
   315  	that1, ok := that.(*NinOptEnum)
   316  	if !ok {
   317  		that2, ok := that.(NinOptEnum)
   318  		if ok {
   319  			that1 = &that2
   320  		} else {
   321  			return fmt.Errorf("that is not of type *NinOptEnum")
   322  		}
   323  	}
   324  	if that1 == nil {
   325  		if this == nil {
   326  			return nil
   327  		}
   328  		return fmt.Errorf("that is type *NinOptEnum but is nil && this != nil")
   329  	} else if this == nil {
   330  		return fmt.Errorf("that is type *NinOptEnum but is not nil && this == nil")
   331  	}
   332  	if this.Field1 != nil && that1.Field1 != nil {
   333  		if *this.Field1 != *that1.Field1 {
   334  			return fmt.Errorf("Field1 this(%v) Not Equal that(%v)", *this.Field1, *that1.Field1)
   335  		}
   336  	} else if this.Field1 != nil {
   337  		return fmt.Errorf("this.Field1 == nil && that.Field1 != nil")
   338  	} else if that1.Field1 != nil {
   339  		return fmt.Errorf("Field1 this(%v) Not Equal that(%v)", this.Field1, that1.Field1)
   340  	}
   341  	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
   342  		return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
   343  	}
   344  	return nil
   345  }
   346  func (this *NinOptEnum) Equal(that interface{}) bool {
   347  	if that == nil {
   348  		return this == nil
   349  	}
   350  
   351  	that1, ok := that.(*NinOptEnum)
   352  	if !ok {
   353  		that2, ok := that.(NinOptEnum)
   354  		if ok {
   355  			that1 = &that2
   356  		} else {
   357  			return false
   358  		}
   359  	}
   360  	if that1 == nil {
   361  		return this == nil
   362  	} else if this == nil {
   363  		return false
   364  	}
   365  	if this.Field1 != nil && that1.Field1 != nil {
   366  		if *this.Field1 != *that1.Field1 {
   367  			return false
   368  		}
   369  	} else if this.Field1 != nil {
   370  		return false
   371  	} else if that1.Field1 != nil {
   372  		return false
   373  	}
   374  	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
   375  		return false
   376  	}
   377  	return true
   378  }
   379  func (this *NidRepEnum) VerboseEqual(that interface{}) error {
   380  	if that == nil {
   381  		if this == nil {
   382  			return nil
   383  		}
   384  		return fmt.Errorf("that == nil && this != nil")
   385  	}
   386  
   387  	that1, ok := that.(*NidRepEnum)
   388  	if !ok {
   389  		that2, ok := that.(NidRepEnum)
   390  		if ok {
   391  			that1 = &that2
   392  		} else {
   393  			return fmt.Errorf("that is not of type *NidRepEnum")
   394  		}
   395  	}
   396  	if that1 == nil {
   397  		if this == nil {
   398  			return nil
   399  		}
   400  		return fmt.Errorf("that is type *NidRepEnum but is nil && this != nil")
   401  	} else if this == nil {
   402  		return fmt.Errorf("that is type *NidRepEnum but is not nil && this == nil")
   403  	}
   404  	if len(this.Field1) != len(that1.Field1) {
   405  		return fmt.Errorf("Field1 this(%v) Not Equal that(%v)", len(this.Field1), len(that1.Field1))
   406  	}
   407  	for i := range this.Field1 {
   408  		if this.Field1[i] != that1.Field1[i] {
   409  			return fmt.Errorf("Field1 this[%v](%v) Not Equal that[%v](%v)", i, this.Field1[i], i, that1.Field1[i])
   410  		}
   411  	}
   412  	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
   413  		return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
   414  	}
   415  	return nil
   416  }
   417  func (this *NidRepEnum) Equal(that interface{}) bool {
   418  	if that == nil {
   419  		return this == nil
   420  	}
   421  
   422  	that1, ok := that.(*NidRepEnum)
   423  	if !ok {
   424  		that2, ok := that.(NidRepEnum)
   425  		if ok {
   426  			that1 = &that2
   427  		} else {
   428  			return false
   429  		}
   430  	}
   431  	if that1 == nil {
   432  		return this == nil
   433  	} else if this == nil {
   434  		return false
   435  	}
   436  	if len(this.Field1) != len(that1.Field1) {
   437  		return false
   438  	}
   439  	for i := range this.Field1 {
   440  		if this.Field1[i] != that1.Field1[i] {
   441  			return false
   442  		}
   443  	}
   444  	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
   445  		return false
   446  	}
   447  	return true
   448  }
   449  func (this *NinRepEnum) VerboseEqual(that interface{}) error {
   450  	if that == nil {
   451  		if this == nil {
   452  			return nil
   453  		}
   454  		return fmt.Errorf("that == nil && this != nil")
   455  	}
   456  
   457  	that1, ok := that.(*NinRepEnum)
   458  	if !ok {
   459  		that2, ok := that.(NinRepEnum)
   460  		if ok {
   461  			that1 = &that2
   462  		} else {
   463  			return fmt.Errorf("that is not of type *NinRepEnum")
   464  		}
   465  	}
   466  	if that1 == nil {
   467  		if this == nil {
   468  			return nil
   469  		}
   470  		return fmt.Errorf("that is type *NinRepEnum but is nil && this != nil")
   471  	} else if this == nil {
   472  		return fmt.Errorf("that is type *NinRepEnum but is not nil && this == nil")
   473  	}
   474  	if len(this.Field1) != len(that1.Field1) {
   475  		return fmt.Errorf("Field1 this(%v) Not Equal that(%v)", len(this.Field1), len(that1.Field1))
   476  	}
   477  	for i := range this.Field1 {
   478  		if this.Field1[i] != that1.Field1[i] {
   479  			return fmt.Errorf("Field1 this[%v](%v) Not Equal that[%v](%v)", i, this.Field1[i], i, that1.Field1[i])
   480  		}
   481  	}
   482  	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
   483  		return fmt.Errorf("XXX_unrecognized this(%v) Not Equal that(%v)", this.XXX_unrecognized, that1.XXX_unrecognized)
   484  	}
   485  	return nil
   486  }
   487  func (this *NinRepEnum) Equal(that interface{}) bool {
   488  	if that == nil {
   489  		return this == nil
   490  	}
   491  
   492  	that1, ok := that.(*NinRepEnum)
   493  	if !ok {
   494  		that2, ok := that.(NinRepEnum)
   495  		if ok {
   496  			that1 = &that2
   497  		} else {
   498  			return false
   499  		}
   500  	}
   501  	if that1 == nil {
   502  		return this == nil
   503  	} else if this == nil {
   504  		return false
   505  	}
   506  	if len(this.Field1) != len(that1.Field1) {
   507  		return false
   508  	}
   509  	for i := range this.Field1 {
   510  		if this.Field1[i] != that1.Field1[i] {
   511  			return false
   512  		}
   513  	}
   514  	if !bytes.Equal(this.XXX_unrecognized, that1.XXX_unrecognized) {
   515  		return false
   516  	}
   517  	return true
   518  }
   519  func NewPopulatedNidOptEnum(r randyEnumstringer, easy bool) *NidOptEnum {
   520  	this := &NidOptEnum{}
   521  	this.Field1 = TheTestEnum([]int32{0, 1, 2}[r.Intn(3)])
   522  	if !easy && r.Intn(10) != 0 {
   523  		this.XXX_unrecognized = randUnrecognizedEnumstringer(r, 2)
   524  	}
   525  	return this
   526  }
   527  
   528  func NewPopulatedNinOptEnum(r randyEnumstringer, easy bool) *NinOptEnum {
   529  	this := &NinOptEnum{}
   530  	if r.Intn(5) != 0 {
   531  		v1 := TheTestEnum([]int32{0, 1, 2}[r.Intn(3)])
   532  		this.Field1 = &v1
   533  	}
   534  	if !easy && r.Intn(10) != 0 {
   535  		this.XXX_unrecognized = randUnrecognizedEnumstringer(r, 2)
   536  	}
   537  	return this
   538  }
   539  
   540  func NewPopulatedNidRepEnum(r randyEnumstringer, easy bool) *NidRepEnum {
   541  	this := &NidRepEnum{}
   542  	if r.Intn(5) != 0 {
   543  		v2 := r.Intn(10)
   544  		this.Field1 = make([]TheTestEnum, v2)
   545  		for i := 0; i < v2; i++ {
   546  			this.Field1[i] = TheTestEnum([]int32{0, 1, 2}[r.Intn(3)])
   547  		}
   548  	}
   549  	if !easy && r.Intn(10) != 0 {
   550  		this.XXX_unrecognized = randUnrecognizedEnumstringer(r, 2)
   551  	}
   552  	return this
   553  }
   554  
   555  func NewPopulatedNinRepEnum(r randyEnumstringer, easy bool) *NinRepEnum {
   556  	this := &NinRepEnum{}
   557  	if r.Intn(5) != 0 {
   558  		v3 := r.Intn(10)
   559  		this.Field1 = make([]TheTestEnum, v3)
   560  		for i := 0; i < v3; i++ {
   561  			this.Field1[i] = TheTestEnum([]int32{0, 1, 2}[r.Intn(3)])
   562  		}
   563  	}
   564  	if !easy && r.Intn(10) != 0 {
   565  		this.XXX_unrecognized = randUnrecognizedEnumstringer(r, 2)
   566  	}
   567  	return this
   568  }
   569  
   570  type randyEnumstringer interface {
   571  	Float32() float32
   572  	Float64() float64
   573  	Int63() int64
   574  	Int31() int32
   575  	Uint32() uint32
   576  	Intn(n int) int
   577  }
   578  
   579  func randUTF8RuneEnumstringer(r randyEnumstringer) rune {
   580  	ru := r.Intn(62)
   581  	if ru < 10 {
   582  		return rune(ru + 48)
   583  	} else if ru < 36 {
   584  		return rune(ru + 55)
   585  	}
   586  	return rune(ru + 61)
   587  }
   588  func randStringEnumstringer(r randyEnumstringer) string {
   589  	v4 := r.Intn(100)
   590  	tmps := make([]rune, v4)
   591  	for i := 0; i < v4; i++ {
   592  		tmps[i] = randUTF8RuneEnumstringer(r)
   593  	}
   594  	return string(tmps)
   595  }
   596  func randUnrecognizedEnumstringer(r randyEnumstringer, maxFieldNumber int) (dAtA []byte) {
   597  	l := r.Intn(5)
   598  	for i := 0; i < l; i++ {
   599  		wire := r.Intn(4)
   600  		if wire == 3 {
   601  			wire = 5
   602  		}
   603  		fieldNumber := maxFieldNumber + r.Intn(100)
   604  		dAtA = randFieldEnumstringer(dAtA, r, fieldNumber, wire)
   605  	}
   606  	return dAtA
   607  }
   608  func randFieldEnumstringer(dAtA []byte, r randyEnumstringer, fieldNumber int, wire int) []byte {
   609  	key := uint32(fieldNumber)<<3 | uint32(wire)
   610  	switch wire {
   611  	case 0:
   612  		dAtA = encodeVarintPopulateEnumstringer(dAtA, uint64(key))
   613  		v5 := r.Int63()
   614  		if r.Intn(2) == 0 {
   615  			v5 *= -1
   616  		}
   617  		dAtA = encodeVarintPopulateEnumstringer(dAtA, uint64(v5))
   618  	case 1:
   619  		dAtA = encodeVarintPopulateEnumstringer(dAtA, uint64(key))
   620  		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)))
   621  	case 2:
   622  		dAtA = encodeVarintPopulateEnumstringer(dAtA, uint64(key))
   623  		ll := r.Intn(100)
   624  		dAtA = encodeVarintPopulateEnumstringer(dAtA, uint64(ll))
   625  		for j := 0; j < ll; j++ {
   626  			dAtA = append(dAtA, byte(r.Intn(256)))
   627  		}
   628  	default:
   629  		dAtA = encodeVarintPopulateEnumstringer(dAtA, uint64(key))
   630  		dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)))
   631  	}
   632  	return dAtA
   633  }
   634  func encodeVarintPopulateEnumstringer(dAtA []byte, v uint64) []byte {
   635  	for v >= 1<<7 {
   636  		dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80))
   637  		v >>= 7
   638  	}
   639  	dAtA = append(dAtA, uint8(v))
   640  	return dAtA
   641  }
   642  

View as plain text