1// Code generated by protoc-gen-gogo. DO NOT EDIT. 2// source: metrics.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 TestMetricsProto(t *testing.T) { 22 seed := time.Now().UnixNano() 23 popr := math_rand.New(math_rand.NewSource(seed)) 24 p := NewPopulatedMetrics(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 := &Metrics{} 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 TestMetricsMarshalTo(t *testing.T) { 53 seed := time.Now().UnixNano() 54 popr := math_rand.New(math_rand.NewSource(seed)) 55 p := NewPopulatedMetrics(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 := &Metrics{} 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 TestMetricPointProto(t *testing.T) { 78 seed := time.Now().UnixNano() 79 popr := math_rand.New(math_rand.NewSource(seed)) 80 p := NewPopulatedMetricPoint(popr, false) 81 dAtA, err := github_com_golang_protobuf_proto.Marshal(p) 82 if err != nil { 83 t.Fatalf("seed = %d, err = %v", seed, err) 84 } 85 msg := &MetricPoint{} 86 if err := github_com_golang_protobuf_proto.Unmarshal(dAtA, msg); err != nil { 87 t.Fatalf("seed = %d, err = %v", seed, err) 88 } 89 littlefuzz := make([]byte, len(dAtA)) 90 copy(littlefuzz, dAtA) 91 for i := range dAtA { 92 dAtA[i] = byte(popr.Intn(256)) 93 } 94 if !p.Equal(msg) { 95 t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) 96 } 97 if len(littlefuzz) > 0 { 98 fuzzamount := 100 99 for i := 0; i < fuzzamount; i++ { 100 littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) 101 littlefuzz = append(littlefuzz, byte(popr.Intn(256))) 102 } 103 // shouldn't panic 104 _ = github_com_golang_protobuf_proto.Unmarshal(littlefuzz, msg) 105 } 106} 107 108func TestMetricPointMarshalTo(t *testing.T) { 109 seed := time.Now().UnixNano() 110 popr := math_rand.New(math_rand.NewSource(seed)) 111 p := NewPopulatedMetricPoint(popr, false) 112 size := p.Size() 113 dAtA := make([]byte, size) 114 for i := range dAtA { 115 dAtA[i] = byte(popr.Intn(256)) 116 } 117 _, err := p.MarshalTo(dAtA) 118 if err != nil { 119 t.Fatalf("seed = %d, err = %v", seed, err) 120 } 121 msg := &MetricPoint{} 122 if err := github_com_golang_protobuf_proto.Unmarshal(dAtA, msg); err != nil { 123 t.Fatalf("seed = %d, err = %v", seed, err) 124 } 125 for i := range dAtA { 126 dAtA[i] = byte(popr.Intn(256)) 127 } 128 if !p.Equal(msg) { 129 t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) 130 } 131} 132 133func TestMetricTagProto(t *testing.T) { 134 seed := time.Now().UnixNano() 135 popr := math_rand.New(math_rand.NewSource(seed)) 136 p := NewPopulatedMetricTag(popr, false) 137 dAtA, err := github_com_golang_protobuf_proto.Marshal(p) 138 if err != nil { 139 t.Fatalf("seed = %d, err = %v", seed, err) 140 } 141 msg := &MetricTag{} 142 if err := github_com_golang_protobuf_proto.Unmarshal(dAtA, msg); err != nil { 143 t.Fatalf("seed = %d, err = %v", seed, err) 144 } 145 littlefuzz := make([]byte, len(dAtA)) 146 copy(littlefuzz, dAtA) 147 for i := range dAtA { 148 dAtA[i] = byte(popr.Intn(256)) 149 } 150 if !p.Equal(msg) { 151 t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) 152 } 153 if len(littlefuzz) > 0 { 154 fuzzamount := 100 155 for i := 0; i < fuzzamount; i++ { 156 littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) 157 littlefuzz = append(littlefuzz, byte(popr.Intn(256))) 158 } 159 // shouldn't panic 160 _ = github_com_golang_protobuf_proto.Unmarshal(littlefuzz, msg) 161 } 162} 163 164func TestMetricTagMarshalTo(t *testing.T) { 165 seed := time.Now().UnixNano() 166 popr := math_rand.New(math_rand.NewSource(seed)) 167 p := NewPopulatedMetricTag(popr, false) 168 size := p.Size() 169 dAtA := make([]byte, size) 170 for i := range dAtA { 171 dAtA[i] = byte(popr.Intn(256)) 172 } 173 _, err := p.MarshalTo(dAtA) 174 if err != nil { 175 t.Fatalf("seed = %d, err = %v", seed, err) 176 } 177 msg := &MetricTag{} 178 if err := github_com_golang_protobuf_proto.Unmarshal(dAtA, msg); err != nil { 179 t.Fatalf("seed = %d, err = %v", seed, err) 180 } 181 for i := range dAtA { 182 dAtA[i] = byte(popr.Intn(256)) 183 } 184 if !p.Equal(msg) { 185 t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) 186 } 187} 188 189func TestMetricsJSON(t *testing.T) { 190 seed := time.Now().UnixNano() 191 popr := math_rand.New(math_rand.NewSource(seed)) 192 p := NewPopulatedMetrics(popr, true) 193 marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} 194 jsondata, err := marshaler.MarshalToString(p) 195 if err != nil { 196 t.Fatalf("seed = %d, err = %v", seed, err) 197 } 198 msg := &Metrics{} 199 err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) 200 if err != nil { 201 t.Fatalf("seed = %d, err = %v", seed, err) 202 } 203 if !p.Equal(msg) { 204 t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) 205 } 206} 207func TestMetricPointJSON(t *testing.T) { 208 seed := time.Now().UnixNano() 209 popr := math_rand.New(math_rand.NewSource(seed)) 210 p := NewPopulatedMetricPoint(popr, true) 211 marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} 212 jsondata, err := marshaler.MarshalToString(p) 213 if err != nil { 214 t.Fatalf("seed = %d, err = %v", seed, err) 215 } 216 msg := &MetricPoint{} 217 err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) 218 if err != nil { 219 t.Fatalf("seed = %d, err = %v", seed, err) 220 } 221 if !p.Equal(msg) { 222 t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) 223 } 224} 225func TestMetricTagJSON(t *testing.T) { 226 seed := time.Now().UnixNano() 227 popr := math_rand.New(math_rand.NewSource(seed)) 228 p := NewPopulatedMetricTag(popr, true) 229 marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} 230 jsondata, err := marshaler.MarshalToString(p) 231 if err != nil { 232 t.Fatalf("seed = %d, err = %v", seed, err) 233 } 234 msg := &MetricTag{} 235 err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) 236 if err != nil { 237 t.Fatalf("seed = %d, err = %v", seed, err) 238 } 239 if !p.Equal(msg) { 240 t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) 241 } 242} 243func TestMetricsProtoText(t *testing.T) { 244 seed := time.Now().UnixNano() 245 popr := math_rand.New(math_rand.NewSource(seed)) 246 p := NewPopulatedMetrics(popr, true) 247 dAtA := github_com_golang_protobuf_proto.MarshalTextString(p) 248 msg := &Metrics{} 249 if err := github_com_golang_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { 250 t.Fatalf("seed = %d, err = %v", seed, err) 251 } 252 if !p.Equal(msg) { 253 t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) 254 } 255} 256 257func TestMetricsProtoCompactText(t *testing.T) { 258 seed := time.Now().UnixNano() 259 popr := math_rand.New(math_rand.NewSource(seed)) 260 p := NewPopulatedMetrics(popr, true) 261 dAtA := github_com_golang_protobuf_proto.CompactTextString(p) 262 msg := &Metrics{} 263 if err := github_com_golang_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { 264 t.Fatalf("seed = %d, err = %v", seed, err) 265 } 266 if !p.Equal(msg) { 267 t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) 268 } 269} 270 271func TestMetricPointProtoText(t *testing.T) { 272 seed := time.Now().UnixNano() 273 popr := math_rand.New(math_rand.NewSource(seed)) 274 p := NewPopulatedMetricPoint(popr, true) 275 dAtA := github_com_golang_protobuf_proto.MarshalTextString(p) 276 msg := &MetricPoint{} 277 if err := github_com_golang_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { 278 t.Fatalf("seed = %d, err = %v", seed, err) 279 } 280 if !p.Equal(msg) { 281 t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) 282 } 283} 284 285func TestMetricPointProtoCompactText(t *testing.T) { 286 seed := time.Now().UnixNano() 287 popr := math_rand.New(math_rand.NewSource(seed)) 288 p := NewPopulatedMetricPoint(popr, true) 289 dAtA := github_com_golang_protobuf_proto.CompactTextString(p) 290 msg := &MetricPoint{} 291 if err := github_com_golang_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { 292 t.Fatalf("seed = %d, err = %v", seed, err) 293 } 294 if !p.Equal(msg) { 295 t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) 296 } 297} 298 299func TestMetricTagProtoText(t *testing.T) { 300 seed := time.Now().UnixNano() 301 popr := math_rand.New(math_rand.NewSource(seed)) 302 p := NewPopulatedMetricTag(popr, true) 303 dAtA := github_com_golang_protobuf_proto.MarshalTextString(p) 304 msg := &MetricTag{} 305 if err := github_com_golang_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { 306 t.Fatalf("seed = %d, err = %v", seed, err) 307 } 308 if !p.Equal(msg) { 309 t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) 310 } 311} 312 313func TestMetricTagProtoCompactText(t *testing.T) { 314 seed := time.Now().UnixNano() 315 popr := math_rand.New(math_rand.NewSource(seed)) 316 p := NewPopulatedMetricTag(popr, true) 317 dAtA := github_com_golang_protobuf_proto.CompactTextString(p) 318 msg := &MetricTag{} 319 if err := github_com_golang_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { 320 t.Fatalf("seed = %d, err = %v", seed, err) 321 } 322 if !p.Equal(msg) { 323 t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) 324 } 325} 326 327func TestMetricsSize(t *testing.T) { 328 seed := time.Now().UnixNano() 329 popr := math_rand.New(math_rand.NewSource(seed)) 330 p := NewPopulatedMetrics(popr, true) 331 size2 := github_com_golang_protobuf_proto.Size(p) 332 dAtA, err := github_com_golang_protobuf_proto.Marshal(p) 333 if err != nil { 334 t.Fatalf("seed = %d, err = %v", seed, err) 335 } 336 size := p.Size() 337 if len(dAtA) != size { 338 t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) 339 } 340 if size2 != size { 341 t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) 342 } 343 size3 := github_com_golang_protobuf_proto.Size(p) 344 if size3 != size { 345 t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) 346 } 347} 348 349func TestMetricPointSize(t *testing.T) { 350 seed := time.Now().UnixNano() 351 popr := math_rand.New(math_rand.NewSource(seed)) 352 p := NewPopulatedMetricPoint(popr, true) 353 size2 := github_com_golang_protobuf_proto.Size(p) 354 dAtA, err := github_com_golang_protobuf_proto.Marshal(p) 355 if err != nil { 356 t.Fatalf("seed = %d, err = %v", seed, err) 357 } 358 size := p.Size() 359 if len(dAtA) != size { 360 t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) 361 } 362 if size2 != size { 363 t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) 364 } 365 size3 := github_com_golang_protobuf_proto.Size(p) 366 if size3 != size { 367 t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) 368 } 369} 370 371func TestMetricTagSize(t *testing.T) { 372 seed := time.Now().UnixNano() 373 popr := math_rand.New(math_rand.NewSource(seed)) 374 p := NewPopulatedMetricTag(popr, true) 375 size2 := github_com_golang_protobuf_proto.Size(p) 376 dAtA, err := github_com_golang_protobuf_proto.Marshal(p) 377 if err != nil { 378 t.Fatalf("seed = %d, err = %v", seed, err) 379 } 380 size := p.Size() 381 if len(dAtA) != size { 382 t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) 383 } 384 if size2 != size { 385 t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) 386 } 387 size3 := github_com_golang_protobuf_proto.Size(p) 388 if size3 != size { 389 t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) 390 } 391} 392 393//These tests are generated by github.com/gogo/protobuf/plugin/testgen 394