1// Code generated by protoc-gen-gogo. DO NOT EDIT.
2// source: adhoc.proto
3
4package v2
5
6import testing "testing"
7import math_rand "math/rand"
8import time "time"
9import github_com_golang_protobuf_proto "github.com/golang/protobuf/proto"
10import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb"
11import proto "github.com/golang/protobuf/proto"
12import fmt "fmt"
13import math "math"
14import _ "github.com/gogo/protobuf/gogoproto"
15
16// Reference imports to suppress errors if they are not otherwise used.
17var _ = proto.Marshal
18var _ = fmt.Errorf
19var _ = math.Inf
20
21func TestAdhocRequestProto(t *testing.T) {
22	seed := time.Now().UnixNano()
23	popr := math_rand.New(math_rand.NewSource(seed))
24	p := NewPopulatedAdhocRequest(popr, false)
25	dAtA, err := github_com_golang_protobuf_proto.Marshal(p)
26	if err != nil {
27		t.Fatalf("seed = %d, err = %v", seed, err)
28	}
29	msg := &AdhocRequest{}
30	if err := github_com_golang_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
31		t.Fatalf("seed = %d, err = %v", seed, err)
32	}
33	littlefuzz := make([]byte, len(dAtA))
34	copy(littlefuzz, dAtA)
35	for i := range dAtA {
36		dAtA[i] = byte(popr.Intn(256))
37	}
38	if !p.Equal(msg) {
39		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
40	}
41	if len(littlefuzz) > 0 {
42		fuzzamount := 100
43		for i := 0; i < fuzzamount; i++ {
44			littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256))
45			littlefuzz = append(littlefuzz, byte(popr.Intn(256)))
46		}
47		// shouldn't panic
48		_ = github_com_golang_protobuf_proto.Unmarshal(littlefuzz, msg)
49	}
50}
51
52func TestAdhocRequestMarshalTo(t *testing.T) {
53	seed := time.Now().UnixNano()
54	popr := math_rand.New(math_rand.NewSource(seed))
55	p := NewPopulatedAdhocRequest(popr, false)
56	size := p.Size()
57	dAtA := make([]byte, size)
58	for i := range dAtA {
59		dAtA[i] = byte(popr.Intn(256))
60	}
61	_, err := p.MarshalTo(dAtA)
62	if err != nil {
63		t.Fatalf("seed = %d, err = %v", seed, err)
64	}
65	msg := &AdhocRequest{}
66	if err := github_com_golang_protobuf_proto.Unmarshal(dAtA, msg); err != nil {
67		t.Fatalf("seed = %d, err = %v", seed, err)
68	}
69	for i := range dAtA {
70		dAtA[i] = byte(popr.Intn(256))
71	}
72	if !p.Equal(msg) {
73		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
74	}
75}
76
77func TestAdhocRequestJSON(t *testing.T) {
78	seed := time.Now().UnixNano()
79	popr := math_rand.New(math_rand.NewSource(seed))
80	p := NewPopulatedAdhocRequest(popr, true)
81	marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{}
82	jsondata, err := marshaler.MarshalToString(p)
83	if err != nil {
84		t.Fatalf("seed = %d, err = %v", seed, err)
85	}
86	msg := &AdhocRequest{}
87	err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg)
88	if err != nil {
89		t.Fatalf("seed = %d, err = %v", seed, err)
90	}
91	if !p.Equal(msg) {
92		t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p)
93	}
94}
95func TestAdhocRequestProtoText(t *testing.T) {
96	seed := time.Now().UnixNano()
97	popr := math_rand.New(math_rand.NewSource(seed))
98	p := NewPopulatedAdhocRequest(popr, true)
99	dAtA := github_com_golang_protobuf_proto.MarshalTextString(p)
100	msg := &AdhocRequest{}
101	if err := github_com_golang_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
102		t.Fatalf("seed = %d, err = %v", seed, err)
103	}
104	if !p.Equal(msg) {
105		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
106	}
107}
108
109func TestAdhocRequestProtoCompactText(t *testing.T) {
110	seed := time.Now().UnixNano()
111	popr := math_rand.New(math_rand.NewSource(seed))
112	p := NewPopulatedAdhocRequest(popr, true)
113	dAtA := github_com_golang_protobuf_proto.CompactTextString(p)
114	msg := &AdhocRequest{}
115	if err := github_com_golang_protobuf_proto.UnmarshalText(dAtA, msg); err != nil {
116		t.Fatalf("seed = %d, err = %v", seed, err)
117	}
118	if !p.Equal(msg) {
119		t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p)
120	}
121}
122
123func TestAdhocRequestSize(t *testing.T) {
124	seed := time.Now().UnixNano()
125	popr := math_rand.New(math_rand.NewSource(seed))
126	p := NewPopulatedAdhocRequest(popr, true)
127	size2 := github_com_golang_protobuf_proto.Size(p)
128	dAtA, err := github_com_golang_protobuf_proto.Marshal(p)
129	if err != nil {
130		t.Fatalf("seed = %d, err = %v", seed, err)
131	}
132	size := p.Size()
133	if len(dAtA) != size {
134		t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA))
135	}
136	if size2 != size {
137		t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2)
138	}
139	size3 := github_com_golang_protobuf_proto.Size(p)
140	if size3 != size {
141		t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3)
142	}
143}
144
145//These tests are generated by github.com/gogo/protobuf/plugin/testgen
146