generated from stscoundrel/go-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dictionary_test.go
75 lines (61 loc) · 1.71 KB
/
dictionary_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
70
71
72
73
74
75
package dictionary
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestDictionariesHaveExpectedAmountOfEntries(t *testing.T) {
expected_entries := 29951
defaultResult, _ := GetDictionary()
noMarkupResult, _ := GetNoMarkupDictionary()
assert.Equal(t, expected_entries, len(defaultResult))
assert.Equal(t, expected_entries, len(noMarkupResult))
assert.Equal(t, len(defaultResult), len(noMarkupResult))
}
func TestDefaultDictionaryHasExpectedEntries(t *testing.T) {
result, _ := GetDictionary()
expected1 := DictionaryEntry{
Headword: "afbindi",
Definitions: []string{
"n. <i>constipation</i>.",
},
}
expected2 := DictionaryEntry{
Headword: "andstreymr",
Definitions: []string{
"a. <i>strongly adverse</i> (andstreym ørlög); Sighvatr var heldr ~ um eptirmálin, <i>hard to come to terms with</i>.",
},
}
expected3 := DictionaryEntry{
Headword: "undanhald",
Definitions: []string{
"n. <i>flight</i>.",
},
}
assert.Equal(t, expected1, result[14])
assert.Equal(t, expected2, result[1000])
assert.Equal(t, expected3, result[25000])
}
func TestNoMarkupDictionaryHasExpectedEntries(t *testing.T) {
result, _ := GetNoMarkupDictionary()
expected1 := DictionaryEntry{
Headword: "afbindi",
Definitions: []string{
"n. constipation.",
},
}
expected2 := DictionaryEntry{
Headword: "andstreymr",
Definitions: []string{
"a. strongly adverse (andstreym ørlög); Sighvatr var heldr ~ um eptirmálin, hard to come to terms with.",
},
}
expected3 := DictionaryEntry{
Headword: "undanhald",
Definitions: []string{
"n. flight.",
},
}
assert.Equal(t, expected1, result[14])
assert.Equal(t, expected2, result[1000])
assert.Equal(t, expected3, result[25000])
}