MCPcopy Create free account
hub / github.com/Pallinder/go-randomdata / TestFullName

Function TestFullName

random_data_test.go:104–147  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

102}
103
104func TestFullName(t *testing.T) {
105 t.Log("TestFullName")
106
107 fullNameMale := FullName(Male)
108 fullNameFemale := FullName(Female)
109 fullNameRandom := FullName(RandomGender)
110
111 maleSplit := strings.Fields(fullNameMale)
112 femaleSplit := strings.Fields(fullNameFemale)
113 randomSplit := strings.Fields(fullNameRandom)
114
115 if len(maleSplit) == 0 {
116 t.Error("Failed on full name male")
117 }
118
119 if !findInSlice(jsonData.FirstNamesMale, maleSplit[0]) {
120 t.Error("Couldnt find maleSplit first name in firstNamesMale")
121 }
122
123 if !findInSlice(jsonData.LastNames, maleSplit[1]) {
124 t.Error("Couldnt find maleSplit last name in lastNames")
125 }
126
127 if len(femaleSplit) == 0 {
128 t.Error("Failed on full name female")
129 }
130
131 if !findInSlice(jsonData.FirstNamesFemale, femaleSplit[0]) {
132 t.Error("Couldnt find femaleSplit first name in firstNamesFemale")
133 }
134
135 if !findInSlice(jsonData.LastNames, femaleSplit[1]) {
136 t.Error("Couldnt find femaleSplit last name in lastNames")
137 }
138
139 if len(randomSplit) == 0 {
140 t.Error("Failed on full name random")
141 }
142
143 if !findInSlice(jsonData.FirstNamesMale, randomSplit[0]) && !findInSlice(jsonData.FirstNamesFemale, randomSplit[0]) {
144 t.Error("Couldnt find randomSplit first name in either firstNamesMale or firstNamesFemale")
145 }
146
147}
148
149func TestEmail(t *testing.T) {
150 t.Log("TestEmail")

Callers

nothing calls this directly

Calls 2

FullNameFunction · 0.85
findInSliceFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…