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

Function TestParseNumericValueFast

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

Source from the content-addressed store, hash-verified

151}
152
153func TestParseNumericValueFast(t *testing.T) {
154 tests := []struct {
155 name string
156 input string
157 expected float64
158 }{
159 {"Integer", "123", 123.0},
160 {"Negative", "-456", -456.0},
161 {"Float", "123.456", 123.456},
162 {"With commas", "1,234.56", 1234.56},
163 {"With underscores", "1_234_567", 1234567.0},
164 {"Scientific", "1.23e2", 123.0},
165 {"Empty", "", 0.0},
166 {"NA", "NA", 0.0},
167 {"NaN", "NaN", 0.0},
168 {"Invalid", "abc", 0.0},
169 }
170
171 for _, tt := range tests {
172 t.Run(tt.name, func(t *testing.T) {
173 result := parseNumericValueFast(tt.input)
174 if result != tt.expected {
175 t.Errorf("parseNumericValueFast(%q) = %v, want %v", tt.input, result, tt.expected)
176 }
177 })
178 }
179}
180
181func TestParseDateValueFast(t *testing.T) {
182 tests := []struct {

Callers

nothing calls this directly

Calls 1

parseNumericValueFastFunction · 0.85

Tested by

no test coverage detected