github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/swarmkit/protobuf/plugin/deepcopy/test/deepcopypb_test.go (about)

     1  // Code generated by protoc-gen-gogo. DO NOT EDIT.
     2  // source: github.com/docker/swarmkit/protobuf/plugin/deepcopy/test/deepcopy.proto
     3  
     4  package test
     5  
     6  import (
     7  	fmt "fmt"
     8  	_ "github.com/gogo/protobuf/gogoproto"
     9  	github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb"
    10  	github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto"
    11  	proto "github.com/gogo/protobuf/proto"
    12  	math "math"
    13  	math_rand "math/rand"
    14  	testing "testing"
    15  	time "time"
    16  )
    17  
    18  // Reference imports to suppress errors if they are not otherwise used.
    19  var _ = proto.Marshal
    20  var _ = fmt.Errorf
    21  var _ = math.Inf
    22  
    23  func TestBasicScalarProto(t *testing.T) {
    24  	seed := time.Now().UnixNano()
    25  	popr := math_rand.New(math_rand.NewSource(seed))
    26  	p := NewPopulatedBasicScalar(popr, false)
    27  	dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
    28  	if err != nil {
    29  		t.Fatalf("seed = %d, err = %v", seed, err)
    30  	}
    31  	msg := &BasicScalar{}
    32  	if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
    33  		t.Fatalf("seed = %d, err = %v", seed, err)
    34  	}
    35  	littlefuzz := make([]byte, len(dAtA))
    36  	copy(littlefuzz, dAtA)
    37  	for i := range dAtA {
    38  		dAtA[i] = byte(popr.Intn(256))
    39  	}
    40  	if !p.Equal(msg) {
    41  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
    42  	}
    43  	if len(littlefuzz) > 0 {
    44  		fuzzamount := 100
    45  		for i := 0; i < fuzzamount; i++ {
    46  			littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
    47  			littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
    48  		}
    49  		// shouldn't panic
    50  		_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
    51  	}
    52  }
    53  
    54  func TestRepeatedScalarProto(t *testing.T) {
    55  	seed := time.Now().UnixNano()
    56  	popr := math_rand.New(math_rand.NewSource(seed))
    57  	p := NewPopulatedRepeatedScalar(popr, false)
    58  	dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
    59  	if err != nil {
    60  		t.Fatalf("seed = %d, err = %v", seed, err)
    61  	}
    62  	msg := &RepeatedScalar{}
    63  	if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
    64  		t.Fatalf("seed = %d, err = %v", seed, err)
    65  	}
    66  	littlefuzz := make([]byte, len(dAtA))
    67  	copy(littlefuzz, dAtA)
    68  	for i := range dAtA {
    69  		dAtA[i] = byte(popr.Intn(256))
    70  	}
    71  	if !p.Equal(msg) {
    72  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
    73  	}
    74  	if len(littlefuzz) > 0 {
    75  		fuzzamount := 100
    76  		for i := 0; i < fuzzamount; i++ {
    77  			littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
    78  			littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
    79  		}
    80  		// shouldn't panic
    81  		_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
    82  	}
    83  }
    84  
    85  func TestRepeatedScalarPackedProto(t *testing.T) {
    86  	seed := time.Now().UnixNano()
    87  	popr := math_rand.New(math_rand.NewSource(seed))
    88  	p := NewPopulatedRepeatedScalarPacked(popr, false)
    89  	dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
    90  	if err != nil {
    91  		t.Fatalf("seed = %d, err = %v", seed, err)
    92  	}
    93  	msg := &RepeatedScalarPacked{}
    94  	if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
    95  		t.Fatalf("seed = %d, err = %v", seed, err)
    96  	}
    97  	littlefuzz := make([]byte, len(dAtA))
    98  	copy(littlefuzz, dAtA)
    99  	for i := range dAtA {
   100  		dAtA[i] = byte(popr.Intn(256))
   101  	}
   102  	if !p.Equal(msg) {
   103  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   104  	}
   105  	if len(littlefuzz) > 0 {
   106  		fuzzamount := 100
   107  		for i := 0; i < fuzzamount; i++ {
   108  			littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
   109  			littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
   110  		}
   111  		// shouldn't panic
   112  		_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
   113  	}
   114  }
   115  
   116  func TestExternalStructProto(t *testing.T) {
   117  	seed := time.Now().UnixNano()
   118  	popr := math_rand.New(math_rand.NewSource(seed))
   119  	p := NewPopulatedExternalStruct(popr, false)
   120  	dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
   121  	if err != nil {
   122  		t.Fatalf("seed = %d, err = %v", seed, err)
   123  	}
   124  	msg := &ExternalStruct{}
   125  	if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
   126  		t.Fatalf("seed = %d, err = %v", seed, err)
   127  	}
   128  	littlefuzz := make([]byte, len(dAtA))
   129  	copy(littlefuzz, dAtA)
   130  	for i := range dAtA {
   131  		dAtA[i] = byte(popr.Intn(256))
   132  	}
   133  	if !p.Equal(msg) {
   134  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   135  	}
   136  	if len(littlefuzz) > 0 {
   137  		fuzzamount := 100
   138  		for i := 0; i < fuzzamount; i++ {
   139  			littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
   140  			littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
   141  		}
   142  		// shouldn't panic
   143  		_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
   144  	}
   145  }
   146  
   147  func TestRepeatedExternalStructProto(t *testing.T) {
   148  	seed := time.Now().UnixNano()
   149  	popr := math_rand.New(math_rand.NewSource(seed))
   150  	p := NewPopulatedRepeatedExternalStruct(popr, false)
   151  	dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
   152  	if err != nil {
   153  		t.Fatalf("seed = %d, err = %v", seed, err)
   154  	}
   155  	msg := &RepeatedExternalStruct{}
   156  	if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
   157  		t.Fatalf("seed = %d, err = %v", seed, err)
   158  	}
   159  	littlefuzz := make([]byte, len(dAtA))
   160  	copy(littlefuzz, dAtA)
   161  	for i := range dAtA {
   162  		dAtA[i] = byte(popr.Intn(256))
   163  	}
   164  	if !p.Equal(msg) {
   165  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   166  	}
   167  	if len(littlefuzz) > 0 {
   168  		fuzzamount := 100
   169  		for i := 0; i < fuzzamount; i++ {
   170  			littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
   171  			littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
   172  		}
   173  		// shouldn't panic
   174  		_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
   175  	}
   176  }
   177  
   178  func TestNonNullableExternalStructProto(t *testing.T) {
   179  	seed := time.Now().UnixNano()
   180  	popr := math_rand.New(math_rand.NewSource(seed))
   181  	p := NewPopulatedNonNullableExternalStruct(popr, false)
   182  	dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
   183  	if err != nil {
   184  		t.Fatalf("seed = %d, err = %v", seed, err)
   185  	}
   186  	msg := &NonNullableExternalStruct{}
   187  	if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
   188  		t.Fatalf("seed = %d, err = %v", seed, err)
   189  	}
   190  	littlefuzz := make([]byte, len(dAtA))
   191  	copy(littlefuzz, dAtA)
   192  	for i := range dAtA {
   193  		dAtA[i] = byte(popr.Intn(256))
   194  	}
   195  	if !p.Equal(msg) {
   196  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   197  	}
   198  	if len(littlefuzz) > 0 {
   199  		fuzzamount := 100
   200  		for i := 0; i < fuzzamount; i++ {
   201  			littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
   202  			littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
   203  		}
   204  		// shouldn't panic
   205  		_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
   206  	}
   207  }
   208  
   209  func TestRepeatedNonNullableExternalStructProto(t *testing.T) {
   210  	seed := time.Now().UnixNano()
   211  	popr := math_rand.New(math_rand.NewSource(seed))
   212  	p := NewPopulatedRepeatedNonNullableExternalStruct(popr, false)
   213  	dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
   214  	if err != nil {
   215  		t.Fatalf("seed = %d, err = %v", seed, err)
   216  	}
   217  	msg := &RepeatedNonNullableExternalStruct{}
   218  	if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
   219  		t.Fatalf("seed = %d, err = %v", seed, err)
   220  	}
   221  	littlefuzz := make([]byte, len(dAtA))
   222  	copy(littlefuzz, dAtA)
   223  	for i := range dAtA {
   224  		dAtA[i] = byte(popr.Intn(256))
   225  	}
   226  	if !p.Equal(msg) {
   227  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   228  	}
   229  	if len(littlefuzz) > 0 {
   230  		fuzzamount := 100
   231  		for i := 0; i < fuzzamount; i++ {
   232  			littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
   233  			littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
   234  		}
   235  		// shouldn't panic
   236  		_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
   237  	}
   238  }
   239  
   240  func TestMapStructProto(t *testing.T) {
   241  	seed := time.Now().UnixNano()
   242  	popr := math_rand.New(math_rand.NewSource(seed))
   243  	p := NewPopulatedMapStruct(popr, false)
   244  	dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
   245  	if err != nil {
   246  		t.Fatalf("seed = %d, err = %v", seed, err)
   247  	}
   248  	msg := &MapStruct{}
   249  	if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
   250  		t.Fatalf("seed = %d, err = %v", seed, err)
   251  	}
   252  	littlefuzz := make([]byte, len(dAtA))
   253  	copy(littlefuzz, dAtA)
   254  	for i := range dAtA {
   255  		dAtA[i] = byte(popr.Intn(256))
   256  	}
   257  	if !p.Equal(msg) {
   258  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   259  	}
   260  	if len(littlefuzz) > 0 {
   261  		fuzzamount := 100
   262  		for i := 0; i < fuzzamount; i++ {
   263  			littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
   264  			littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
   265  		}
   266  		// shouldn't panic
   267  		_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
   268  	}
   269  }
   270  
   271  func TestOneOfProto(t *testing.T) {
   272  	seed := time.Now().UnixNano()
   273  	popr := math_rand.New(math_rand.NewSource(seed))
   274  	p := NewPopulatedOneOf(popr, false)
   275  	dAtA, err := github_com_gogo_protobuf_proto.Marshal(p)
   276  	if err != nil {
   277  		t.Fatalf("seed = %d, err = %v", seed, err)
   278  	}
   279  	msg := &OneOf{}
   280  	if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
   281  		t.Fatalf("seed = %d, err = %v", seed, err)
   282  	}
   283  	littlefuzz := make([]byte, len(dAtA))
   284  	copy(littlefuzz, dAtA)
   285  	for i := range dAtA {
   286  		dAtA[i] = byte(popr.Intn(256))
   287  	}
   288  	if !p.Equal(msg) {
   289  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   290  	}
   291  	if len(littlefuzz) > 0 {
   292  		fuzzamount := 100
   293  		for i := 0; i < fuzzamount; i++ {
   294  			littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
   295  			littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
   296  		}
   297  		// shouldn't panic
   298  		_ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg)
   299  	}
   300  }
   301  
   302  func TestBasicScalarJSON(t *testing.T) {
   303  	seed := time.Now().UnixNano()
   304  	popr := math_rand.New(math_rand.NewSource(seed))
   305  	p := NewPopulatedBasicScalar(popr, true)
   306  	marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
   307  	jsondata, err := marshaler.MarshalToString(p)
   308  	if err != nil {
   309  		t.Fatalf("seed = %d, err = %v", seed, err)
   310  	}
   311  	msg := &BasicScalar{}
   312  	err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
   313  	if err != nil {
   314  		t.Fatalf("seed = %d, err = %v", seed, err)
   315  	}
   316  	if !p.Equal(msg) {
   317  		t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
   318  	}
   319  }
   320  func TestRepeatedScalarJSON(t *testing.T) {
   321  	seed := time.Now().UnixNano()
   322  	popr := math_rand.New(math_rand.NewSource(seed))
   323  	p := NewPopulatedRepeatedScalar(popr, true)
   324  	marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
   325  	jsondata, err := marshaler.MarshalToString(p)
   326  	if err != nil {
   327  		t.Fatalf("seed = %d, err = %v", seed, err)
   328  	}
   329  	msg := &RepeatedScalar{}
   330  	err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
   331  	if err != nil {
   332  		t.Fatalf("seed = %d, err = %v", seed, err)
   333  	}
   334  	if !p.Equal(msg) {
   335  		t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
   336  	}
   337  }
   338  func TestRepeatedScalarPackedJSON(t *testing.T) {
   339  	seed := time.Now().UnixNano()
   340  	popr := math_rand.New(math_rand.NewSource(seed))
   341  	p := NewPopulatedRepeatedScalarPacked(popr, true)
   342  	marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
   343  	jsondata, err := marshaler.MarshalToString(p)
   344  	if err != nil {
   345  		t.Fatalf("seed = %d, err = %v", seed, err)
   346  	}
   347  	msg := &RepeatedScalarPacked{}
   348  	err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
   349  	if err != nil {
   350  		t.Fatalf("seed = %d, err = %v", seed, err)
   351  	}
   352  	if !p.Equal(msg) {
   353  		t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
   354  	}
   355  }
   356  func TestExternalStructJSON(t *testing.T) {
   357  	seed := time.Now().UnixNano()
   358  	popr := math_rand.New(math_rand.NewSource(seed))
   359  	p := NewPopulatedExternalStruct(popr, true)
   360  	marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
   361  	jsondata, err := marshaler.MarshalToString(p)
   362  	if err != nil {
   363  		t.Fatalf("seed = %d, err = %v", seed, err)
   364  	}
   365  	msg := &ExternalStruct{}
   366  	err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
   367  	if err != nil {
   368  		t.Fatalf("seed = %d, err = %v", seed, err)
   369  	}
   370  	if !p.Equal(msg) {
   371  		t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
   372  	}
   373  }
   374  func TestRepeatedExternalStructJSON(t *testing.T) {
   375  	seed := time.Now().UnixNano()
   376  	popr := math_rand.New(math_rand.NewSource(seed))
   377  	p := NewPopulatedRepeatedExternalStruct(popr, true)
   378  	marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
   379  	jsondata, err := marshaler.MarshalToString(p)
   380  	if err != nil {
   381  		t.Fatalf("seed = %d, err = %v", seed, err)
   382  	}
   383  	msg := &RepeatedExternalStruct{}
   384  	err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
   385  	if err != nil {
   386  		t.Fatalf("seed = %d, err = %v", seed, err)
   387  	}
   388  	if !p.Equal(msg) {
   389  		t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
   390  	}
   391  }
   392  func TestNonNullableExternalStructJSON(t *testing.T) {
   393  	seed := time.Now().UnixNano()
   394  	popr := math_rand.New(math_rand.NewSource(seed))
   395  	p := NewPopulatedNonNullableExternalStruct(popr, true)
   396  	marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
   397  	jsondata, err := marshaler.MarshalToString(p)
   398  	if err != nil {
   399  		t.Fatalf("seed = %d, err = %v", seed, err)
   400  	}
   401  	msg := &NonNullableExternalStruct{}
   402  	err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
   403  	if err != nil {
   404  		t.Fatalf("seed = %d, err = %v", seed, err)
   405  	}
   406  	if !p.Equal(msg) {
   407  		t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
   408  	}
   409  }
   410  func TestRepeatedNonNullableExternalStructJSON(t *testing.T) {
   411  	seed := time.Now().UnixNano()
   412  	popr := math_rand.New(math_rand.NewSource(seed))
   413  	p := NewPopulatedRepeatedNonNullableExternalStruct(popr, true)
   414  	marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
   415  	jsondata, err := marshaler.MarshalToString(p)
   416  	if err != nil {
   417  		t.Fatalf("seed = %d, err = %v", seed, err)
   418  	}
   419  	msg := &RepeatedNonNullableExternalStruct{}
   420  	err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
   421  	if err != nil {
   422  		t.Fatalf("seed = %d, err = %v", seed, err)
   423  	}
   424  	if !p.Equal(msg) {
   425  		t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
   426  	}
   427  }
   428  func TestMapStructJSON(t *testing.T) {
   429  	seed := time.Now().UnixNano()
   430  	popr := math_rand.New(math_rand.NewSource(seed))
   431  	p := NewPopulatedMapStruct(popr, true)
   432  	marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
   433  	jsondata, err := marshaler.MarshalToString(p)
   434  	if err != nil {
   435  		t.Fatalf("seed = %d, err = %v", seed, err)
   436  	}
   437  	msg := &MapStruct{}
   438  	err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
   439  	if err != nil {
   440  		t.Fatalf("seed = %d, err = %v", seed, err)
   441  	}
   442  	if !p.Equal(msg) {
   443  		t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
   444  	}
   445  }
   446  func TestOneOfJSON(t *testing.T) {
   447  	seed := time.Now().UnixNano()
   448  	popr := math_rand.New(math_rand.NewSource(seed))
   449  	p := NewPopulatedOneOf(popr, true)
   450  	marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
   451  	jsondata, err := marshaler.MarshalToString(p)
   452  	if err != nil {
   453  		t.Fatalf("seed = %d, err = %v", seed, err)
   454  	}
   455  	msg := &OneOf{}
   456  	err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
   457  	if err != nil {
   458  		t.Fatalf("seed = %d, err = %v", seed, err)
   459  	}
   460  	if !p.Equal(msg) {
   461  		t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
   462  	}
   463  }
   464  func TestBasicScalarProtoText(t *testing.T) {
   465  	seed := time.Now().UnixNano()
   466  	popr := math_rand.New(math_rand.NewSource(seed))
   467  	p := NewPopulatedBasicScalar(popr, true)
   468  	dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
   469  	msg := &BasicScalar{}
   470  	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
   471  		t.Fatalf("seed = %d, err = %v", seed, err)
   472  	}
   473  	if !p.Equal(msg) {
   474  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   475  	}
   476  }
   477  
   478  func TestBasicScalarProtoCompactText(t *testing.T) {
   479  	seed := time.Now().UnixNano()
   480  	popr := math_rand.New(math_rand.NewSource(seed))
   481  	p := NewPopulatedBasicScalar(popr, true)
   482  	dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
   483  	msg := &BasicScalar{}
   484  	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
   485  		t.Fatalf("seed = %d, err = %v", seed, err)
   486  	}
   487  	if !p.Equal(msg) {
   488  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   489  	}
   490  }
   491  
   492  func TestRepeatedScalarProtoText(t *testing.T) {
   493  	seed := time.Now().UnixNano()
   494  	popr := math_rand.New(math_rand.NewSource(seed))
   495  	p := NewPopulatedRepeatedScalar(popr, true)
   496  	dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
   497  	msg := &RepeatedScalar{}
   498  	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
   499  		t.Fatalf("seed = %d, err = %v", seed, err)
   500  	}
   501  	if !p.Equal(msg) {
   502  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   503  	}
   504  }
   505  
   506  func TestRepeatedScalarProtoCompactText(t *testing.T) {
   507  	seed := time.Now().UnixNano()
   508  	popr := math_rand.New(math_rand.NewSource(seed))
   509  	p := NewPopulatedRepeatedScalar(popr, true)
   510  	dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
   511  	msg := &RepeatedScalar{}
   512  	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
   513  		t.Fatalf("seed = %d, err = %v", seed, err)
   514  	}
   515  	if !p.Equal(msg) {
   516  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   517  	}
   518  }
   519  
   520  func TestRepeatedScalarPackedProtoText(t *testing.T) {
   521  	seed := time.Now().UnixNano()
   522  	popr := math_rand.New(math_rand.NewSource(seed))
   523  	p := NewPopulatedRepeatedScalarPacked(popr, true)
   524  	dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
   525  	msg := &RepeatedScalarPacked{}
   526  	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
   527  		t.Fatalf("seed = %d, err = %v", seed, err)
   528  	}
   529  	if !p.Equal(msg) {
   530  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   531  	}
   532  }
   533  
   534  func TestRepeatedScalarPackedProtoCompactText(t *testing.T) {
   535  	seed := time.Now().UnixNano()
   536  	popr := math_rand.New(math_rand.NewSource(seed))
   537  	p := NewPopulatedRepeatedScalarPacked(popr, true)
   538  	dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
   539  	msg := &RepeatedScalarPacked{}
   540  	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
   541  		t.Fatalf("seed = %d, err = %v", seed, err)
   542  	}
   543  	if !p.Equal(msg) {
   544  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   545  	}
   546  }
   547  
   548  func TestExternalStructProtoText(t *testing.T) {
   549  	seed := time.Now().UnixNano()
   550  	popr := math_rand.New(math_rand.NewSource(seed))
   551  	p := NewPopulatedExternalStruct(popr, true)
   552  	dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
   553  	msg := &ExternalStruct{}
   554  	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
   555  		t.Fatalf("seed = %d, err = %v", seed, err)
   556  	}
   557  	if !p.Equal(msg) {
   558  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   559  	}
   560  }
   561  
   562  func TestExternalStructProtoCompactText(t *testing.T) {
   563  	seed := time.Now().UnixNano()
   564  	popr := math_rand.New(math_rand.NewSource(seed))
   565  	p := NewPopulatedExternalStruct(popr, true)
   566  	dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
   567  	msg := &ExternalStruct{}
   568  	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
   569  		t.Fatalf("seed = %d, err = %v", seed, err)
   570  	}
   571  	if !p.Equal(msg) {
   572  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   573  	}
   574  }
   575  
   576  func TestRepeatedExternalStructProtoText(t *testing.T) {
   577  	seed := time.Now().UnixNano()
   578  	popr := math_rand.New(math_rand.NewSource(seed))
   579  	p := NewPopulatedRepeatedExternalStruct(popr, true)
   580  	dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
   581  	msg := &RepeatedExternalStruct{}
   582  	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
   583  		t.Fatalf("seed = %d, err = %v", seed, err)
   584  	}
   585  	if !p.Equal(msg) {
   586  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   587  	}
   588  }
   589  
   590  func TestRepeatedExternalStructProtoCompactText(t *testing.T) {
   591  	seed := time.Now().UnixNano()
   592  	popr := math_rand.New(math_rand.NewSource(seed))
   593  	p := NewPopulatedRepeatedExternalStruct(popr, true)
   594  	dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
   595  	msg := &RepeatedExternalStruct{}
   596  	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
   597  		t.Fatalf("seed = %d, err = %v", seed, err)
   598  	}
   599  	if !p.Equal(msg) {
   600  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   601  	}
   602  }
   603  
   604  func TestNonNullableExternalStructProtoText(t *testing.T) {
   605  	seed := time.Now().UnixNano()
   606  	popr := math_rand.New(math_rand.NewSource(seed))
   607  	p := NewPopulatedNonNullableExternalStruct(popr, true)
   608  	dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
   609  	msg := &NonNullableExternalStruct{}
   610  	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
   611  		t.Fatalf("seed = %d, err = %v", seed, err)
   612  	}
   613  	if !p.Equal(msg) {
   614  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   615  	}
   616  }
   617  
   618  func TestNonNullableExternalStructProtoCompactText(t *testing.T) {
   619  	seed := time.Now().UnixNano()
   620  	popr := math_rand.New(math_rand.NewSource(seed))
   621  	p := NewPopulatedNonNullableExternalStruct(popr, true)
   622  	dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
   623  	msg := &NonNullableExternalStruct{}
   624  	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
   625  		t.Fatalf("seed = %d, err = %v", seed, err)
   626  	}
   627  	if !p.Equal(msg) {
   628  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   629  	}
   630  }
   631  
   632  func TestRepeatedNonNullableExternalStructProtoText(t *testing.T) {
   633  	seed := time.Now().UnixNano()
   634  	popr := math_rand.New(math_rand.NewSource(seed))
   635  	p := NewPopulatedRepeatedNonNullableExternalStruct(popr, true)
   636  	dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
   637  	msg := &RepeatedNonNullableExternalStruct{}
   638  	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
   639  		t.Fatalf("seed = %d, err = %v", seed, err)
   640  	}
   641  	if !p.Equal(msg) {
   642  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   643  	}
   644  }
   645  
   646  func TestRepeatedNonNullableExternalStructProtoCompactText(t *testing.T) {
   647  	seed := time.Now().UnixNano()
   648  	popr := math_rand.New(math_rand.NewSource(seed))
   649  	p := NewPopulatedRepeatedNonNullableExternalStruct(popr, true)
   650  	dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
   651  	msg := &RepeatedNonNullableExternalStruct{}
   652  	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
   653  		t.Fatalf("seed = %d, err = %v", seed, err)
   654  	}
   655  	if !p.Equal(msg) {
   656  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   657  	}
   658  }
   659  
   660  func TestMapStructProtoText(t *testing.T) {
   661  	seed := time.Now().UnixNano()
   662  	popr := math_rand.New(math_rand.NewSource(seed))
   663  	p := NewPopulatedMapStruct(popr, true)
   664  	dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
   665  	msg := &MapStruct{}
   666  	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
   667  		t.Fatalf("seed = %d, err = %v", seed, err)
   668  	}
   669  	if !p.Equal(msg) {
   670  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   671  	}
   672  }
   673  
   674  func TestMapStructProtoCompactText(t *testing.T) {
   675  	seed := time.Now().UnixNano()
   676  	popr := math_rand.New(math_rand.NewSource(seed))
   677  	p := NewPopulatedMapStruct(popr, true)
   678  	dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
   679  	msg := &MapStruct{}
   680  	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
   681  		t.Fatalf("seed = %d, err = %v", seed, err)
   682  	}
   683  	if !p.Equal(msg) {
   684  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   685  	}
   686  }
   687  
   688  func TestOneOfProtoText(t *testing.T) {
   689  	seed := time.Now().UnixNano()
   690  	popr := math_rand.New(math_rand.NewSource(seed))
   691  	p := NewPopulatedOneOf(popr, true)
   692  	dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p)
   693  	msg := &OneOf{}
   694  	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
   695  		t.Fatalf("seed = %d, err = %v", seed, err)
   696  	}
   697  	if !p.Equal(msg) {
   698  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   699  	}
   700  }
   701  
   702  func TestOneOfProtoCompactText(t *testing.T) {
   703  	seed := time.Now().UnixNano()
   704  	popr := math_rand.New(math_rand.NewSource(seed))
   705  	p := NewPopulatedOneOf(popr, true)
   706  	dAtA := github_com_gogo_protobuf_proto.CompactTextString(p)
   707  	msg := &OneOf{}
   708  	if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
   709  		t.Fatalf("seed = %d, err = %v", seed, err)
   710  	}
   711  	if !p.Equal(msg) {
   712  		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
   713  	}
   714  }
   715  
   716  func TestBasicScalarCopy(t *testing.T) {
   717  	popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
   718  	in := NewPopulatedBasicScalar(popr, true)
   719  	out := in.Copy()
   720  	if !in.Equal(out) {
   721  		t.Fatalf("%#v != %#v", in, out)
   722  	}
   723  	if &in.Field1 == &out.Field1 {
   724  		t.Fatalf("Field1: %#v == %#v", &in.Field1, &out.Field1)
   725  	}
   726  	if &in.Field2 == &out.Field2 {
   727  		t.Fatalf("Field2: %#v == %#v", &in.Field2, &out.Field2)
   728  	}
   729  	if &in.Field3 == &out.Field3 {
   730  		t.Fatalf("Field3: %#v == %#v", &in.Field3, &out.Field3)
   731  	}
   732  	if &in.Field4 == &out.Field4 {
   733  		t.Fatalf("Field4: %#v == %#v", &in.Field4, &out.Field4)
   734  	}
   735  	if &in.Field5 == &out.Field5 {
   736  		t.Fatalf("Field5: %#v == %#v", &in.Field5, &out.Field5)
   737  	}
   738  	if &in.Field6 == &out.Field6 {
   739  		t.Fatalf("Field6: %#v == %#v", &in.Field6, &out.Field6)
   740  	}
   741  	if &in.Field7 == &out.Field7 {
   742  		t.Fatalf("Field7: %#v == %#v", &in.Field7, &out.Field7)
   743  	}
   744  	if &in.Field8 == &out.Field8 {
   745  		t.Fatalf("Field8: %#v == %#v", &in.Field8, &out.Field8)
   746  	}
   747  	if &in.Field9 == &out.Field9 {
   748  		t.Fatalf("Field9: %#v == %#v", &in.Field9, &out.Field9)
   749  	}
   750  	if &in.Field10 == &out.Field10 {
   751  		t.Fatalf("Field10: %#v == %#v", &in.Field10, &out.Field10)
   752  	}
   753  	if &in.Field11 == &out.Field11 {
   754  		t.Fatalf("Field11: %#v == %#v", &in.Field11, &out.Field11)
   755  	}
   756  	if &in.Field12 == &out.Field12 {
   757  		t.Fatalf("Field12: %#v == %#v", &in.Field12, &out.Field12)
   758  	}
   759  	if &in.Field13 == &out.Field13 {
   760  		t.Fatalf("Field13: %#v == %#v", &in.Field13, &out.Field13)
   761  	}
   762  	if &in.Field14 == &out.Field14 {
   763  		t.Fatalf("Field14: %#v == %#v", &in.Field14, &out.Field14)
   764  	}
   765  	if &in.Field15 == &out.Field15 {
   766  		t.Fatalf("Field15: %#v == %#v", &in.Field15, &out.Field15)
   767  	}
   768  	if len(in.Field15) > 0 {
   769  		in.Field15[0]++
   770  		if in.Equal(out) {
   771  			t.Fatalf("%#v == %#v", in, out)
   772  		}
   773  	}
   774  
   775  	in = nil
   776  	out = in.Copy()
   777  	if out != nil {
   778  		t.Fatalf("copying nil should return nil, returned: %#v", out)
   779  	}
   780  }
   781  
   782  func TestRepeatedScalarCopy(t *testing.T) {
   783  	popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
   784  	in := NewPopulatedRepeatedScalar(popr, true)
   785  	out := in.Copy()
   786  	if !in.Equal(out) {
   787  		t.Fatalf("%#v != %#v", in, out)
   788  	}
   789  	if &in.Field1 == &out.Field1 {
   790  		t.Fatalf("Field1: %#v == %#v", &in.Field1, &out.Field1)
   791  	}
   792  	if &in.Field2 == &out.Field2 {
   793  		t.Fatalf("Field2: %#v == %#v", &in.Field2, &out.Field2)
   794  	}
   795  	if &in.Field3 == &out.Field3 {
   796  		t.Fatalf("Field3: %#v == %#v", &in.Field3, &out.Field3)
   797  	}
   798  	if &in.Field4 == &out.Field4 {
   799  		t.Fatalf("Field4: %#v == %#v", &in.Field4, &out.Field4)
   800  	}
   801  	if &in.Field5 == &out.Field5 {
   802  		t.Fatalf("Field5: %#v == %#v", &in.Field5, &out.Field5)
   803  	}
   804  	if &in.Field6 == &out.Field6 {
   805  		t.Fatalf("Field6: %#v == %#v", &in.Field6, &out.Field6)
   806  	}
   807  	if &in.Field7 == &out.Field7 {
   808  		t.Fatalf("Field7: %#v == %#v", &in.Field7, &out.Field7)
   809  	}
   810  	if &in.Field8 == &out.Field8 {
   811  		t.Fatalf("Field8: %#v == %#v", &in.Field8, &out.Field8)
   812  	}
   813  	if &in.Field9 == &out.Field9 {
   814  		t.Fatalf("Field9: %#v == %#v", &in.Field9, &out.Field9)
   815  	}
   816  	if &in.Field10 == &out.Field10 {
   817  		t.Fatalf("Field10: %#v == %#v", &in.Field10, &out.Field10)
   818  	}
   819  	if &in.Field11 == &out.Field11 {
   820  		t.Fatalf("Field11: %#v == %#v", &in.Field11, &out.Field11)
   821  	}
   822  	if &in.Field12 == &out.Field12 {
   823  		t.Fatalf("Field12: %#v == %#v", &in.Field12, &out.Field12)
   824  	}
   825  	if &in.Field13 == &out.Field13 {
   826  		t.Fatalf("Field13: %#v == %#v", &in.Field13, &out.Field13)
   827  	}
   828  	if &in.Field14 == &out.Field14 {
   829  		t.Fatalf("Field14: %#v == %#v", &in.Field14, &out.Field14)
   830  	}
   831  	if &in.Field15 == &out.Field15 {
   832  		t.Fatalf("Field15: %#v == %#v", &in.Field15, &out.Field15)
   833  	}
   834  	if len(in.Field15) > 0 {
   835  		if len(in.Field15[0]) > 0 {
   836  			in.Field15[0][0]++
   837  			if in.Equal(out) {
   838  				t.Fatalf("%#v == %#v", in, out)
   839  			}
   840  		}
   841  	}
   842  
   843  	in = nil
   844  	out = in.Copy()
   845  	if out != nil {
   846  		t.Fatalf("copying nil should return nil, returned: %#v", out)
   847  	}
   848  }
   849  
   850  func TestRepeatedScalarPackedCopy(t *testing.T) {
   851  	popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
   852  	in := NewPopulatedRepeatedScalarPacked(popr, true)
   853  	out := in.Copy()
   854  	if !in.Equal(out) {
   855  		t.Fatalf("%#v != %#v", in, out)
   856  	}
   857  	if &in.Field1 == &out.Field1 {
   858  		t.Fatalf("Field1: %#v == %#v", &in.Field1, &out.Field1)
   859  	}
   860  	if &in.Field2 == &out.Field2 {
   861  		t.Fatalf("Field2: %#v == %#v", &in.Field2, &out.Field2)
   862  	}
   863  	if &in.Field3 == &out.Field3 {
   864  		t.Fatalf("Field3: %#v == %#v", &in.Field3, &out.Field3)
   865  	}
   866  	if &in.Field4 == &out.Field4 {
   867  		t.Fatalf("Field4: %#v == %#v", &in.Field4, &out.Field4)
   868  	}
   869  	if &in.Field5 == &out.Field5 {
   870  		t.Fatalf("Field5: %#v == %#v", &in.Field5, &out.Field5)
   871  	}
   872  	if &in.Field6 == &out.Field6 {
   873  		t.Fatalf("Field6: %#v == %#v", &in.Field6, &out.Field6)
   874  	}
   875  	if &in.Field7 == &out.Field7 {
   876  		t.Fatalf("Field7: %#v == %#v", &in.Field7, &out.Field7)
   877  	}
   878  	if &in.Field8 == &out.Field8 {
   879  		t.Fatalf("Field8: %#v == %#v", &in.Field8, &out.Field8)
   880  	}
   881  	if &in.Field9 == &out.Field9 {
   882  		t.Fatalf("Field9: %#v == %#v", &in.Field9, &out.Field9)
   883  	}
   884  	if &in.Field10 == &out.Field10 {
   885  		t.Fatalf("Field10: %#v == %#v", &in.Field10, &out.Field10)
   886  	}
   887  	if &in.Field11 == &out.Field11 {
   888  		t.Fatalf("Field11: %#v == %#v", &in.Field11, &out.Field11)
   889  	}
   890  	if &in.Field12 == &out.Field12 {
   891  		t.Fatalf("Field12: %#v == %#v", &in.Field12, &out.Field12)
   892  	}
   893  	if &in.Field13 == &out.Field13 {
   894  		t.Fatalf("Field13: %#v == %#v", &in.Field13, &out.Field13)
   895  	}
   896  
   897  	in = nil
   898  	out = in.Copy()
   899  	if out != nil {
   900  		t.Fatalf("copying nil should return nil, returned: %#v", out)
   901  	}
   902  }
   903  
   904  func TestExternalStructCopy(t *testing.T) {
   905  	popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
   906  	in := NewPopulatedExternalStruct(popr, true)
   907  	out := in.Copy()
   908  	if !in.Equal(out) {
   909  		t.Fatalf("%#v != %#v", in, out)
   910  	}
   911  	if &in.Field1 == &out.Field1 {
   912  		t.Fatalf("Field1: %#v == %#v", &in.Field1, &out.Field1)
   913  	}
   914  	if &in.Field2 == &out.Field2 {
   915  		t.Fatalf("Field2: %#v == %#v", &in.Field2, &out.Field2)
   916  	}
   917  	if &in.Field3 == &out.Field3 {
   918  		t.Fatalf("Field3: %#v == %#v", &in.Field3, &out.Field3)
   919  	}
   920  
   921  	in = nil
   922  	out = in.Copy()
   923  	if out != nil {
   924  		t.Fatalf("copying nil should return nil, returned: %#v", out)
   925  	}
   926  }
   927  
   928  func TestRepeatedExternalStructCopy(t *testing.T) {
   929  	popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
   930  	in := NewPopulatedRepeatedExternalStruct(popr, true)
   931  	out := in.Copy()
   932  	if !in.Equal(out) {
   933  		t.Fatalf("%#v != %#v", in, out)
   934  	}
   935  	if &in.Field1 == &out.Field1 {
   936  		t.Fatalf("Field1: %#v == %#v", &in.Field1, &out.Field1)
   937  	}
   938  	if &in.Field2 == &out.Field2 {
   939  		t.Fatalf("Field2: %#v == %#v", &in.Field2, &out.Field2)
   940  	}
   941  	if &in.Field3 == &out.Field3 {
   942  		t.Fatalf("Field3: %#v == %#v", &in.Field3, &out.Field3)
   943  	}
   944  
   945  	in = nil
   946  	out = in.Copy()
   947  	if out != nil {
   948  		t.Fatalf("copying nil should return nil, returned: %#v", out)
   949  	}
   950  }
   951  
   952  func TestNonNullableExternalStructCopy(t *testing.T) {
   953  	popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
   954  	in := NewPopulatedNonNullableExternalStruct(popr, true)
   955  	out := in.Copy()
   956  	if !in.Equal(out) {
   957  		t.Fatalf("%#v != %#v", in, out)
   958  	}
   959  	if &in.Field1 == &out.Field1 {
   960  		t.Fatalf("Field1: %#v == %#v", &in.Field1, &out.Field1)
   961  	}
   962  	if &in.Field2 == &out.Field2 {
   963  		t.Fatalf("Field2: %#v == %#v", &in.Field2, &out.Field2)
   964  	}
   965  	if &in.Field3 == &out.Field3 {
   966  		t.Fatalf("Field3: %#v == %#v", &in.Field3, &out.Field3)
   967  	}
   968  
   969  	in = nil
   970  	out = in.Copy()
   971  	if out != nil {
   972  		t.Fatalf("copying nil should return nil, returned: %#v", out)
   973  	}
   974  }
   975  
   976  func TestRepeatedNonNullableExternalStructCopy(t *testing.T) {
   977  	popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
   978  	in := NewPopulatedRepeatedNonNullableExternalStruct(popr, true)
   979  	out := in.Copy()
   980  	if !in.Equal(out) {
   981  		t.Fatalf("%#v != %#v", in, out)
   982  	}
   983  	if &in.Field1 == &out.Field1 {
   984  		t.Fatalf("Field1: %#v == %#v", &in.Field1, &out.Field1)
   985  	}
   986  	if &in.Field2 == &out.Field2 {
   987  		t.Fatalf("Field2: %#v == %#v", &in.Field2, &out.Field2)
   988  	}
   989  	if &in.Field3 == &out.Field3 {
   990  		t.Fatalf("Field3: %#v == %#v", &in.Field3, &out.Field3)
   991  	}
   992  
   993  	in = nil
   994  	out = in.Copy()
   995  	if out != nil {
   996  		t.Fatalf("copying nil should return nil, returned: %#v", out)
   997  	}
   998  }
   999  
  1000  func TestMapStructCopy(t *testing.T) {
  1001  	popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
  1002  	in := NewPopulatedMapStruct(popr, true)
  1003  	out := in.Copy()
  1004  	if !in.Equal(out) {
  1005  		t.Fatalf("%#v != %#v", in, out)
  1006  	}
  1007  	if &in.NullableMap == &out.NullableMap {
  1008  		t.Fatalf("NullableMap: %#v == %#v", &in.NullableMap, &out.NullableMap)
  1009  	}
  1010  	if &in.NonnullableMap == &out.NonnullableMap {
  1011  		t.Fatalf("NonnullableMap: %#v == %#v", &in.NonnullableMap, &out.NonnullableMap)
  1012  	}
  1013  
  1014  	in = nil
  1015  	out = in.Copy()
  1016  	if out != nil {
  1017  		t.Fatalf("copying nil should return nil, returned: %#v", out)
  1018  	}
  1019  }
  1020  
  1021  func TestOneOfCopy(t *testing.T) {
  1022  	popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
  1023  	in := NewPopulatedOneOf(popr, true)
  1024  	out := in.Copy()
  1025  	if !in.Equal(out) {
  1026  		t.Fatalf("%#v != %#v", in, out)
  1027  	}
  1028  	if len(in.GetField7()) > 0 {
  1029  		in.GetField7()[0]++
  1030  		if in.Equal(out) {
  1031  			t.Fatalf("%#v == %#v", in, out)
  1032  		}
  1033  	}
  1034  	if in.GetField8() != nil && in.GetField8() == out.GetField8() {
  1035  		t.Fatalf("GetField8(): %#v == %#v", in.GetField8(), out.GetField8())
  1036  	}
  1037  	if in.GetField9() != nil && in.GetField9() == out.GetField9() {
  1038  		t.Fatalf("GetField9(): %#v == %#v", in.GetField9(), out.GetField9())
  1039  	}
  1040  	if in.GetField10() != nil && in.GetField10() == out.GetField10() {
  1041  		t.Fatalf("GetField10(): %#v == %#v", in.GetField10(), out.GetField10())
  1042  	}
  1043  	if in.GetField11() != nil && in.GetField11() == out.GetField11() {
  1044  		t.Fatalf("GetField11(): %#v == %#v", in.GetField11(), out.GetField11())
  1045  	}
  1046  
  1047  	in = nil
  1048  	out = in.Copy()
  1049  	if out != nil {
  1050  		t.Fatalf("copying nil should return nil, returned: %#v", out)
  1051  	}
  1052  }
  1053  func TestBasicScalarStringer(t *testing.T) {
  1054  	popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
  1055  	p := NewPopulatedBasicScalar(popr, false)
  1056  	s1 := p.String()
  1057  	s2 := fmt.Sprintf("%v", p)
  1058  	if s1 != s2 {
  1059  		t.Fatalf("String want %v got %v", s1, s2)
  1060  	}
  1061  }
  1062  func TestRepeatedScalarStringer(t *testing.T) {
  1063  	popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
  1064  	p := NewPopulatedRepeatedScalar(popr, false)
  1065  	s1 := p.String()
  1066  	s2 := fmt.Sprintf("%v", p)
  1067  	if s1 != s2 {
  1068  		t.Fatalf("String want %v got %v", s1, s2)
  1069  	}
  1070  }
  1071  func TestRepeatedScalarPackedStringer(t *testing.T) {
  1072  	popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
  1073  	p := NewPopulatedRepeatedScalarPacked(popr, false)
  1074  	s1 := p.String()
  1075  	s2 := fmt.Sprintf("%v", p)
  1076  	if s1 != s2 {
  1077  		t.Fatalf("String want %v got %v", s1, s2)
  1078  	}
  1079  }
  1080  func TestExternalStructStringer(t *testing.T) {
  1081  	popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
  1082  	p := NewPopulatedExternalStruct(popr, false)
  1083  	s1 := p.String()
  1084  	s2 := fmt.Sprintf("%v", p)
  1085  	if s1 != s2 {
  1086  		t.Fatalf("String want %v got %v", s1, s2)
  1087  	}
  1088  }
  1089  func TestRepeatedExternalStructStringer(t *testing.T) {
  1090  	popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
  1091  	p := NewPopulatedRepeatedExternalStruct(popr, false)
  1092  	s1 := p.String()
  1093  	s2 := fmt.Sprintf("%v", p)
  1094  	if s1 != s2 {
  1095  		t.Fatalf("String want %v got %v", s1, s2)
  1096  	}
  1097  }
  1098  func TestNonNullableExternalStructStringer(t *testing.T) {
  1099  	popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
  1100  	p := NewPopulatedNonNullableExternalStruct(popr, false)
  1101  	s1 := p.String()
  1102  	s2 := fmt.Sprintf("%v", p)
  1103  	if s1 != s2 {
  1104  		t.Fatalf("String want %v got %v", s1, s2)
  1105  	}
  1106  }
  1107  func TestRepeatedNonNullableExternalStructStringer(t *testing.T) {
  1108  	popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
  1109  	p := NewPopulatedRepeatedNonNullableExternalStruct(popr, false)
  1110  	s1 := p.String()
  1111  	s2 := fmt.Sprintf("%v", p)
  1112  	if s1 != s2 {
  1113  		t.Fatalf("String want %v got %v", s1, s2)
  1114  	}
  1115  }
  1116  func TestMapStructStringer(t *testing.T) {
  1117  	popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
  1118  	p := NewPopulatedMapStruct(popr, false)
  1119  	s1 := p.String()
  1120  	s2 := fmt.Sprintf("%v", p)
  1121  	if s1 != s2 {
  1122  		t.Fatalf("String want %v got %v", s1, s2)
  1123  	}
  1124  }
  1125  func TestOneOfStringer(t *testing.T) {
  1126  	popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano()))
  1127  	p := NewPopulatedOneOf(popr, false)
  1128  	s1 := p.String()
  1129  	s2 := fmt.Sprintf("%v", p)
  1130  	if s1 != s2 {
  1131  		t.Fatalf("String want %v got %v", s1, s2)
  1132  	}
  1133  }
  1134  
  1135  //These tests are generated by github.com/gogo/protobuf/plugin/testgen