-
Notifications
You must be signed in to change notification settings - Fork 5
/
dictionary_test.go
56 lines (46 loc) · 1.64 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
package fname
import "testing"
func TestNewDictionary(t *testing.T) {
t.Log("Given the need to test the NewDictionary function")
{
t.Log("\tWhen creating a new Dictionary with default values")
{
d := NewDictionary()
if d == nil {
t.Fatal("\t\tShould be able to create a Dictionary instance.")
}
t.Log("\t\tShould be able to create a Dictionary instance.")
if len(d.adjectives) == 0 {
t.Error("\t\tShould be able to load the adjective file.")
}
t.Log("\t\tShould be able to load the adjective file.")
if len(d.adverbs) == 0 {
t.Error("\t\tShould be able to load the adverb file.")
}
t.Log("\t\tShould be able to load the adverb file.")
if len(d.nouns) == 0 {
t.Error("\t\tShould be able to load the noun file.")
}
t.Log("\t\tShould be able to load the noun file.")
if len(d.verbs) == 0 {
t.Error("\t\tShould be able to load the verb file.")
}
if len(d.adjectives) != d.LengthAdjective() {
t.Error("\t\tShould be able to get the length of the adjective file.")
}
t.Log("\t\tShould be able to get the length of the adjective file.")
if len(d.adverbs) != d.LengthAdverb() {
t.Error("\t\tShould be able to get the length of the adverb file.")
}
t.Log("\t\tShould be able to get the length of the adverb file.")
if len(d.nouns) != d.LengthNoun() {
t.Error("\t\tShould be able to get the length of the noun file.")
}
t.Log("\t\tShould be able to get the length of the noun file.")
if len(d.verbs) != d.LengthVerb() {
t.Error("\t\tShould be able to get the length of the verb file.")
}
t.Log("\t\tShould be able to get the length of the verb file.")
}
}
}