@@ -87,21 +87,36 @@ func TestFilterOCRCapitalization(t *testing.T) {
87
87
}
88
88
89
89
func TestFixOCRWordCapitalization (t * testing.T ) {
90
- assert .Equal (t , "He's" , fixOCRWordCapitalization ("He's" ))
91
- assert .Equal (t , "GASPS" , fixOCRWordCapitalization ("GAsPs" ))
92
-
93
- assert .Equal (t , "macOS" , fixOCRWordCapitalization ("macOS" ))
94
- assert .Equal (t , "WindowsXP" , fixOCRWordCapitalization ("WindowsXP" ))
90
+ input := map [string ]string {
91
+ "GAsPs" : "GASPS" ,
92
+ "He's" : "He's" ,
93
+ "macOS" : "macOS" ,
94
+ "WindowsXP" : "WindowsXP" ,
95
+ }
96
+ for in , out := range input {
97
+ assert .Equal (t , out , fixOCRWordCapitalization (in ))
98
+ }
95
99
}
96
100
97
101
func TestStartsWithUppercase (t * testing.T ) {
98
- assert .Equal (t , true , startsWithUppercase ("Allo" ))
99
- assert .Equal (t , true , startsWithUppercase ("Ällo" ))
100
- assert .Equal (t , false , startsWithUppercase ("allo" ))
102
+ input := map [string ]bool {
103
+ "Allo" : true ,
104
+ "Ällo" : true ,
105
+ "allo" : false ,
106
+ }
107
+ for in , out := range input {
108
+ assert .Equal (t , out , startsWithUppercase (in ))
109
+ }
101
110
}
102
111
103
112
func TestCountCaseInLetters (t * testing.T ) {
104
- assert .Equal (t , []caseCount {{upper , 2 }}, countCaseInLetters ("GA" ))
105
- assert .Equal (t , []caseCount {{lower , 2 }}, countCaseInLetters ("ga" ))
106
- assert .Equal (t , []caseCount {{upper , 2 }, {lower , 1 }, {upper , 1 }, {lower , 1 }}, countCaseInLetters ("GAsPs" ))
113
+ input := map [string ][]caseCount {
114
+ "HELLO" : []caseCount {{upper , 5 }},
115
+ "hello" : []caseCount {{lower , 5 }},
116
+ "Hello" : []caseCount {{upper , 1 }, {lower , 4 }},
117
+ "GAsPs" : []caseCount {{upper , 2 }, {lower , 1 }, {upper , 1 }, {lower , 1 }},
118
+ }
119
+ for in , out := range input {
120
+ assert .Equal (t , out , countCaseInLetters (in ))
121
+ }
107
122
}
0 commit comments