(t *testing.T)
| 184 | } |
| 185 | |
| 186 | func TestScoreSeparator(t *testing.T) { |
| 187 | sd := sepDetecor{} |
| 188 | |
| 189 | tests := []struct { |
| 190 | name string |
| 191 | sep rune |
| 192 | count int |
| 193 | }{ |
| 194 | {"Comma high score", ',', 5}, |
| 195 | {"Tab high score", '\t', 5}, |
| 196 | {"Pipe good score", '|', 5}, |
| 197 | {"Semicolon good score", ';', 5}, |
| 198 | {"Space low score", ' ', 5}, |
| 199 | } |
| 200 | |
| 201 | for _, tt := range tests { |
| 202 | t.Run(tt.name, func(t *testing.T) { |
| 203 | score := sd.scoreSeparator(tt.sep, tt.count) |
| 204 | if score <= 0 { |
| 205 | t.Errorf("scoreSeparator(%c, %d) = %d, should be positive", tt.sep, tt.count, score) |
| 206 | } |
| 207 | }) |
| 208 | } |
| 209 | |
| 210 | // Verify comma has highest score |
| 211 | commaScore := sd.scoreSeparator(',', 5) |
| 212 | spaceScore := sd.scoreSeparator(' ', 5) |
| 213 | |
| 214 | if commaScore <= spaceScore { |
| 215 | t.Error("Comma should have higher score than space") |
| 216 | } |
| 217 | } |
| 218 | |
| 219 | func TestUniqueChar(t *testing.T) { |
| 220 | input := []rune{'a', 'b', 'a', 'c', 'b', 'd'} |
nothing calls this directly
no test coverage detected