mirror of
https://github.com/cubixle/codekata-golang.git
synced 2026-04-30 05:58:45 +01:00
53: combinatoric selections
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"math/big"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test_factorialOf(t *testing.T) {
|
||||
type args struct {
|
||||
n *big.Int
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want *big.Int
|
||||
}{
|
||||
{
|
||||
"test1",
|
||||
args{(&big.Int{}).SetInt64(0)},
|
||||
(&big.Int{}).SetInt64(1),
|
||||
},
|
||||
{
|
||||
"test2",
|
||||
args{(&big.Int{}).SetInt64(3)},
|
||||
(&big.Int{}).SetInt64(6),
|
||||
},
|
||||
{
|
||||
"test2",
|
||||
args{(&big.Int{}).SetInt64(5)},
|
||||
(&big.Int{}).SetInt64(120),
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := factorialOf(tt.args.n); !reflect.DeepEqual(got, tt.want) {
|
||||
t.Errorf("factorialOf() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user