k_test.go 445 B

12345678910111213141516171819202122
  1. package kata_test
  2. import (
  3. . "github.com/onsi/ginkgo"
  4. . "github.com/onsi/gomega"
  5. . "code.osinet.fr/fgm/codewars/kyu7/the_paperfold_sequence"
  6. )
  7. var _ = Describe("PaperFold sequence", func() {
  8. It("20 elements", func() {
  9. arr := []int{}
  10. p := make(chan int, 100)
  11. go PaperFold(p)
  12. for i := 0; i < 20; i++ {
  13. arr = append(arr, <-p)
  14. }
  15. Expect(arr).To(Equal([]int{1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1}))
  16. })
  17. })