Merge branch 'master' into test-utils-ip

This commit is contained in:
Stephen Buttolph 2020-04-03 00:10:03 -04:00 committed by GitHub
commit 00e50e60e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 12 deletions

View File

@ -4,6 +4,7 @@
package snowball
import (
"fmt"
"testing"
)
@ -78,16 +79,28 @@ func TestParametersInvalidBetaRogue(t *testing.T) {
}
func TestParametersInvalidConcurrentRepolls(t *testing.T) {
p := Parameters{
K: 1,
Alpha: 1,
BetaVirtuous: 1,
BetaRogue: 1,
ConcurrentRepolls: 2,
}
if err := p.Valid(); err == nil {
t.Fatalf("Should have failed due to invalid concurrent repolls")
}
tests := []Parameters{
Parameters{
K: 1,
Alpha: 1,
BetaVirtuous: 1,
BetaRogue: 1,
ConcurrentRepolls: 2,
},
Parameters{
K: 1,
Alpha: 1,
BetaVirtuous: 1,
BetaRogue: 1,
ConcurrentRepolls: 0,
},
}
for _, p := range tests {
label := fmt.Sprintf("ConcurrentRepolls=%d", p.ConcurrentRepolls)
t.Run(label, func(t *testing.T) {
if err := p.Valid(); err == nil {
t.Error("Should have failed due to invalid concurrent repolls")
}
})
}
}