k_test.go 661 B

1234567891011121314151617181920212223242526
  1. package kata_test
  2. import (
  3. . "github.com/onsi/ginkgo"
  4. . "github.com/onsi/gomega"
  5. . "code.osinet.fr/fgm/codewars/kyu5/directions_reduction"
  6. )
  7. func dotest(arr []string, exp []string) {
  8. var ans = DirReduc(arr)
  9. Expect(ans).To(Equal(exp))
  10. }
  11. var _ = Describe("Tests DirReduc", func() {
  12. It("should handle basic cases", func() {
  13. var a = []string{"NORTH", "SOUTH", "SOUTH", "EAST", "WEST", "NORTH", "WEST"}
  14. dotest(a, []string{"WEST"})
  15. a = []string{"NORTH", "WEST", "SOUTH", "EAST"}
  16. dotest(a, []string{"NORTH", "WEST", "SOUTH", "EAST"})
  17. a = []string{"NORTH", "SOUTH", "SOUTH", "EAST", "WEST", "NORTH", "NORTH"}
  18. dotest(a, []string{"NORTH"})
  19. })
  20. })