1234567891011121314151617181920212223242526 |
- package kata_test
- import (
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- . "code.osinet.fr/fgm/codewars/kyu5/directions_reduction"
- )
- func dotest(arr []string, exp []string) {
- var ans = DirReduc(arr)
- Expect(ans).To(Equal(exp))
- }
- var _ = Describe("Tests DirReduc", func() {
- It("should handle basic cases", func() {
- var a = []string{"NORTH", "SOUTH", "SOUTH", "EAST", "WEST", "NORTH", "WEST"}
- dotest(a, []string{"WEST"})
- a = []string{"NORTH", "WEST", "SOUTH", "EAST"}
- dotest(a, []string{"NORTH", "WEST", "SOUTH", "EAST"})
- a = []string{"NORTH", "SOUTH", "SOUTH", "EAST", "WEST", "NORTH", "NORTH"}
- dotest(a, []string{"NORTH"})
- })
- })
|