k_test.go 755 B

1234567891011121314151617181920212223242526272829
  1. package kata_test
  2. import (
  3. . "github.com/onsi/ginkgo"
  4. . "github.com/onsi/gomega"
  5. . "code.osinet.fr/fgm/codewars/kyu5/gap_in_primes"
  6. )
  7. func dotest(k, start, nd int, exp []int) {
  8. var ans = Gap(k, start, nd)
  9. Expect(ans).To(Equal(exp))
  10. }
  11. var _ = Describe("Test Example", func() {
  12. It("should handle basic cases", func() {
  13. dotest(2, 100, 110, []int{101, 103})
  14. dotest(4, 100, 110, []int{103, 107})
  15. dotest(6, 100, 110, nil)
  16. dotest(8, 300, 400, []int{359, 367})
  17. dotest(10, 300, 400, []int{337, 347})
  18. dotest(4, 30000, 100000, []int{30109, 30113})
  19. dotest(6, 30000, 100000, []int{30091, 30097})
  20. dotest(8, 30000, 100000, []int{30161, 30169})
  21. dotest(11, 30000, 100000, nil)
  22. dotest(2, 10000000, 11000000, []int{10000139, 10000141})
  23. })
  24. })