12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- package kata_test
- import (
- "fmt"
- "testing"
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- kata "code.osinet.fr/fgm/codewars/kyu5/primes_in_numbers"
- )
- func TestPrimesInNumbers(t *testing.T) {
- RegisterFailHandler(Fail)
- RunSpecs(t, "PrimesInNumbers Suite")
- }
- func ZTestPrimes(t *testing.T) {
- type checkType struct {
- limit int
- expected []int
- }
- checks := [...]checkType{
- {0, []int{}},
- {1, []int{}},
- {2, []int{2}},
- {10, []int{2, 3, 5, 7}},
- }
- for _, check := range checks {
- t.Run(fmt.Sprintf("Limit %d", check.limit), func(t *testing.T) {
- t.Parallel()
- actual := kata.Primes(check.limit)
- if len(actual) != len(check.expected) {
- t.Log(actual)
- t.FailNow()
- }
- for i := 0; i < len(actual); i++ {
- if check.expected[i] != actual[i] {
- t.Log(actual)
- t.Fail()
- }
- }
- })
- }
- }
|