(t *testing.T)
| 948 | } |
| 949 | |
| 950 | func TestVoteSetMaj23MessageValidateBasic(t *testing.T) { |
| 951 | const ( |
| 952 | validSignedMsgType tmproto.SignedMsgType = 0x01 |
| 953 | invalidSignedMsgType tmproto.SignedMsgType = 0x03 |
| 954 | ) |
| 955 | |
| 956 | validBlockID := types.BlockID{} |
| 957 | invalidBlockID := types.BlockID{ |
| 958 | Hash: bytes.HexBytes{}, |
| 959 | PartSetHeader: types.PartSetHeader{ |
| 960 | Total: 1, |
| 961 | Hash: []byte{0}, |
| 962 | }, |
| 963 | } |
| 964 | |
| 965 | testCases := []struct { //nolint: maligned |
| 966 | expectErr bool |
| 967 | messageRound int32 |
| 968 | messageHeight int64 |
| 969 | testName string |
| 970 | messageType tmproto.SignedMsgType |
| 971 | messageBlockID types.BlockID |
| 972 | }{ |
| 973 | {false, 0, 0, "Valid Message", validSignedMsgType, validBlockID}, |
| 974 | {true, -1, 0, "Invalid Message", validSignedMsgType, validBlockID}, |
| 975 | {true, 0, -1, "Invalid Message", validSignedMsgType, validBlockID}, |
| 976 | {true, 0, 0, "Invalid Message", invalidSignedMsgType, validBlockID}, |
| 977 | {true, 0, 0, "Invalid Message", validSignedMsgType, invalidBlockID}, |
| 978 | } |
| 979 | |
| 980 | for _, tc := range testCases { |
| 981 | tc := tc |
| 982 | t.Run(tc.testName, func(t *testing.T) { |
| 983 | message := VoteSetMaj23Message{ |
| 984 | Height: tc.messageHeight, |
| 985 | Round: tc.messageRound, |
| 986 | Type: tc.messageType, |
| 987 | BlockID: tc.messageBlockID, |
| 988 | } |
| 989 | |
| 990 | assert.Equal(t, tc.expectErr, message.ValidateBasic() != nil, "Validate Basic had an unexpected result") |
| 991 | }) |
| 992 | } |
| 993 | } |
| 994 | |
| 995 | func TestVoteSetBitsMessageValidateBasic(t *testing.T) { |
| 996 | testCases := []struct { |
nothing calls this directly
no test coverage detected