(t *testing.T)
| 661 | } |
| 662 | |
| 663 | func TestBlockPartMessageValidateBasic(t *testing.T) { |
| 664 | testPart := new(types.Part) |
| 665 | testPart.Proof.LeafHash = tmhash.Sum([]byte("leaf")) |
| 666 | testCases := []struct { |
| 667 | testName string |
| 668 | messageHeight int64 |
| 669 | messageRound int32 |
| 670 | messagePart *types.Part |
| 671 | expectErr bool |
| 672 | }{ |
| 673 | {"Valid Message", 0, 0, testPart, false}, |
| 674 | {"Invalid Message", -1, 0, testPart, true}, |
| 675 | {"Invalid Message", 0, -1, testPart, true}, |
| 676 | } |
| 677 | |
| 678 | for _, tc := range testCases { |
| 679 | tc := tc |
| 680 | t.Run(tc.testName, func(t *testing.T) { |
| 681 | message := BlockPartMessage{ |
| 682 | Height: tc.messageHeight, |
| 683 | Round: tc.messageRound, |
| 684 | Part: tc.messagePart, |
| 685 | } |
| 686 | |
| 687 | assert.Equal(t, tc.expectErr, message.ValidateBasic() != nil, "Validate Basic had an unexpected result") |
| 688 | }) |
| 689 | } |
| 690 | |
| 691 | message := BlockPartMessage{Height: 0, Round: 0, Part: new(types.Part)} |
| 692 | message.Part.Index = 1 |
| 693 | |
| 694 | assert.Equal(t, true, message.ValidateBasic() != nil, "Validate Basic had an unexpected result") |
| 695 | } |
| 696 | |
| 697 | func TestHasVoteMessageValidateBasic(t *testing.T) { |
| 698 | const ( |
nothing calls this directly
no test coverage detected
searching dependent graphs…