github.com/annchain/OG@v0.0.9/og/protocol/ogmessage/archive/messages_gen_test.go (about) 1 package archive 2 3 // Code generated by github.com/tinylib/msgp DO NOT EDIT. 4 5 import ( 6 "bytes" 7 "testing" 8 9 "github.com/tinylib/msgp/msgp" 10 ) 11 12 func TestMarshalUnmarshalMessageAnnsensus(t *testing.T) { 13 v := MessageAnnsensus{} 14 bts, err := v.MarshalMsg(nil) 15 if err != nil { 16 t.Fatal(err) 17 } 18 left, err := v.UnmarshalMsg(bts) 19 if err != nil { 20 t.Fatal(err) 21 } 22 if len(left) > 0 { 23 t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) 24 } 25 26 left, err = msgp.Skip(bts) 27 if err != nil { 28 t.Fatal(err) 29 } 30 if len(left) > 0 { 31 t.Errorf("%d bytes left over after Skip(): %q", len(left), left) 32 } 33 } 34 35 func BenchmarkMarshalMsgMessageAnnsensus(b *testing.B) { 36 v := MessageAnnsensus{} 37 b.ReportAllocs() 38 b.ResetTimer() 39 for i := 0; i < b.N; i++ { 40 v.MarshalMsg(nil) 41 } 42 } 43 44 func BenchmarkAppendMsgMessageAnnsensus(b *testing.B) { 45 v := MessageAnnsensus{} 46 bts := make([]byte, 0, v.Msgsize()) 47 bts, _ = v.MarshalMsg(bts[0:0]) 48 b.SetBytes(int64(len(bts))) 49 b.ReportAllocs() 50 b.ResetTimer() 51 for i := 0; i < b.N; i++ { 52 bts, _ = v.MarshalMsg(bts[0:0]) 53 } 54 } 55 56 func BenchmarkUnmarshalMessageAnnsensus(b *testing.B) { 57 v := MessageAnnsensus{} 58 bts, _ := v.MarshalMsg(nil) 59 b.ReportAllocs() 60 b.SetBytes(int64(len(bts))) 61 b.ResetTimer() 62 for i := 0; i < b.N; i++ { 63 _, err := v.UnmarshalMsg(bts) 64 if err != nil { 65 b.Fatal(err) 66 } 67 } 68 } 69 70 func TestEncodeDecodeMessageAnnsensus(t *testing.T) { 71 v := MessageAnnsensus{} 72 var buf bytes.Buffer 73 msgp.Encode(&buf, &v) 74 75 m := v.Msgsize() 76 if buf.Len() > m { 77 t.Log("WARNING: TestEncodeDecodeMessageAnnsensus Msgsize() is inaccurate") 78 } 79 80 vn := MessageAnnsensus{} 81 err := msgp.Decode(&buf, &vn) 82 if err != nil { 83 t.Error(err) 84 } 85 86 buf.Reset() 87 msgp.Encode(&buf, &v) 88 err = msgp.NewReader(&buf).Skip() 89 if err != nil { 90 t.Error(err) 91 } 92 } 93 94 func BenchmarkEncodeMessageAnnsensus(b *testing.B) { 95 v := MessageAnnsensus{} 96 var buf bytes.Buffer 97 msgp.Encode(&buf, &v) 98 b.SetBytes(int64(buf.Len())) 99 en := msgp.NewWriter(msgp.Nowhere) 100 b.ReportAllocs() 101 b.ResetTimer() 102 for i := 0; i < b.N; i++ { 103 v.EncodeMsg(en) 104 } 105 en.Flush() 106 } 107 108 func BenchmarkDecodeMessageAnnsensus(b *testing.B) { 109 v := MessageAnnsensus{} 110 var buf bytes.Buffer 111 msgp.Encode(&buf, &v) 112 b.SetBytes(int64(buf.Len())) 113 rd := msgp.NewEndlessReader(buf.Bytes(), b) 114 dc := msgp.NewReader(rd) 115 b.ReportAllocs() 116 b.ResetTimer() 117 for i := 0; i < b.N; i++ { 118 err := v.DecodeMsg(dc) 119 if err != nil { 120 b.Fatal(err) 121 } 122 } 123 } 124 125 func TestMarshalUnmarshalMessageBodiesRequest(t *testing.T) { 126 v := MessageBodiesRequest{} 127 bts, err := v.MarshalMsg(nil) 128 if err != nil { 129 t.Fatal(err) 130 } 131 left, err := v.UnmarshalMsg(bts) 132 if err != nil { 133 t.Fatal(err) 134 } 135 if len(left) > 0 { 136 t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) 137 } 138 139 left, err = msgp.Skip(bts) 140 if err != nil { 141 t.Fatal(err) 142 } 143 if len(left) > 0 { 144 t.Errorf("%d bytes left over after Skip(): %q", len(left), left) 145 } 146 } 147 148 func BenchmarkMarshalMsgMessageBodiesRequest(b *testing.B) { 149 v := MessageBodiesRequest{} 150 b.ReportAllocs() 151 b.ResetTimer() 152 for i := 0; i < b.N; i++ { 153 v.MarshalMsg(nil) 154 } 155 } 156 157 func BenchmarkAppendMsgMessageBodiesRequest(b *testing.B) { 158 v := MessageBodiesRequest{} 159 bts := make([]byte, 0, v.Msgsize()) 160 bts, _ = v.MarshalMsg(bts[0:0]) 161 b.SetBytes(int64(len(bts))) 162 b.ReportAllocs() 163 b.ResetTimer() 164 for i := 0; i < b.N; i++ { 165 bts, _ = v.MarshalMsg(bts[0:0]) 166 } 167 } 168 169 func BenchmarkUnmarshalMessageBodiesRequest(b *testing.B) { 170 v := MessageBodiesRequest{} 171 bts, _ := v.MarshalMsg(nil) 172 b.ReportAllocs() 173 b.SetBytes(int64(len(bts))) 174 b.ResetTimer() 175 for i := 0; i < b.N; i++ { 176 _, err := v.UnmarshalMsg(bts) 177 if err != nil { 178 b.Fatal(err) 179 } 180 } 181 } 182 183 func TestEncodeDecodeMessageBodiesRequest(t *testing.T) { 184 v := MessageBodiesRequest{} 185 var buf bytes.Buffer 186 msgp.Encode(&buf, &v) 187 188 m := v.Msgsize() 189 if buf.Len() > m { 190 t.Log("WARNING: TestEncodeDecodeMessageBodiesRequest Msgsize() is inaccurate") 191 } 192 193 vn := MessageBodiesRequest{} 194 err := msgp.Decode(&buf, &vn) 195 if err != nil { 196 t.Error(err) 197 } 198 199 buf.Reset() 200 msgp.Encode(&buf, &v) 201 err = msgp.NewReader(&buf).Skip() 202 if err != nil { 203 t.Error(err) 204 } 205 } 206 207 func BenchmarkEncodeMessageBodiesRequest(b *testing.B) { 208 v := MessageBodiesRequest{} 209 var buf bytes.Buffer 210 msgp.Encode(&buf, &v) 211 b.SetBytes(int64(buf.Len())) 212 en := msgp.NewWriter(msgp.Nowhere) 213 b.ReportAllocs() 214 b.ResetTimer() 215 for i := 0; i < b.N; i++ { 216 v.EncodeMsg(en) 217 } 218 en.Flush() 219 } 220 221 func BenchmarkDecodeMessageBodiesRequest(b *testing.B) { 222 v := MessageBodiesRequest{} 223 var buf bytes.Buffer 224 msgp.Encode(&buf, &v) 225 b.SetBytes(int64(buf.Len())) 226 rd := msgp.NewEndlessReader(buf.Bytes(), b) 227 dc := msgp.NewReader(rd) 228 b.ReportAllocs() 229 b.ResetTimer() 230 for i := 0; i < b.N; i++ { 231 err := v.DecodeMsg(dc) 232 if err != nil { 233 b.Fatal(err) 234 } 235 } 236 } 237 238 func TestMarshalUnmarshalMessageBodiesResponse(t *testing.T) { 239 v := MessageBodiesResponse{} 240 bts, err := v.MarshalMsg(nil) 241 if err != nil { 242 t.Fatal(err) 243 } 244 left, err := v.UnmarshalMsg(bts) 245 if err != nil { 246 t.Fatal(err) 247 } 248 if len(left) > 0 { 249 t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) 250 } 251 252 left, err = msgp.Skip(bts) 253 if err != nil { 254 t.Fatal(err) 255 } 256 if len(left) > 0 { 257 t.Errorf("%d bytes left over after Skip(): %q", len(left), left) 258 } 259 } 260 261 func BenchmarkMarshalMsgMessageBodiesResponse(b *testing.B) { 262 v := MessageBodiesResponse{} 263 b.ReportAllocs() 264 b.ResetTimer() 265 for i := 0; i < b.N; i++ { 266 v.MarshalMsg(nil) 267 } 268 } 269 270 func BenchmarkAppendMsgMessageBodiesResponse(b *testing.B) { 271 v := MessageBodiesResponse{} 272 bts := make([]byte, 0, v.Msgsize()) 273 bts, _ = v.MarshalMsg(bts[0:0]) 274 b.SetBytes(int64(len(bts))) 275 b.ReportAllocs() 276 b.ResetTimer() 277 for i := 0; i < b.N; i++ { 278 bts, _ = v.MarshalMsg(bts[0:0]) 279 } 280 } 281 282 func BenchmarkUnmarshalMessageBodiesResponse(b *testing.B) { 283 v := MessageBodiesResponse{} 284 bts, _ := v.MarshalMsg(nil) 285 b.ReportAllocs() 286 b.SetBytes(int64(len(bts))) 287 b.ResetTimer() 288 for i := 0; i < b.N; i++ { 289 _, err := v.UnmarshalMsg(bts) 290 if err != nil { 291 b.Fatal(err) 292 } 293 } 294 } 295 296 func TestEncodeDecodeMessageBodiesResponse(t *testing.T) { 297 v := MessageBodiesResponse{} 298 var buf bytes.Buffer 299 msgp.Encode(&buf, &v) 300 301 m := v.Msgsize() 302 if buf.Len() > m { 303 t.Log("WARNING: TestEncodeDecodeMessageBodiesResponse Msgsize() is inaccurate") 304 } 305 306 vn := MessageBodiesResponse{} 307 err := msgp.Decode(&buf, &vn) 308 if err != nil { 309 t.Error(err) 310 } 311 312 buf.Reset() 313 msgp.Encode(&buf, &v) 314 err = msgp.NewReader(&buf).Skip() 315 if err != nil { 316 t.Error(err) 317 } 318 } 319 320 func BenchmarkEncodeMessageBodiesResponse(b *testing.B) { 321 v := MessageBodiesResponse{} 322 var buf bytes.Buffer 323 msgp.Encode(&buf, &v) 324 b.SetBytes(int64(buf.Len())) 325 en := msgp.NewWriter(msgp.Nowhere) 326 b.ReportAllocs() 327 b.ResetTimer() 328 for i := 0; i < b.N; i++ { 329 v.EncodeMsg(en) 330 } 331 en.Flush() 332 } 333 334 func BenchmarkDecodeMessageBodiesResponse(b *testing.B) { 335 v := MessageBodiesResponse{} 336 var buf bytes.Buffer 337 msgp.Encode(&buf, &v) 338 b.SetBytes(int64(buf.Len())) 339 rd := msgp.NewEndlessReader(buf.Bytes(), b) 340 dc := msgp.NewReader(rd) 341 b.ReportAllocs() 342 b.ResetTimer() 343 for i := 0; i < b.N; i++ { 344 err := v.DecodeMsg(dc) 345 if err != nil { 346 b.Fatal(err) 347 } 348 } 349 } 350 351 func TestMarshalUnmarshalMessageControl(t *testing.T) { 352 v := MessageControl{} 353 bts, err := v.MarshalMsg(nil) 354 if err != nil { 355 t.Fatal(err) 356 } 357 left, err := v.UnmarshalMsg(bts) 358 if err != nil { 359 t.Fatal(err) 360 } 361 if len(left) > 0 { 362 t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) 363 } 364 365 left, err = msgp.Skip(bts) 366 if err != nil { 367 t.Fatal(err) 368 } 369 if len(left) > 0 { 370 t.Errorf("%d bytes left over after Skip(): %q", len(left), left) 371 } 372 } 373 374 func BenchmarkMarshalMsgMessageControl(b *testing.B) { 375 v := MessageControl{} 376 b.ReportAllocs() 377 b.ResetTimer() 378 for i := 0; i < b.N; i++ { 379 v.MarshalMsg(nil) 380 } 381 } 382 383 func BenchmarkAppendMsgMessageControl(b *testing.B) { 384 v := MessageControl{} 385 bts := make([]byte, 0, v.Msgsize()) 386 bts, _ = v.MarshalMsg(bts[0:0]) 387 b.SetBytes(int64(len(bts))) 388 b.ReportAllocs() 389 b.ResetTimer() 390 for i := 0; i < b.N; i++ { 391 bts, _ = v.MarshalMsg(bts[0:0]) 392 } 393 } 394 395 func BenchmarkUnmarshalMessageControl(b *testing.B) { 396 v := MessageControl{} 397 bts, _ := v.MarshalMsg(nil) 398 b.ReportAllocs() 399 b.SetBytes(int64(len(bts))) 400 b.ResetTimer() 401 for i := 0; i < b.N; i++ { 402 _, err := v.UnmarshalMsg(bts) 403 if err != nil { 404 b.Fatal(err) 405 } 406 } 407 } 408 409 func TestEncodeDecodeMessageControl(t *testing.T) { 410 v := MessageControl{} 411 var buf bytes.Buffer 412 msgp.Encode(&buf, &v) 413 414 m := v.Msgsize() 415 if buf.Len() > m { 416 t.Log("WARNING: TestEncodeDecodeMessageControl Msgsize() is inaccurate") 417 } 418 419 vn := MessageControl{} 420 err := msgp.Decode(&buf, &vn) 421 if err != nil { 422 t.Error(err) 423 } 424 425 buf.Reset() 426 msgp.Encode(&buf, &v) 427 err = msgp.NewReader(&buf).Skip() 428 if err != nil { 429 t.Error(err) 430 } 431 } 432 433 func BenchmarkEncodeMessageControl(b *testing.B) { 434 v := MessageControl{} 435 var buf bytes.Buffer 436 msgp.Encode(&buf, &v) 437 b.SetBytes(int64(buf.Len())) 438 en := msgp.NewWriter(msgp.Nowhere) 439 b.ReportAllocs() 440 b.ResetTimer() 441 for i := 0; i < b.N; i++ { 442 v.EncodeMsg(en) 443 } 444 en.Flush() 445 } 446 447 func BenchmarkDecodeMessageControl(b *testing.B) { 448 v := MessageControl{} 449 var buf bytes.Buffer 450 msgp.Encode(&buf, &v) 451 b.SetBytes(int64(buf.Len())) 452 rd := msgp.NewEndlessReader(buf.Bytes(), b) 453 dc := msgp.NewReader(rd) 454 b.ReportAllocs() 455 b.ResetTimer() 456 for i := 0; i < b.N; i++ { 457 err := v.DecodeMsg(dc) 458 if err != nil { 459 b.Fatal(err) 460 } 461 } 462 } 463 464 func TestMarshalUnmarshalMessageGetMsg(t *testing.T) { 465 v := MessageGetMsg{} 466 bts, err := v.MarshalMsg(nil) 467 if err != nil { 468 t.Fatal(err) 469 } 470 left, err := v.UnmarshalMsg(bts) 471 if err != nil { 472 t.Fatal(err) 473 } 474 if len(left) > 0 { 475 t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) 476 } 477 478 left, err = msgp.Skip(bts) 479 if err != nil { 480 t.Fatal(err) 481 } 482 if len(left) > 0 { 483 t.Errorf("%d bytes left over after Skip(): %q", len(left), left) 484 } 485 } 486 487 func BenchmarkMarshalMsgMessageGetMsg(b *testing.B) { 488 v := MessageGetMsg{} 489 b.ReportAllocs() 490 b.ResetTimer() 491 for i := 0; i < b.N; i++ { 492 v.MarshalMsg(nil) 493 } 494 } 495 496 func BenchmarkAppendMsgMessageGetMsg(b *testing.B) { 497 v := MessageGetMsg{} 498 bts := make([]byte, 0, v.Msgsize()) 499 bts, _ = v.MarshalMsg(bts[0:0]) 500 b.SetBytes(int64(len(bts))) 501 b.ReportAllocs() 502 b.ResetTimer() 503 for i := 0; i < b.N; i++ { 504 bts, _ = v.MarshalMsg(bts[0:0]) 505 } 506 } 507 508 func BenchmarkUnmarshalMessageGetMsg(b *testing.B) { 509 v := MessageGetMsg{} 510 bts, _ := v.MarshalMsg(nil) 511 b.ReportAllocs() 512 b.SetBytes(int64(len(bts))) 513 b.ResetTimer() 514 for i := 0; i < b.N; i++ { 515 _, err := v.UnmarshalMsg(bts) 516 if err != nil { 517 b.Fatal(err) 518 } 519 } 520 } 521 522 func TestEncodeDecodeMessageGetMsg(t *testing.T) { 523 v := MessageGetMsg{} 524 var buf bytes.Buffer 525 msgp.Encode(&buf, &v) 526 527 m := v.Msgsize() 528 if buf.Len() > m { 529 t.Log("WARNING: TestEncodeDecodeMessageGetMsg Msgsize() is inaccurate") 530 } 531 532 vn := MessageGetMsg{} 533 err := msgp.Decode(&buf, &vn) 534 if err != nil { 535 t.Error(err) 536 } 537 538 buf.Reset() 539 msgp.Encode(&buf, &v) 540 err = msgp.NewReader(&buf).Skip() 541 if err != nil { 542 t.Error(err) 543 } 544 } 545 546 func BenchmarkEncodeMessageGetMsg(b *testing.B) { 547 v := MessageGetMsg{} 548 var buf bytes.Buffer 549 msgp.Encode(&buf, &v) 550 b.SetBytes(int64(buf.Len())) 551 en := msgp.NewWriter(msgp.Nowhere) 552 b.ReportAllocs() 553 b.ResetTimer() 554 for i := 0; i < b.N; i++ { 555 v.EncodeMsg(en) 556 } 557 en.Flush() 558 } 559 560 func BenchmarkDecodeMessageGetMsg(b *testing.B) { 561 v := MessageGetMsg{} 562 var buf bytes.Buffer 563 msgp.Encode(&buf, &v) 564 b.SetBytes(int64(buf.Len())) 565 rd := msgp.NewEndlessReader(buf.Bytes(), b) 566 dc := msgp.NewReader(rd) 567 b.ReportAllocs() 568 b.ResetTimer() 569 for i := 0; i < b.N; i++ { 570 err := v.DecodeMsg(dc) 571 if err != nil { 572 b.Fatal(err) 573 } 574 } 575 } 576 577 func TestMarshalUnmarshalMessageHeaderRequest(t *testing.T) { 578 v := MessageHeaderRequest{} 579 bts, err := v.MarshalMsg(nil) 580 if err != nil { 581 t.Fatal(err) 582 } 583 left, err := v.UnmarshalMsg(bts) 584 if err != nil { 585 t.Fatal(err) 586 } 587 if len(left) > 0 { 588 t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) 589 } 590 591 left, err = msgp.Skip(bts) 592 if err != nil { 593 t.Fatal(err) 594 } 595 if len(left) > 0 { 596 t.Errorf("%d bytes left over after Skip(): %q", len(left), left) 597 } 598 } 599 600 func BenchmarkMarshalMsgMessageHeaderRequest(b *testing.B) { 601 v := MessageHeaderRequest{} 602 b.ReportAllocs() 603 b.ResetTimer() 604 for i := 0; i < b.N; i++ { 605 v.MarshalMsg(nil) 606 } 607 } 608 609 func BenchmarkAppendMsgMessageHeaderRequest(b *testing.B) { 610 v := MessageHeaderRequest{} 611 bts := make([]byte, 0, v.Msgsize()) 612 bts, _ = v.MarshalMsg(bts[0:0]) 613 b.SetBytes(int64(len(bts))) 614 b.ReportAllocs() 615 b.ResetTimer() 616 for i := 0; i < b.N; i++ { 617 bts, _ = v.MarshalMsg(bts[0:0]) 618 } 619 } 620 621 func BenchmarkUnmarshalMessageHeaderRequest(b *testing.B) { 622 v := MessageHeaderRequest{} 623 bts, _ := v.MarshalMsg(nil) 624 b.ReportAllocs() 625 b.SetBytes(int64(len(bts))) 626 b.ResetTimer() 627 for i := 0; i < b.N; i++ { 628 _, err := v.UnmarshalMsg(bts) 629 if err != nil { 630 b.Fatal(err) 631 } 632 } 633 } 634 635 func TestEncodeDecodeMessageHeaderRequest(t *testing.T) { 636 v := MessageHeaderRequest{} 637 var buf bytes.Buffer 638 msgp.Encode(&buf, &v) 639 640 m := v.Msgsize() 641 if buf.Len() > m { 642 t.Log("WARNING: TestEncodeDecodeMessageHeaderRequest Msgsize() is inaccurate") 643 } 644 645 vn := MessageHeaderRequest{} 646 err := msgp.Decode(&buf, &vn) 647 if err != nil { 648 t.Error(err) 649 } 650 651 buf.Reset() 652 msgp.Encode(&buf, &v) 653 err = msgp.NewReader(&buf).Skip() 654 if err != nil { 655 t.Error(err) 656 } 657 } 658 659 func BenchmarkEncodeMessageHeaderRequest(b *testing.B) { 660 v := MessageHeaderRequest{} 661 var buf bytes.Buffer 662 msgp.Encode(&buf, &v) 663 b.SetBytes(int64(buf.Len())) 664 en := msgp.NewWriter(msgp.Nowhere) 665 b.ReportAllocs() 666 b.ResetTimer() 667 for i := 0; i < b.N; i++ { 668 v.EncodeMsg(en) 669 } 670 en.Flush() 671 } 672 673 func BenchmarkDecodeMessageHeaderRequest(b *testing.B) { 674 v := MessageHeaderRequest{} 675 var buf bytes.Buffer 676 msgp.Encode(&buf, &v) 677 b.SetBytes(int64(buf.Len())) 678 rd := msgp.NewEndlessReader(buf.Bytes(), b) 679 dc := msgp.NewReader(rd) 680 b.ReportAllocs() 681 b.ResetTimer() 682 for i := 0; i < b.N; i++ { 683 err := v.DecodeMsg(dc) 684 if err != nil { 685 b.Fatal(err) 686 } 687 } 688 } 689 690 func TestMarshalUnmarshalMessageHeaderResponse(t *testing.T) { 691 v := MessageHeaderResponse{} 692 bts, err := v.MarshalMsg(nil) 693 if err != nil { 694 t.Fatal(err) 695 } 696 left, err := v.UnmarshalMsg(bts) 697 if err != nil { 698 t.Fatal(err) 699 } 700 if len(left) > 0 { 701 t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) 702 } 703 704 left, err = msgp.Skip(bts) 705 if err != nil { 706 t.Fatal(err) 707 } 708 if len(left) > 0 { 709 t.Errorf("%d bytes left over after Skip(): %q", len(left), left) 710 } 711 } 712 713 func BenchmarkMarshalMsgMessageHeaderResponse(b *testing.B) { 714 v := MessageHeaderResponse{} 715 b.ReportAllocs() 716 b.ResetTimer() 717 for i := 0; i < b.N; i++ { 718 v.MarshalMsg(nil) 719 } 720 } 721 722 func BenchmarkAppendMsgMessageHeaderResponse(b *testing.B) { 723 v := MessageHeaderResponse{} 724 bts := make([]byte, 0, v.Msgsize()) 725 bts, _ = v.MarshalMsg(bts[0:0]) 726 b.SetBytes(int64(len(bts))) 727 b.ReportAllocs() 728 b.ResetTimer() 729 for i := 0; i < b.N; i++ { 730 bts, _ = v.MarshalMsg(bts[0:0]) 731 } 732 } 733 734 func BenchmarkUnmarshalMessageHeaderResponse(b *testing.B) { 735 v := MessageHeaderResponse{} 736 bts, _ := v.MarshalMsg(nil) 737 b.ReportAllocs() 738 b.SetBytes(int64(len(bts))) 739 b.ResetTimer() 740 for i := 0; i < b.N; i++ { 741 _, err := v.UnmarshalMsg(bts) 742 if err != nil { 743 b.Fatal(err) 744 } 745 } 746 } 747 748 func TestEncodeDecodeMessageHeaderResponse(t *testing.T) { 749 v := MessageHeaderResponse{} 750 var buf bytes.Buffer 751 msgp.Encode(&buf, &v) 752 753 m := v.Msgsize() 754 if buf.Len() > m { 755 t.Log("WARNING: TestEncodeDecodeMessageHeaderResponse Msgsize() is inaccurate") 756 } 757 758 vn := MessageHeaderResponse{} 759 err := msgp.Decode(&buf, &vn) 760 if err != nil { 761 t.Error(err) 762 } 763 764 buf.Reset() 765 msgp.Encode(&buf, &v) 766 err = msgp.NewReader(&buf).Skip() 767 if err != nil { 768 t.Error(err) 769 } 770 } 771 772 func BenchmarkEncodeMessageHeaderResponse(b *testing.B) { 773 v := MessageHeaderResponse{} 774 var buf bytes.Buffer 775 msgp.Encode(&buf, &v) 776 b.SetBytes(int64(buf.Len())) 777 en := msgp.NewWriter(msgp.Nowhere) 778 b.ReportAllocs() 779 b.ResetTimer() 780 for i := 0; i < b.N; i++ { 781 v.EncodeMsg(en) 782 } 783 en.Flush() 784 } 785 786 func BenchmarkDecodeMessageHeaderResponse(b *testing.B) { 787 v := MessageHeaderResponse{} 788 var buf bytes.Buffer 789 msgp.Encode(&buf, &v) 790 b.SetBytes(int64(buf.Len())) 791 rd := msgp.NewEndlessReader(buf.Bytes(), b) 792 dc := msgp.NewReader(rd) 793 b.ReportAllocs() 794 b.ResetTimer() 795 for i := 0; i < b.N; i++ { 796 err := v.DecodeMsg(dc) 797 if err != nil { 798 b.Fatal(err) 799 } 800 } 801 } 802 803 func TestMarshalUnmarshalMessageNewActionTx(t *testing.T) { 804 v := MessageNewActionTx{} 805 bts, err := v.MarshalMsg(nil) 806 if err != nil { 807 t.Fatal(err) 808 } 809 left, err := v.UnmarshalMsg(bts) 810 if err != nil { 811 t.Fatal(err) 812 } 813 if len(left) > 0 { 814 t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) 815 } 816 817 left, err = msgp.Skip(bts) 818 if err != nil { 819 t.Fatal(err) 820 } 821 if len(left) > 0 { 822 t.Errorf("%d bytes left over after Skip(): %q", len(left), left) 823 } 824 } 825 826 func BenchmarkMarshalMsgMessageNewActionTx(b *testing.B) { 827 v := MessageNewActionTx{} 828 b.ReportAllocs() 829 b.ResetTimer() 830 for i := 0; i < b.N; i++ { 831 v.MarshalMsg(nil) 832 } 833 } 834 835 func BenchmarkAppendMsgMessageNewActionTx(b *testing.B) { 836 v := MessageNewActionTx{} 837 bts := make([]byte, 0, v.Msgsize()) 838 bts, _ = v.MarshalMsg(bts[0:0]) 839 b.SetBytes(int64(len(bts))) 840 b.ReportAllocs() 841 b.ResetTimer() 842 for i := 0; i < b.N; i++ { 843 bts, _ = v.MarshalMsg(bts[0:0]) 844 } 845 } 846 847 func BenchmarkUnmarshalMessageNewActionTx(b *testing.B) { 848 v := MessageNewActionTx{} 849 bts, _ := v.MarshalMsg(nil) 850 b.ReportAllocs() 851 b.SetBytes(int64(len(bts))) 852 b.ResetTimer() 853 for i := 0; i < b.N; i++ { 854 _, err := v.UnmarshalMsg(bts) 855 if err != nil { 856 b.Fatal(err) 857 } 858 } 859 } 860 861 func TestEncodeDecodeMessageNewActionTx(t *testing.T) { 862 v := MessageNewActionTx{} 863 var buf bytes.Buffer 864 msgp.Encode(&buf, &v) 865 866 m := v.Msgsize() 867 if buf.Len() > m { 868 t.Log("WARNING: TestEncodeDecodeMessageNewActionTx Msgsize() is inaccurate") 869 } 870 871 vn := MessageNewActionTx{} 872 err := msgp.Decode(&buf, &vn) 873 if err != nil { 874 t.Error(err) 875 } 876 877 buf.Reset() 878 msgp.Encode(&buf, &v) 879 err = msgp.NewReader(&buf).Skip() 880 if err != nil { 881 t.Error(err) 882 } 883 } 884 885 func BenchmarkEncodeMessageNewActionTx(b *testing.B) { 886 v := MessageNewActionTx{} 887 var buf bytes.Buffer 888 msgp.Encode(&buf, &v) 889 b.SetBytes(int64(buf.Len())) 890 en := msgp.NewWriter(msgp.Nowhere) 891 b.ReportAllocs() 892 b.ResetTimer() 893 for i := 0; i < b.N; i++ { 894 v.EncodeMsg(en) 895 } 896 en.Flush() 897 } 898 899 func BenchmarkDecodeMessageNewActionTx(b *testing.B) { 900 v := MessageNewActionTx{} 901 var buf bytes.Buffer 902 msgp.Encode(&buf, &v) 903 b.SetBytes(int64(buf.Len())) 904 rd := msgp.NewEndlessReader(buf.Bytes(), b) 905 dc := msgp.NewReader(rd) 906 b.ReportAllocs() 907 b.ResetTimer() 908 for i := 0; i < b.N; i++ { 909 err := v.DecodeMsg(dc) 910 if err != nil { 911 b.Fatal(err) 912 } 913 } 914 } 915 916 func TestMarshalUnmarshalMessageNewSequencer(t *testing.T) { 917 v := MessageNewSequencer{} 918 bts, err := v.MarshalMsg(nil) 919 if err != nil { 920 t.Fatal(err) 921 } 922 left, err := v.UnmarshalMsg(bts) 923 if err != nil { 924 t.Fatal(err) 925 } 926 if len(left) > 0 { 927 t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) 928 } 929 930 left, err = msgp.Skip(bts) 931 if err != nil { 932 t.Fatal(err) 933 } 934 if len(left) > 0 { 935 t.Errorf("%d bytes left over after Skip(): %q", len(left), left) 936 } 937 } 938 939 func BenchmarkMarshalMsgMessageNewSequencer(b *testing.B) { 940 v := MessageNewSequencer{} 941 b.ReportAllocs() 942 b.ResetTimer() 943 for i := 0; i < b.N; i++ { 944 v.MarshalMsg(nil) 945 } 946 } 947 948 func BenchmarkAppendMsgMessageNewSequencer(b *testing.B) { 949 v := MessageNewSequencer{} 950 bts := make([]byte, 0, v.Msgsize()) 951 bts, _ = v.MarshalMsg(bts[0:0]) 952 b.SetBytes(int64(len(bts))) 953 b.ReportAllocs() 954 b.ResetTimer() 955 for i := 0; i < b.N; i++ { 956 bts, _ = v.MarshalMsg(bts[0:0]) 957 } 958 } 959 960 func BenchmarkUnmarshalMessageNewSequencer(b *testing.B) { 961 v := MessageNewSequencer{} 962 bts, _ := v.MarshalMsg(nil) 963 b.ReportAllocs() 964 b.SetBytes(int64(len(bts))) 965 b.ResetTimer() 966 for i := 0; i < b.N; i++ { 967 _, err := v.UnmarshalMsg(bts) 968 if err != nil { 969 b.Fatal(err) 970 } 971 } 972 } 973 974 func TestEncodeDecodeMessageNewSequencer(t *testing.T) { 975 v := MessageNewSequencer{} 976 var buf bytes.Buffer 977 msgp.Encode(&buf, &v) 978 979 m := v.Msgsize() 980 if buf.Len() > m { 981 t.Log("WARNING: TestEncodeDecodeMessageNewSequencer Msgsize() is inaccurate") 982 } 983 984 vn := MessageNewSequencer{} 985 err := msgp.Decode(&buf, &vn) 986 if err != nil { 987 t.Error(err) 988 } 989 990 buf.Reset() 991 msgp.Encode(&buf, &v) 992 err = msgp.NewReader(&buf).Skip() 993 if err != nil { 994 t.Error(err) 995 } 996 } 997 998 func BenchmarkEncodeMessageNewSequencer(b *testing.B) { 999 v := MessageNewSequencer{} 1000 var buf bytes.Buffer 1001 msgp.Encode(&buf, &v) 1002 b.SetBytes(int64(buf.Len())) 1003 en := msgp.NewWriter(msgp.Nowhere) 1004 b.ReportAllocs() 1005 b.ResetTimer() 1006 for i := 0; i < b.N; i++ { 1007 v.EncodeMsg(en) 1008 } 1009 en.Flush() 1010 } 1011 1012 func BenchmarkDecodeMessageNewSequencer(b *testing.B) { 1013 v := MessageNewSequencer{} 1014 var buf bytes.Buffer 1015 msgp.Encode(&buf, &v) 1016 b.SetBytes(int64(buf.Len())) 1017 rd := msgp.NewEndlessReader(buf.Bytes(), b) 1018 dc := msgp.NewReader(rd) 1019 b.ReportAllocs() 1020 b.ResetTimer() 1021 for i := 0; i < b.N; i++ { 1022 err := v.DecodeMsg(dc) 1023 if err != nil { 1024 b.Fatal(err) 1025 } 1026 } 1027 } 1028 1029 func TestMarshalUnmarshalMessageNewTx(t *testing.T) { 1030 v := MessageNewTx{} 1031 bts, err := v.MarshalMsg(nil) 1032 if err != nil { 1033 t.Fatal(err) 1034 } 1035 left, err := v.UnmarshalMsg(bts) 1036 if err != nil { 1037 t.Fatal(err) 1038 } 1039 if len(left) > 0 { 1040 t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) 1041 } 1042 1043 left, err = msgp.Skip(bts) 1044 if err != nil { 1045 t.Fatal(err) 1046 } 1047 if len(left) > 0 { 1048 t.Errorf("%d bytes left over after Skip(): %q", len(left), left) 1049 } 1050 } 1051 1052 func BenchmarkMarshalMsgMessageNewTx(b *testing.B) { 1053 v := MessageNewTx{} 1054 b.ReportAllocs() 1055 b.ResetTimer() 1056 for i := 0; i < b.N; i++ { 1057 v.MarshalMsg(nil) 1058 } 1059 } 1060 1061 func BenchmarkAppendMsgMessageNewTx(b *testing.B) { 1062 v := MessageNewTx{} 1063 bts := make([]byte, 0, v.Msgsize()) 1064 bts, _ = v.MarshalMsg(bts[0:0]) 1065 b.SetBytes(int64(len(bts))) 1066 b.ReportAllocs() 1067 b.ResetTimer() 1068 for i := 0; i < b.N; i++ { 1069 bts, _ = v.MarshalMsg(bts[0:0]) 1070 } 1071 } 1072 1073 func BenchmarkUnmarshalMessageNewTx(b *testing.B) { 1074 v := MessageNewTx{} 1075 bts, _ := v.MarshalMsg(nil) 1076 b.ReportAllocs() 1077 b.SetBytes(int64(len(bts))) 1078 b.ResetTimer() 1079 for i := 0; i < b.N; i++ { 1080 _, err := v.UnmarshalMsg(bts) 1081 if err != nil { 1082 b.Fatal(err) 1083 } 1084 } 1085 } 1086 1087 func TestEncodeDecodeMessageNewTx(t *testing.T) { 1088 v := MessageNewTx{} 1089 var buf bytes.Buffer 1090 msgp.Encode(&buf, &v) 1091 1092 m := v.Msgsize() 1093 if buf.Len() > m { 1094 t.Log("WARNING: TestEncodeDecodeMessageNewTx Msgsize() is inaccurate") 1095 } 1096 1097 vn := MessageNewTx{} 1098 err := msgp.Decode(&buf, &vn) 1099 if err != nil { 1100 t.Error(err) 1101 } 1102 1103 buf.Reset() 1104 msgp.Encode(&buf, &v) 1105 err = msgp.NewReader(&buf).Skip() 1106 if err != nil { 1107 t.Error(err) 1108 } 1109 } 1110 1111 func BenchmarkEncodeMessageNewTx(b *testing.B) { 1112 v := MessageNewTx{} 1113 var buf bytes.Buffer 1114 msgp.Encode(&buf, &v) 1115 b.SetBytes(int64(buf.Len())) 1116 en := msgp.NewWriter(msgp.Nowhere) 1117 b.ReportAllocs() 1118 b.ResetTimer() 1119 for i := 0; i < b.N; i++ { 1120 v.EncodeMsg(en) 1121 } 1122 en.Flush() 1123 } 1124 1125 func BenchmarkDecodeMessageNewTx(b *testing.B) { 1126 v := MessageNewTx{} 1127 var buf bytes.Buffer 1128 msgp.Encode(&buf, &v) 1129 b.SetBytes(int64(buf.Len())) 1130 rd := msgp.NewEndlessReader(buf.Bytes(), b) 1131 dc := msgp.NewReader(rd) 1132 b.ReportAllocs() 1133 b.ResetTimer() 1134 for i := 0; i < b.N; i++ { 1135 err := v.DecodeMsg(dc) 1136 if err != nil { 1137 b.Fatal(err) 1138 } 1139 } 1140 } 1141 1142 func TestMarshalUnmarshalMessageNewTxs(t *testing.T) { 1143 v := MessageNewTxs{} 1144 bts, err := v.MarshalMsg(nil) 1145 if err != nil { 1146 t.Fatal(err) 1147 } 1148 left, err := v.UnmarshalMsg(bts) 1149 if err != nil { 1150 t.Fatal(err) 1151 } 1152 if len(left) > 0 { 1153 t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) 1154 } 1155 1156 left, err = msgp.Skip(bts) 1157 if err != nil { 1158 t.Fatal(err) 1159 } 1160 if len(left) > 0 { 1161 t.Errorf("%d bytes left over after Skip(): %q", len(left), left) 1162 } 1163 } 1164 1165 func BenchmarkMarshalMsgMessageNewTxs(b *testing.B) { 1166 v := MessageNewTxs{} 1167 b.ReportAllocs() 1168 b.ResetTimer() 1169 for i := 0; i < b.N; i++ { 1170 v.MarshalMsg(nil) 1171 } 1172 } 1173 1174 func BenchmarkAppendMsgMessageNewTxs(b *testing.B) { 1175 v := MessageNewTxs{} 1176 bts := make([]byte, 0, v.Msgsize()) 1177 bts, _ = v.MarshalMsg(bts[0:0]) 1178 b.SetBytes(int64(len(bts))) 1179 b.ReportAllocs() 1180 b.ResetTimer() 1181 for i := 0; i < b.N; i++ { 1182 bts, _ = v.MarshalMsg(bts[0:0]) 1183 } 1184 } 1185 1186 func BenchmarkUnmarshalMessageNewTxs(b *testing.B) { 1187 v := MessageNewTxs{} 1188 bts, _ := v.MarshalMsg(nil) 1189 b.ReportAllocs() 1190 b.SetBytes(int64(len(bts))) 1191 b.ResetTimer() 1192 for i := 0; i < b.N; i++ { 1193 _, err := v.UnmarshalMsg(bts) 1194 if err != nil { 1195 b.Fatal(err) 1196 } 1197 } 1198 } 1199 1200 func TestEncodeDecodeMessageNewTxs(t *testing.T) { 1201 v := MessageNewTxs{} 1202 var buf bytes.Buffer 1203 msgp.Encode(&buf, &v) 1204 1205 m := v.Msgsize() 1206 if buf.Len() > m { 1207 t.Log("WARNING: TestEncodeDecodeMessageNewTxs Msgsize() is inaccurate") 1208 } 1209 1210 vn := MessageNewTxs{} 1211 err := msgp.Decode(&buf, &vn) 1212 if err != nil { 1213 t.Error(err) 1214 } 1215 1216 buf.Reset() 1217 msgp.Encode(&buf, &v) 1218 err = msgp.NewReader(&buf).Skip() 1219 if err != nil { 1220 t.Error(err) 1221 } 1222 } 1223 1224 func BenchmarkEncodeMessageNewTxs(b *testing.B) { 1225 v := MessageNewTxs{} 1226 var buf bytes.Buffer 1227 msgp.Encode(&buf, &v) 1228 b.SetBytes(int64(buf.Len())) 1229 en := msgp.NewWriter(msgp.Nowhere) 1230 b.ReportAllocs() 1231 b.ResetTimer() 1232 for i := 0; i < b.N; i++ { 1233 v.EncodeMsg(en) 1234 } 1235 en.Flush() 1236 } 1237 1238 func BenchmarkDecodeMessageNewTxs(b *testing.B) { 1239 v := MessageNewTxs{} 1240 var buf bytes.Buffer 1241 msgp.Encode(&buf, &v) 1242 b.SetBytes(int64(buf.Len())) 1243 rd := msgp.NewEndlessReader(buf.Bytes(), b) 1244 dc := msgp.NewReader(rd) 1245 b.ReportAllocs() 1246 b.ResetTimer() 1247 for i := 0; i < b.N; i++ { 1248 err := v.DecodeMsg(dc) 1249 if err != nil { 1250 b.Fatal(err) 1251 } 1252 } 1253 } 1254 1255 func TestMarshalUnmarshalMessagePing(t *testing.T) { 1256 v := MessagePing{} 1257 bts, err := v.MarshalMsg(nil) 1258 if err != nil { 1259 t.Fatal(err) 1260 } 1261 left, err := v.UnmarshalMsg(bts) 1262 if err != nil { 1263 t.Fatal(err) 1264 } 1265 if len(left) > 0 { 1266 t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) 1267 } 1268 1269 left, err = msgp.Skip(bts) 1270 if err != nil { 1271 t.Fatal(err) 1272 } 1273 if len(left) > 0 { 1274 t.Errorf("%d bytes left over after Skip(): %q", len(left), left) 1275 } 1276 } 1277 1278 func BenchmarkMarshalMsgMessagePing(b *testing.B) { 1279 v := MessagePing{} 1280 b.ReportAllocs() 1281 b.ResetTimer() 1282 for i := 0; i < b.N; i++ { 1283 v.MarshalMsg(nil) 1284 } 1285 } 1286 1287 func BenchmarkAppendMsgMessagePing(b *testing.B) { 1288 v := MessagePing{} 1289 bts := make([]byte, 0, v.Msgsize()) 1290 bts, _ = v.MarshalMsg(bts[0:0]) 1291 b.SetBytes(int64(len(bts))) 1292 b.ReportAllocs() 1293 b.ResetTimer() 1294 for i := 0; i < b.N; i++ { 1295 bts, _ = v.MarshalMsg(bts[0:0]) 1296 } 1297 } 1298 1299 func BenchmarkUnmarshalMessagePing(b *testing.B) { 1300 v := MessagePing{} 1301 bts, _ := v.MarshalMsg(nil) 1302 b.ReportAllocs() 1303 b.SetBytes(int64(len(bts))) 1304 b.ResetTimer() 1305 for i := 0; i < b.N; i++ { 1306 _, err := v.UnmarshalMsg(bts) 1307 if err != nil { 1308 b.Fatal(err) 1309 } 1310 } 1311 } 1312 1313 func TestEncodeDecodeMessagePing(t *testing.T) { 1314 v := MessagePing{} 1315 var buf bytes.Buffer 1316 msgp.Encode(&buf, &v) 1317 1318 m := v.Msgsize() 1319 if buf.Len() > m { 1320 t.Log("WARNING: TestEncodeDecodeMessagePing Msgsize() is inaccurate") 1321 } 1322 1323 vn := MessagePing{} 1324 err := msgp.Decode(&buf, &vn) 1325 if err != nil { 1326 t.Error(err) 1327 } 1328 1329 buf.Reset() 1330 msgp.Encode(&buf, &v) 1331 err = msgp.NewReader(&buf).Skip() 1332 if err != nil { 1333 t.Error(err) 1334 } 1335 } 1336 1337 func BenchmarkEncodeMessagePing(b *testing.B) { 1338 v := MessagePing{} 1339 var buf bytes.Buffer 1340 msgp.Encode(&buf, &v) 1341 b.SetBytes(int64(buf.Len())) 1342 en := msgp.NewWriter(msgp.Nowhere) 1343 b.ReportAllocs() 1344 b.ResetTimer() 1345 for i := 0; i < b.N; i++ { 1346 v.EncodeMsg(en) 1347 } 1348 en.Flush() 1349 } 1350 1351 func BenchmarkDecodeMessagePing(b *testing.B) { 1352 v := MessagePing{} 1353 var buf bytes.Buffer 1354 msgp.Encode(&buf, &v) 1355 b.SetBytes(int64(buf.Len())) 1356 rd := msgp.NewEndlessReader(buf.Bytes(), b) 1357 dc := msgp.NewReader(rd) 1358 b.ReportAllocs() 1359 b.ResetTimer() 1360 for i := 0; i < b.N; i++ { 1361 err := v.DecodeMsg(dc) 1362 if err != nil { 1363 b.Fatal(err) 1364 } 1365 } 1366 } 1367 1368 func TestMarshalUnmarshalMessagePong(t *testing.T) { 1369 v := MessagePong{} 1370 bts, err := v.MarshalMsg(nil) 1371 if err != nil { 1372 t.Fatal(err) 1373 } 1374 left, err := v.UnmarshalMsg(bts) 1375 if err != nil { 1376 t.Fatal(err) 1377 } 1378 if len(left) > 0 { 1379 t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) 1380 } 1381 1382 left, err = msgp.Skip(bts) 1383 if err != nil { 1384 t.Fatal(err) 1385 } 1386 if len(left) > 0 { 1387 t.Errorf("%d bytes left over after Skip(): %q", len(left), left) 1388 } 1389 } 1390 1391 func BenchmarkMarshalMsgMessagePong(b *testing.B) { 1392 v := MessagePong{} 1393 b.ReportAllocs() 1394 b.ResetTimer() 1395 for i := 0; i < b.N; i++ { 1396 v.MarshalMsg(nil) 1397 } 1398 } 1399 1400 func BenchmarkAppendMsgMessagePong(b *testing.B) { 1401 v := MessagePong{} 1402 bts := make([]byte, 0, v.Msgsize()) 1403 bts, _ = v.MarshalMsg(bts[0:0]) 1404 b.SetBytes(int64(len(bts))) 1405 b.ReportAllocs() 1406 b.ResetTimer() 1407 for i := 0; i < b.N; i++ { 1408 bts, _ = v.MarshalMsg(bts[0:0]) 1409 } 1410 } 1411 1412 func BenchmarkUnmarshalMessagePong(b *testing.B) { 1413 v := MessagePong{} 1414 bts, _ := v.MarshalMsg(nil) 1415 b.ReportAllocs() 1416 b.SetBytes(int64(len(bts))) 1417 b.ResetTimer() 1418 for i := 0; i < b.N; i++ { 1419 _, err := v.UnmarshalMsg(bts) 1420 if err != nil { 1421 b.Fatal(err) 1422 } 1423 } 1424 } 1425 1426 func TestEncodeDecodeMessagePong(t *testing.T) { 1427 v := MessagePong{} 1428 var buf bytes.Buffer 1429 msgp.Encode(&buf, &v) 1430 1431 m := v.Msgsize() 1432 if buf.Len() > m { 1433 t.Log("WARNING: TestEncodeDecodeMessagePong Msgsize() is inaccurate") 1434 } 1435 1436 vn := MessagePong{} 1437 err := msgp.Decode(&buf, &vn) 1438 if err != nil { 1439 t.Error(err) 1440 } 1441 1442 buf.Reset() 1443 msgp.Encode(&buf, &v) 1444 err = msgp.NewReader(&buf).Skip() 1445 if err != nil { 1446 t.Error(err) 1447 } 1448 } 1449 1450 func BenchmarkEncodeMessagePong(b *testing.B) { 1451 v := MessagePong{} 1452 var buf bytes.Buffer 1453 msgp.Encode(&buf, &v) 1454 b.SetBytes(int64(buf.Len())) 1455 en := msgp.NewWriter(msgp.Nowhere) 1456 b.ReportAllocs() 1457 b.ResetTimer() 1458 for i := 0; i < b.N; i++ { 1459 v.EncodeMsg(en) 1460 } 1461 en.Flush() 1462 } 1463 1464 func BenchmarkDecodeMessagePong(b *testing.B) { 1465 v := MessagePong{} 1466 var buf bytes.Buffer 1467 msgp.Encode(&buf, &v) 1468 b.SetBytes(int64(buf.Len())) 1469 rd := msgp.NewEndlessReader(buf.Bytes(), b) 1470 dc := msgp.NewReader(rd) 1471 b.ReportAllocs() 1472 b.ResetTimer() 1473 for i := 0; i < b.N; i++ { 1474 err := v.DecodeMsg(dc) 1475 if err != nil { 1476 b.Fatal(err) 1477 } 1478 } 1479 } 1480 1481 func TestMarshalUnmarshalMessageSequencerHeader(t *testing.T) { 1482 v := MessageSequencerHeader{} 1483 bts, err := v.MarshalMsg(nil) 1484 if err != nil { 1485 t.Fatal(err) 1486 } 1487 left, err := v.UnmarshalMsg(bts) 1488 if err != nil { 1489 t.Fatal(err) 1490 } 1491 if len(left) > 0 { 1492 t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) 1493 } 1494 1495 left, err = msgp.Skip(bts) 1496 if err != nil { 1497 t.Fatal(err) 1498 } 1499 if len(left) > 0 { 1500 t.Errorf("%d bytes left over after Skip(): %q", len(left), left) 1501 } 1502 } 1503 1504 func BenchmarkMarshalMsgMessageSequencerHeader(b *testing.B) { 1505 v := MessageSequencerHeader{} 1506 b.ReportAllocs() 1507 b.ResetTimer() 1508 for i := 0; i < b.N; i++ { 1509 v.MarshalMsg(nil) 1510 } 1511 } 1512 1513 func BenchmarkAppendMsgMessageSequencerHeader(b *testing.B) { 1514 v := MessageSequencerHeader{} 1515 bts := make([]byte, 0, v.Msgsize()) 1516 bts, _ = v.MarshalMsg(bts[0:0]) 1517 b.SetBytes(int64(len(bts))) 1518 b.ReportAllocs() 1519 b.ResetTimer() 1520 for i := 0; i < b.N; i++ { 1521 bts, _ = v.MarshalMsg(bts[0:0]) 1522 } 1523 } 1524 1525 func BenchmarkUnmarshalMessageSequencerHeader(b *testing.B) { 1526 v := MessageSequencerHeader{} 1527 bts, _ := v.MarshalMsg(nil) 1528 b.ReportAllocs() 1529 b.SetBytes(int64(len(bts))) 1530 b.ResetTimer() 1531 for i := 0; i < b.N; i++ { 1532 _, err := v.UnmarshalMsg(bts) 1533 if err != nil { 1534 b.Fatal(err) 1535 } 1536 } 1537 } 1538 1539 func TestEncodeDecodeMessageSequencerHeader(t *testing.T) { 1540 v := MessageSequencerHeader{} 1541 var buf bytes.Buffer 1542 msgp.Encode(&buf, &v) 1543 1544 m := v.Msgsize() 1545 if buf.Len() > m { 1546 t.Log("WARNING: TestEncodeDecodeMessageSequencerHeader Msgsize() is inaccurate") 1547 } 1548 1549 vn := MessageSequencerHeader{} 1550 err := msgp.Decode(&buf, &vn) 1551 if err != nil { 1552 t.Error(err) 1553 } 1554 1555 buf.Reset() 1556 msgp.Encode(&buf, &v) 1557 err = msgp.NewReader(&buf).Skip() 1558 if err != nil { 1559 t.Error(err) 1560 } 1561 } 1562 1563 func BenchmarkEncodeMessageSequencerHeader(b *testing.B) { 1564 v := MessageSequencerHeader{} 1565 var buf bytes.Buffer 1566 msgp.Encode(&buf, &v) 1567 b.SetBytes(int64(buf.Len())) 1568 en := msgp.NewWriter(msgp.Nowhere) 1569 b.ReportAllocs() 1570 b.ResetTimer() 1571 for i := 0; i < b.N; i++ { 1572 v.EncodeMsg(en) 1573 } 1574 en.Flush() 1575 } 1576 1577 func BenchmarkDecodeMessageSequencerHeader(b *testing.B) { 1578 v := MessageSequencerHeader{} 1579 var buf bytes.Buffer 1580 msgp.Encode(&buf, &v) 1581 b.SetBytes(int64(buf.Len())) 1582 rd := msgp.NewEndlessReader(buf.Bytes(), b) 1583 dc := msgp.NewReader(rd) 1584 b.ReportAllocs() 1585 b.ResetTimer() 1586 for i := 0; i < b.N; i++ { 1587 err := v.DecodeMsg(dc) 1588 if err != nil { 1589 b.Fatal(err) 1590 } 1591 } 1592 } 1593 1594 func TestMarshalUnmarshalMessageSyncRequest(t *testing.T) { 1595 v := MessageSyncRequest{} 1596 bts, err := v.MarshalMsg(nil) 1597 if err != nil { 1598 t.Fatal(err) 1599 } 1600 left, err := v.UnmarshalMsg(bts) 1601 if err != nil { 1602 t.Fatal(err) 1603 } 1604 if len(left) > 0 { 1605 t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) 1606 } 1607 1608 left, err = msgp.Skip(bts) 1609 if err != nil { 1610 t.Fatal(err) 1611 } 1612 if len(left) > 0 { 1613 t.Errorf("%d bytes left over after Skip(): %q", len(left), left) 1614 } 1615 } 1616 1617 func BenchmarkMarshalMsgMessageSyncRequest(b *testing.B) { 1618 v := MessageSyncRequest{} 1619 b.ReportAllocs() 1620 b.ResetTimer() 1621 for i := 0; i < b.N; i++ { 1622 v.MarshalMsg(nil) 1623 } 1624 } 1625 1626 func BenchmarkAppendMsgMessageSyncRequest(b *testing.B) { 1627 v := MessageSyncRequest{} 1628 bts := make([]byte, 0, v.Msgsize()) 1629 bts, _ = v.MarshalMsg(bts[0:0]) 1630 b.SetBytes(int64(len(bts))) 1631 b.ReportAllocs() 1632 b.ResetTimer() 1633 for i := 0; i < b.N; i++ { 1634 bts, _ = v.MarshalMsg(bts[0:0]) 1635 } 1636 } 1637 1638 func BenchmarkUnmarshalMessageSyncRequest(b *testing.B) { 1639 v := MessageSyncRequest{} 1640 bts, _ := v.MarshalMsg(nil) 1641 b.ReportAllocs() 1642 b.SetBytes(int64(len(bts))) 1643 b.ResetTimer() 1644 for i := 0; i < b.N; i++ { 1645 _, err := v.UnmarshalMsg(bts) 1646 if err != nil { 1647 b.Fatal(err) 1648 } 1649 } 1650 } 1651 1652 func TestEncodeDecodeMessageSyncRequest(t *testing.T) { 1653 v := MessageSyncRequest{} 1654 var buf bytes.Buffer 1655 msgp.Encode(&buf, &v) 1656 1657 m := v.Msgsize() 1658 if buf.Len() > m { 1659 t.Log("WARNING: TestEncodeDecodeMessageSyncRequest Msgsize() is inaccurate") 1660 } 1661 1662 vn := MessageSyncRequest{} 1663 err := msgp.Decode(&buf, &vn) 1664 if err != nil { 1665 t.Error(err) 1666 } 1667 1668 buf.Reset() 1669 msgp.Encode(&buf, &v) 1670 err = msgp.NewReader(&buf).Skip() 1671 if err != nil { 1672 t.Error(err) 1673 } 1674 } 1675 1676 func BenchmarkEncodeMessageSyncRequest(b *testing.B) { 1677 v := MessageSyncRequest{} 1678 var buf bytes.Buffer 1679 msgp.Encode(&buf, &v) 1680 b.SetBytes(int64(buf.Len())) 1681 en := msgp.NewWriter(msgp.Nowhere) 1682 b.ReportAllocs() 1683 b.ResetTimer() 1684 for i := 0; i < b.N; i++ { 1685 v.EncodeMsg(en) 1686 } 1687 en.Flush() 1688 } 1689 1690 func BenchmarkDecodeMessageSyncRequest(b *testing.B) { 1691 v := MessageSyncRequest{} 1692 var buf bytes.Buffer 1693 msgp.Encode(&buf, &v) 1694 b.SetBytes(int64(buf.Len())) 1695 rd := msgp.NewEndlessReader(buf.Bytes(), b) 1696 dc := msgp.NewReader(rd) 1697 b.ReportAllocs() 1698 b.ResetTimer() 1699 for i := 0; i < b.N; i++ { 1700 err := v.DecodeMsg(dc) 1701 if err != nil { 1702 b.Fatal(err) 1703 } 1704 } 1705 } 1706 1707 func TestMarshalUnmarshalMessageSyncResponse(t *testing.T) { 1708 v := MessageSyncResponse{} 1709 bts, err := v.MarshalMsg(nil) 1710 if err != nil { 1711 t.Fatal(err) 1712 } 1713 left, err := v.UnmarshalMsg(bts) 1714 if err != nil { 1715 t.Fatal(err) 1716 } 1717 if len(left) > 0 { 1718 t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) 1719 } 1720 1721 left, err = msgp.Skip(bts) 1722 if err != nil { 1723 t.Fatal(err) 1724 } 1725 if len(left) > 0 { 1726 t.Errorf("%d bytes left over after Skip(): %q", len(left), left) 1727 } 1728 } 1729 1730 func BenchmarkMarshalMsgMessageSyncResponse(b *testing.B) { 1731 v := MessageSyncResponse{} 1732 b.ReportAllocs() 1733 b.ResetTimer() 1734 for i := 0; i < b.N; i++ { 1735 v.MarshalMsg(nil) 1736 } 1737 } 1738 1739 func BenchmarkAppendMsgMessageSyncResponse(b *testing.B) { 1740 v := MessageSyncResponse{} 1741 bts := make([]byte, 0, v.Msgsize()) 1742 bts, _ = v.MarshalMsg(bts[0:0]) 1743 b.SetBytes(int64(len(bts))) 1744 b.ReportAllocs() 1745 b.ResetTimer() 1746 for i := 0; i < b.N; i++ { 1747 bts, _ = v.MarshalMsg(bts[0:0]) 1748 } 1749 } 1750 1751 func BenchmarkUnmarshalMessageSyncResponse(b *testing.B) { 1752 v := MessageSyncResponse{} 1753 bts, _ := v.MarshalMsg(nil) 1754 b.ReportAllocs() 1755 b.SetBytes(int64(len(bts))) 1756 b.ResetTimer() 1757 for i := 0; i < b.N; i++ { 1758 _, err := v.UnmarshalMsg(bts) 1759 if err != nil { 1760 b.Fatal(err) 1761 } 1762 } 1763 } 1764 1765 func TestEncodeDecodeMessageSyncResponse(t *testing.T) { 1766 v := MessageSyncResponse{} 1767 var buf bytes.Buffer 1768 msgp.Encode(&buf, &v) 1769 1770 m := v.Msgsize() 1771 if buf.Len() > m { 1772 t.Log("WARNING: TestEncodeDecodeMessageSyncResponse Msgsize() is inaccurate") 1773 } 1774 1775 vn := MessageSyncResponse{} 1776 err := msgp.Decode(&buf, &vn) 1777 if err != nil { 1778 t.Error(err) 1779 } 1780 1781 buf.Reset() 1782 msgp.Encode(&buf, &v) 1783 err = msgp.NewReader(&buf).Skip() 1784 if err != nil { 1785 t.Error(err) 1786 } 1787 } 1788 1789 func BenchmarkEncodeMessageSyncResponse(b *testing.B) { 1790 v := MessageSyncResponse{} 1791 var buf bytes.Buffer 1792 msgp.Encode(&buf, &v) 1793 b.SetBytes(int64(buf.Len())) 1794 en := msgp.NewWriter(msgp.Nowhere) 1795 b.ReportAllocs() 1796 b.ResetTimer() 1797 for i := 0; i < b.N; i++ { 1798 v.EncodeMsg(en) 1799 } 1800 en.Flush() 1801 } 1802 1803 func BenchmarkDecodeMessageSyncResponse(b *testing.B) { 1804 v := MessageSyncResponse{} 1805 var buf bytes.Buffer 1806 msgp.Encode(&buf, &v) 1807 b.SetBytes(int64(buf.Len())) 1808 rd := msgp.NewEndlessReader(buf.Bytes(), b) 1809 dc := msgp.NewReader(rd) 1810 b.ReportAllocs() 1811 b.ResetTimer() 1812 for i := 0; i < b.N; i++ { 1813 err := v.DecodeMsg(dc) 1814 if err != nil { 1815 b.Fatal(err) 1816 } 1817 } 1818 } 1819 1820 func TestMarshalUnmarshalMessageTxsRequest(t *testing.T) { 1821 v := MessageTxsRequest{} 1822 bts, err := v.MarshalMsg(nil) 1823 if err != nil { 1824 t.Fatal(err) 1825 } 1826 left, err := v.UnmarshalMsg(bts) 1827 if err != nil { 1828 t.Fatal(err) 1829 } 1830 if len(left) > 0 { 1831 t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) 1832 } 1833 1834 left, err = msgp.Skip(bts) 1835 if err != nil { 1836 t.Fatal(err) 1837 } 1838 if len(left) > 0 { 1839 t.Errorf("%d bytes left over after Skip(): %q", len(left), left) 1840 } 1841 } 1842 1843 func BenchmarkMarshalMsgMessageTxsRequest(b *testing.B) { 1844 v := MessageTxsRequest{} 1845 b.ReportAllocs() 1846 b.ResetTimer() 1847 for i := 0; i < b.N; i++ { 1848 v.MarshalMsg(nil) 1849 } 1850 } 1851 1852 func BenchmarkAppendMsgMessageTxsRequest(b *testing.B) { 1853 v := MessageTxsRequest{} 1854 bts := make([]byte, 0, v.Msgsize()) 1855 bts, _ = v.MarshalMsg(bts[0:0]) 1856 b.SetBytes(int64(len(bts))) 1857 b.ReportAllocs() 1858 b.ResetTimer() 1859 for i := 0; i < b.N; i++ { 1860 bts, _ = v.MarshalMsg(bts[0:0]) 1861 } 1862 } 1863 1864 func BenchmarkUnmarshalMessageTxsRequest(b *testing.B) { 1865 v := MessageTxsRequest{} 1866 bts, _ := v.MarshalMsg(nil) 1867 b.ReportAllocs() 1868 b.SetBytes(int64(len(bts))) 1869 b.ResetTimer() 1870 for i := 0; i < b.N; i++ { 1871 _, err := v.UnmarshalMsg(bts) 1872 if err != nil { 1873 b.Fatal(err) 1874 } 1875 } 1876 } 1877 1878 func TestEncodeDecodeMessageTxsRequest(t *testing.T) { 1879 v := MessageTxsRequest{} 1880 var buf bytes.Buffer 1881 msgp.Encode(&buf, &v) 1882 1883 m := v.Msgsize() 1884 if buf.Len() > m { 1885 t.Log("WARNING: TestEncodeDecodeMessageTxsRequest Msgsize() is inaccurate") 1886 } 1887 1888 vn := MessageTxsRequest{} 1889 err := msgp.Decode(&buf, &vn) 1890 if err != nil { 1891 t.Error(err) 1892 } 1893 1894 buf.Reset() 1895 msgp.Encode(&buf, &v) 1896 err = msgp.NewReader(&buf).Skip() 1897 if err != nil { 1898 t.Error(err) 1899 } 1900 } 1901 1902 func BenchmarkEncodeMessageTxsRequest(b *testing.B) { 1903 v := MessageTxsRequest{} 1904 var buf bytes.Buffer 1905 msgp.Encode(&buf, &v) 1906 b.SetBytes(int64(buf.Len())) 1907 en := msgp.NewWriter(msgp.Nowhere) 1908 b.ReportAllocs() 1909 b.ResetTimer() 1910 for i := 0; i < b.N; i++ { 1911 v.EncodeMsg(en) 1912 } 1913 en.Flush() 1914 } 1915 1916 func BenchmarkDecodeMessageTxsRequest(b *testing.B) { 1917 v := MessageTxsRequest{} 1918 var buf bytes.Buffer 1919 msgp.Encode(&buf, &v) 1920 b.SetBytes(int64(buf.Len())) 1921 rd := msgp.NewEndlessReader(buf.Bytes(), b) 1922 dc := msgp.NewReader(rd) 1923 b.ReportAllocs() 1924 b.ResetTimer() 1925 for i := 0; i < b.N; i++ { 1926 err := v.DecodeMsg(dc) 1927 if err != nil { 1928 b.Fatal(err) 1929 } 1930 } 1931 } 1932 1933 func TestMarshalUnmarshalMessageTxsResponse(t *testing.T) { 1934 v := MessageTxsResponse{} 1935 bts, err := v.MarshalMsg(nil) 1936 if err != nil { 1937 t.Fatal(err) 1938 } 1939 left, err := v.UnmarshalMsg(bts) 1940 if err != nil { 1941 t.Fatal(err) 1942 } 1943 if len(left) > 0 { 1944 t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left) 1945 } 1946 1947 left, err = msgp.Skip(bts) 1948 if err != nil { 1949 t.Fatal(err) 1950 } 1951 if len(left) > 0 { 1952 t.Errorf("%d bytes left over after Skip(): %q", len(left), left) 1953 } 1954 } 1955 1956 func BenchmarkMarshalMsgMessageTxsResponse(b *testing.B) { 1957 v := MessageTxsResponse{} 1958 b.ReportAllocs() 1959 b.ResetTimer() 1960 for i := 0; i < b.N; i++ { 1961 v.MarshalMsg(nil) 1962 } 1963 } 1964 1965 func BenchmarkAppendMsgMessageTxsResponse(b *testing.B) { 1966 v := MessageTxsResponse{} 1967 bts := make([]byte, 0, v.Msgsize()) 1968 bts, _ = v.MarshalMsg(bts[0:0]) 1969 b.SetBytes(int64(len(bts))) 1970 b.ReportAllocs() 1971 b.ResetTimer() 1972 for i := 0; i < b.N; i++ { 1973 bts, _ = v.MarshalMsg(bts[0:0]) 1974 } 1975 } 1976 1977 func BenchmarkUnmarshalMessageTxsResponse(b *testing.B) { 1978 v := MessageTxsResponse{} 1979 bts, _ := v.MarshalMsg(nil) 1980 b.ReportAllocs() 1981 b.SetBytes(int64(len(bts))) 1982 b.ResetTimer() 1983 for i := 0; i < b.N; i++ { 1984 _, err := v.UnmarshalMsg(bts) 1985 if err != nil { 1986 b.Fatal(err) 1987 } 1988 } 1989 } 1990 1991 func TestEncodeDecodeMessageTxsResponse(t *testing.T) { 1992 v := MessageTxsResponse{} 1993 var buf bytes.Buffer 1994 msgp.Encode(&buf, &v) 1995 1996 m := v.Msgsize() 1997 if buf.Len() > m { 1998 t.Log("WARNING: TestEncodeDecodeMessageTxsResponse Msgsize() is inaccurate") 1999 } 2000 2001 vn := MessageTxsResponse{} 2002 err := msgp.Decode(&buf, &vn) 2003 if err != nil { 2004 t.Error(err) 2005 } 2006 2007 buf.Reset() 2008 msgp.Encode(&buf, &v) 2009 err = msgp.NewReader(&buf).Skip() 2010 if err != nil { 2011 t.Error(err) 2012 } 2013 } 2014 2015 func BenchmarkEncodeMessageTxsResponse(b *testing.B) { 2016 v := MessageTxsResponse{} 2017 var buf bytes.Buffer 2018 msgp.Encode(&buf, &v) 2019 b.SetBytes(int64(buf.Len())) 2020 en := msgp.NewWriter(msgp.Nowhere) 2021 b.ReportAllocs() 2022 b.ResetTimer() 2023 for i := 0; i < b.N; i++ { 2024 v.EncodeMsg(en) 2025 } 2026 en.Flush() 2027 } 2028 2029 func BenchmarkDecodeMessageTxsResponse(b *testing.B) { 2030 v := MessageTxsResponse{} 2031 var buf bytes.Buffer 2032 msgp.Encode(&buf, &v) 2033 b.SetBytes(int64(buf.Len())) 2034 rd := msgp.NewEndlessReader(buf.Bytes(), b) 2035 dc := msgp.NewReader(rd) 2036 b.ReportAllocs() 2037 b.ResetTimer() 2038 for i := 0; i < b.N; i++ { 2039 err := v.DecodeMsg(dc) 2040 if err != nil { 2041 b.Fatal(err) 2042 } 2043 } 2044 }