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

Function TestIsNumericValue

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

Source from the content-addressed store, hash-verified

5)
6
7func TestIsNumericValue(t *testing.T) {
8 tests := []struct {
9 name string
10 input string
11 expected bool
12 }{
13 {"Integer", "123", true},
14 {"Negative integer", "-456", true},
15 {"Float", "123.456", true},
16 {"Negative float", "-123.456", true},
17 {"Scientific notation", "1.23e10", true},
18 {"Scientific negative", "1.23e-10", true},
19 {"With comma separator", "1,234.56", true},
20 {"With underscore", "1_234_567", true},
21 {"Empty string", "", false},
22 {"Text", "abc", false},
23 {"Mixed text and numbers", "123abc", false},
24 {"Just dot", ".", false},
25 {"Just sign", "-", false},
26 {"Multiple dots", "1.2.3", false},
27 }
28
29 for _, tt := range tests {
30 t.Run(tt.name, func(t *testing.T) {
31 result := isNumericValue(tt.input)
32 if result != tt.expected {
33 t.Errorf("isNumericValue(%q) = %v, want %v", tt.input, result, tt.expected)
34 }
35 })
36 }
37}
38
39func TestIsDateValue(t *testing.T) {
40 tests := []struct {

Callers

nothing calls this directly

Calls 1

isNumericValueFunction · 0.85

Tested by

no test coverage detected