2015-10-06 18:43:37 +00:00
|
|
|
package zxcvbn_math
|
2015-10-05 19:56:21 +00:00
|
|
|
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")
|
|
|
|
}
|