1package porterstemmer
2
3
4
5import (
6    "testing"
7)
8
9
10
11func TestContainsVowel(t *testing.T) {
12
13	i := 0
14
15	tests := make([]struct {
16		S []rune
17		Expected bool
18	}, 15)
19
20
21	tests[i].S        = []rune("apple")
22	tests[i].Expected = true
23	i++
24
25	tests[i].S        = []rune("f")
26	tests[i].Expected = false
27	i++
28
29
30
31	tests[i].S        = []rune("a")
32	tests[i].Expected = true
33	i++
34
35	tests[i].S        = []rune("e")
36	tests[i].Expected = true
37	i++
38
39	tests[i].S        = []rune("i")
40	tests[i].Expected = true
41	i++
42
43	tests[i].S        = []rune("o")
44	tests[i].Expected = true
45	i++
46
47	tests[i].S        = []rune("u")
48	tests[i].Expected = true
49	i++
50
51
52
53	tests[i].S        = []rune("y")
54	tests[i].Expected = false
55	i++
56
57
58
59	tests[i].S        = []rune("cy")
60	tests[i].Expected = true
61	i++
62
63
64	for _,datum := range tests {
65		if  actual := containsVowel(datum.S) ; actual != datum.Expected   {
66			t.Errorf("Did NOT get what was expected for calling containsVowel() on [%s]. Expect [%t] but got [%t]", string(datum.S), datum.Expected, actual)
67		}
68	}
69}
70
71