File: porterstemmer_has_repeat_double_consonant_suffix_test.go

package info (click to toggle)
golang-github-blevesearch-go-porterstemmer 1.0.1%2Bgit20141230.9.23a2c8e-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 188 kB
  • sloc: makefile: 2
file content (42 lines) | stat: -rw-r--r-- 766 bytes parent folder | download | duplicates (3)
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
package porterstemmer

import (
	"testing"
)

func TestHasDoubleConsonantSuffix(t *testing.T) {

	i := 0

	tests := make([]struct {
		S        []rune
		Expected bool
	}, 12)

	tests[i].S = []rune("apple")
	tests[i].Expected = false
	i++

	tests[i].S = []rune("hiss")
	tests[i].Expected = true
	i++

	tests[i].S = []rune("fizz")
	tests[i].Expected = true
	i++

	tests[i].S = []rune("fill")
	tests[i].Expected = true
	i++

	tests[i].S = []rune("ahaa")
	tests[i].Expected = false
	i++

	for _, datum := range tests {

		if actual := hasRepeatDoubleConsonantSuffix(datum.S); actual != datum.Expected {
			t.Errorf("Did NOT get what was expected for calling hasDoubleConsonantSuffix() on [%s]. Expect [%t] but got [%t]", string(datum.S), datum.Expected, actual)
		}
	}
}