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:
rcourtman 2025-12-01 23:02:18 +00:00
parent 35650132e4
commit 92f136955e

View file

@ -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},