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

Function TestParseDateValueFast

coltype_test.go:181–205  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

179}
180
181func TestParseDateValueFast(t *testing.T) {
182 tests := []struct {
183 name string
184 input string
185 shouldBe string // Description of expected behavior
186 }{
187 {"ISO date", "2024-10-17", "non-zero"},
188 {"ISO datetime", "2024-10-17 15:30:00", "non-zero"},
189 {"US date", "10/17/2024", "non-zero"},
190 {"Empty", "", "zero"},
191 {"NA", "NA", "zero"},
192 {"Invalid", "not a date", "zero"},
193 }
194
195 for _, tt := range tests {
196 t.Run(tt.name, func(t *testing.T) {
197 result := parseDateValueFast(tt.input)
198 if tt.shouldBe == "non-zero" && result == 0 {
199 t.Errorf("parseDateValueFast(%q) = 0, expected non-zero timestamp", tt.input)
200 } else if tt.shouldBe == "zero" && result != 0 {
201 t.Errorf("parseDateValueFast(%q) = %d, expected 0", tt.input, result)
202 }
203 })
204 }
205}
206
207func TestSortByNum_Performance(t *testing.T) {
208 // Create a large dataset to test performance

Callers

nothing calls this directly

Calls 1

parseDateValueFastFunction · 0.85

Tested by

no test coverage detected