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:
parent
35650132e4
commit
92f136955e
1 changed files with 6 additions and 0 deletions
|
|
@ -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},
|
||||
|
|
|
|||
Loading…
Reference in a new issue