This commit is contained in:
VicRen
2021-01-12 09:52:09 +08:00
parent 3c89274278
commit dbfd209994
3 changed files with 100 additions and 4 deletions
+27
View File
@@ -0,0 +1,27 @@
package main
import "testing"
func Test_primeRatio(t *testing.T) {
type args struct {
nums []int
}
tests := []struct {
name string
args args
want float64
}{
{
"test1",
args{[]int{2, 3, 5, 8}},
0.75,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := primeRatio(tt.args.nums); got != tt.want {
t.Errorf("primeRatio() = %v, want %v", got, tt.want)
}
})
}
}