fixed test + improved coverage

This commit is contained in:
StephenButtolph 2020-03-31 23:56:18 -04:00
parent 741d5fde66
commit 12c8d6c44f
2 changed files with 16 additions and 2 deletions

View File

@ -151,7 +151,7 @@ func TestBinarySnowballAcceptWeirdColor(t *testing.T) {
t.Fatalf("Finalized too late")
}
expected := "SB(Preference = 0, NumSuccessfulPolls[0] = 2, NumSuccessfulPolls[1] = 2, SF(Confidence = 2, Finalized = true, SL(Preference = 1)))"
expected := "SB(Preference = 1, NumSuccessfulPolls[0] = 2, NumSuccessfulPolls[1] = 2, SF(Confidence = 2, Finalized = true, SL(Preference = 0)))"
if str := sb.String(); str != expected {
t.Fatalf("Wrong state. Expected:\n%s\nGot:\n%s", expected, str)
}

View File

@ -90,7 +90,21 @@ func TestParametersAnotherInvalidBetaRogue(t *testing.T) {
}
}
func TestParametersInvalidConcurrentRepolls(t *testing.T) {
func TestParametersTooFewConcurrentRepolls(t *testing.T) {
p := Parameters{
K: 1,
Alpha: 1,
BetaVirtuous: 1,
BetaRogue: 1,
ConcurrentRepolls: 0,
}
if err := p.Valid(); err == nil {
t.Fatalf("Should have failed due to invalid concurrent repolls")
}
}
func TestParametersTooManyConcurrentRepolls(t *testing.T) {
p := Parameters{
K: 1,
Alpha: 1,