mirror of
https://github.com/cubixle/codekata-golang.git
synced 2026-04-24 19:54:43 +01:00
41 lines
552 B
Go
41 lines
552 B
Go
package main
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
)
|
|
|
|
func Test_distinctPrimesOf(t *testing.T) {
|
|
type args struct {
|
|
n int
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want []int
|
|
}{
|
|
{
|
|
"4",
|
|
args{4},
|
|
[]int{2},
|
|
},
|
|
{
|
|
"14",
|
|
args{14},
|
|
[]int{2, 7},
|
|
},
|
|
{
|
|
"644",
|
|
args{644},
|
|
[]int{2, 7, 23},
|
|
},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := distinctPrimesOf(tt.args.n); !reflect.DeepEqual(got, tt.want) {
|
|
t.Errorf("distinctPrimesOf() = %v, want %v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|