blob: 8b27774fccae663bccf51148320791992cb8c377 (
plain) (
blame)
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
|
package StemmerRu
import (
"testing"
"io/ioutil"
"encoding/json"
)
var testFile = `tests.json`
func TestStemWord(t *testing.T) {
file, err := ioutil.ReadFile(testFile)
if err != nil {
t.Error("Can't open file", testFile)
}
tests := &map[string]string{}
err = json.Unmarshal(file, tests)
if err != nil {
t.Error("Can't parse json", err)
}
for source, expected := range *tests {
result := StemWord(source);
if expected != result {
t.Errorf(`Expected "%s" (source: %s) but got "%s"`, result, source, result)
}
}
}
|