zxcvbn-go/utils/math/mathutils_test.go

23 lines
475 B
Go

package zxcvbn_math
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNchoseK100and2(t *testing.T) {
nCk := NChoseK(100, 2)
assert.Equal(t, uint64(4950), nCk, "100 chose 2 should equal 4950")
}
func TestNChoseKwereNlessK(t *testing.T) {
nCk := NChoseK(1, 2)
assert.Equal(t, uint64(0), nCk, "When n is less than k always 0")
}
func TestNChoseKWereKis0(t *testing.T) {
nCk := NChoseK(50, 0)
assert.Equal(t, uint64(1), nCk, "When K is 0 then 1")
}