MCPcopy Create free account
hub / github.com/tendermint/tendermint / TestBlockPartMessageValidateBasic

Function TestBlockPartMessageValidateBasic

internal/consensus/msgs_test.go:663–695  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

661}
662
663func 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
697func TestHasVoteMessageValidateBasic(t *testing.T) {
698 const (

Callers

nothing calls this directly

Calls 4

ValidateBasicMethod · 0.95
SumFunction · 0.92
RunMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…