forked from reiver/go-porterstemmer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathporterstemmer_contains_vowel_test.go
70 lines (43 loc) · 1022 Bytes
/
porterstemmer_contains_vowel_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
57
58
59
60
61
62
63
64
65
66
67
68
69
package porterstemmer
import (
"testing"
)
func TestContainsVowel(t *testing.T) {
i := 0
tests := make([]struct {
S []rune
Expected bool
}, 15)
tests[i].S = []rune("apple")
tests[i].Expected = true
i++
tests[i].S = []rune("f")
tests[i].Expected = false
i++
tests[i].S = []rune("a")
tests[i].Expected = true
i++
tests[i].S = []rune("e")
tests[i].Expected = true
i++
tests[i].S = []rune("i")
tests[i].Expected = true
i++
tests[i].S = []rune("o")
tests[i].Expected = true
i++
tests[i].S = []rune("u")
tests[i].Expected = true
i++
tests[i].S = []rune("y")
tests[i].Expected = false
i++
tests[i].S = []rune("cy")
tests[i].Expected = true
i++
for _,datum := range tests {
if actual := containsVowel(datum.S) ; actual != datum.Expected {
t.Errorf("Did NOT get what was expected for calling containsVowel() on [%s]. Expect [%t] but got [%t]", string(datum.S), datum.Expected, actual)
}
}
}