mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-23 03:33:53 +00:00
test: Add edge case tests for parseWearoutValue function
Add 4 new test cases covering previously untested branches: - Float zero exactly (0.0) - Float negative zero (-0.0) - Only escaped quotes becoming empty after trimming - Quoted whitespace becoming empty after trimming Coverage improved from 95.8% to 100%.
This commit is contained in:
@@ -723,6 +723,12 @@ func TestParseWearoutValue(t *testing.T) {
|
||||
{name: "float zero decimal", raw: "90.0", want: 90},
|
||||
{name: "float high precision", raw: "75.999", want: 75},
|
||||
{name: "negative float", raw: "-5.5", want: -5},
|
||||
{name: "float zero exactly", raw: "0.0", want: 0},
|
||||
{name: "float negative zero", raw: "-0.0", want: 0},
|
||||
|
||||
// Quoted values that become empty after trimming
|
||||
{name: "only escaped quotes", raw: `\"\"`, want: wearoutUnknown},
|
||||
{name: "quoted whitespace", raw: `" "`, want: wearoutUnknown},
|
||||
|
||||
// Digit extraction fallback (messy SMART data)
|
||||
{name: "percentage text mixed", raw: "about 50 percent", want: 50},
|
||||
|
||||
Reference in New Issue
Block a user