MCPcopy Create free account
hub / github.com/codechenx/FastTableViewer / TestScoreSeparator

Function TestScoreSeparator

sepDector_test.go:186–217  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

184}
185
186func 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
219func TestUniqueChar(t *testing.T) {
220 input := []rune{'a', 'b', 'a', 'c', 'b', 'd'}

Callers

nothing calls this directly

Calls 1

scoreSeparatorMethod · 0.95

Tested by

no test coverage detected