The core protocol of WoopChain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
woop/consensus/enums_test.go

46 lines
882 B

package consensus
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestModeStrings(t *testing.T) {
modes := []Mode{
Normal,
ViewChanging,
Syncing,
Listening,
}
expectations := make(map[Mode]string)
expectations[Normal] = "Normal"
expectations[ViewChanging] = "ViewChanging"
expectations[Syncing] = "Syncing"
expectations[Listening] = "Listening"
for _, mode := range modes {
expected := expectations[mode]
assert.Equal(t, expected, mode.String())
}
}
func TestPhaseStrings(t *testing.T) {
phases := []FBFTPhase{
FBFTAnnounce,
FBFTPrepare,
FBFTCommit,
}
expectations := make(map[FBFTPhase]string)
expectations[FBFTAnnounce] = "Announce"
expectations[FBFTPrepare] = "Prepare"
expectations[FBFTCommit] = "Commit"
for _, phase := range phases {
expected := expectations[phase]
assert.Equal(t, expected, phase.String())
}
}