precommit nil if locked and no POL

This commit is contained in:
Ethan Buchman
2015-09-15 14:25:50 -04:00
parent 78768082a1
commit 555ecb095d
7 changed files with 269 additions and 111 deletions
-38
View File
@@ -1,38 +0,0 @@
package consensus
import (
"testing"
_ "github.com/tendermint/tendermint/config/tendermint_test"
)
func TestEnterProposeNoPrivValidator(t *testing.T) {
cs, _ := randConsensusState()
cs.EnterPropose(1, 0)
rs := cs.GetRoundState()
if rs.Proposal != nil {
t.Error("Expected to make no proposal, since no privValidator")
}
}
func TestEnterPropose(t *testing.T) {
cs, privValidators := randConsensusState()
val0 := privValidators[0]
cs.SetPrivValidator(val0)
cs.EnterPropose(1, 0)
rs := cs.GetRoundState()
// Check that Proposal, ProposalBlock, ProposalBlockParts are set.
if rs.Proposal == nil {
t.Error("rs.Proposal should be set")
}
if rs.ProposalBlock == nil {
t.Error("rs.ProposalBlock should be set")
}
if rs.ProposalBlockParts.Total() == 0 {
t.Error("rs.ProposalBlockParts should be set")
}
}
// TODO write better consensus state tests