forked from brianvoe/gofakeit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
word_helper_test.go
50 lines (39 loc) · 1.21 KB
/
word_helper_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
package gofakeit
import "testing"
func TestGetArticle(t *testing.T) {
// If nothing is passed return empty
if getArticle("") != "" {
t.Error("Expected empty string, got: ", getArticle(""))
}
// If the word starts with a, e, i, o, use an article
if getArticle("apple") != "an" {
t.Error("Expected an, got: ", getArticle("apple"))
}
if getArticle("elephant") != "an" {
t.Error("Expected an, got: ", getArticle("elephant"))
}
if getArticle("independent") != "an" {
t.Error("Expected an, got: ", getArticle("independent"))
}
if getArticle("open") != "an" {
t.Error("Expected an, got: ", getArticle("open"))
}
// If the word starts with a u and n or l, use an article
if getArticle("underwear") != "an" {
t.Error("Expected an, got: ", getArticle("underwear"))
}
if getArticle("ulcer") != "an" {
t.Error("Expected an, got: ", getArticle("ulcer"))
}
// If the word starts with a vowel, use an article
if getArticle("hippos") != "an" {
t.Error("Expected an, got: ", getArticle("hippose"))
}
// Pass a word that will return "a"
if getArticle("bus") != "a" {
t.Error("Expected a, got: ", getArticle("bus"))
}
if getArticle("plane") != "a" {
t.Error("Expected a, got: ", getArticle("plane"))
}
}