-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsi_case_test.go
More file actions
48 lines (45 loc) · 1.13 KB
/
Copy pathsi_case_test.go
File metadata and controls
48 lines (45 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package parser
import (
"testing"
)
func TestSIPrefixCaseHandling(t *testing.T) {
tests := []struct {
name string
input string
expected string
}{
{
name: "Uppercase K should work (SI prefix)",
input: "Count > 2.5K",
expected: "Count > 2500",
},
{
name: "Uppercase M should work (SI prefix)",
input: "Population > 10M",
expected: "Population > 10000000",
},
{
name: "Lowercase m should be time unit (minutes), not SI prefix",
input: "Duration > 10m",
expected: "Duration > 600",
},
{
name: "Lowercase g should NOT be parsed as SI prefix (should remain as-is)",
input: "Count > 10g",
expected: "Count > 10g", // Should remain unchanged since lowercase g is not in SI map
},
{
name: "Mixed case: GB should be bytes, not SI prefix",
input: "Size > 1GB",
expected: "Size > 1000000000",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := normalizeHumanizedValues(tt.input)
if result != tt.expected {
t.Errorf("normalizeHumanizedValues(%q) = %q, want %q", tt.input, result, tt.expected)
}
})
}
}