From 92f136955ee622cd59f146fea623d0c8c4d20d7e Mon Sep 17 00:00:00 2001 From: rcourtman Date: Mon, 1 Dec 2025 23:02:18 +0000 Subject: [PATCH] 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%. --- pkg/proxmox/client_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/proxmox/client_test.go b/pkg/proxmox/client_test.go index 765113d..dab4428 100644 --- a/pkg/proxmox/client_test.go +++ b/pkg/proxmox/client_test.go @@ -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},