(t *testing.T)
| 878 | } |
| 879 | |
| 880 | func TestBlockPartMessageValidateBasic(t *testing.T) { |
| 881 | testPart := new(types.Part) |
| 882 | testPart.Proof.LeafHash = tmhash.Sum([]byte("leaf")) |
| 883 | testCases := []struct { |
| 884 | testName string |
| 885 | messageHeight int64 |
| 886 | messageRound int32 |
| 887 | messagePart *types.Part |
| 888 | expectErr bool |
| 889 | }{ |
| 890 | {"Valid Message", 0, 0, testPart, false}, |
| 891 | {"Invalid Message", -1, 0, testPart, true}, |
| 892 | {"Invalid Message", 0, -1, testPart, true}, |
| 893 | } |
| 894 | |
| 895 | for _, tc := range testCases { |
| 896 | tc := tc |
| 897 | t.Run(tc.testName, func(t *testing.T) { |
| 898 | message := BlockPartMessage{ |
| 899 | Height: tc.messageHeight, |
| 900 | Round: tc.messageRound, |
| 901 | Part: tc.messagePart, |
| 902 | } |
| 903 | |
| 904 | assert.Equal(t, tc.expectErr, message.ValidateBasic() != nil, "Validate Basic had an unexpected result") |
| 905 | }) |
| 906 | } |
| 907 | |
| 908 | message := BlockPartMessage{Height: 0, Round: 0, Part: new(types.Part)} |
| 909 | message.Part.Index = 1 |
| 910 | |
| 911 | assert.Equal(t, true, message.ValidateBasic() != nil, "Validate Basic had an unexpected result") |
| 912 | } |
| 913 | |
| 914 | func TestHasVoteMessageValidateBasic(t *testing.T) { |
| 915 | const ( |
nothing calls this directly
no test coverage detected