k_test.go 435 B

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