-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrepl_test.go
56 lines (51 loc) · 872 Bytes
/
repl_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package main
import (
"testing"
)
func TestCleanInput(t *testing.T) {
testCases := []struct {
input string
expected []string
}{
{
input: "hello world",
expected: []string{
"hello",
"world",
},
},
{
input: "Hello World",
expected: []string{
"hello",
"world",
},
},
{
input: "HELLO WORLD",
expected: []string{
"hello",
"world",
},
},
}
for _, cs := range testCases {
actual := cleanInput(cs.input)
if len(actual) != len(cs.expected) {
t.Errorf("Lengths are different. %v is expected, but received %v",
len(cs.expected),
len(actual),
)
}
for i := range actual {
actualWord := actual[i]
expectedWord := cs.expected[i]
if actualWord != expectedWord {
t.Errorf("Words are not equal, %v is not equal to %v",
actualWord,
expectedWord,
)
}
}
}
}