From 84f224cc032d220b95b325500fd21d015fcdc15d Mon Sep 17 00:00:00 2001 From: rcourtman Date: Mon, 1 Dec 2025 22:40:08 +0000 Subject: [PATCH] test: Add float32 NaN/Inf tests for intFromAny and floatFromAny Add 6 test cases covering float32 special values: - intFromAny: float32 NaN, +Inf, -Inf (all return 0, false) - floatFromAny: float32 NaN, +Inf, -Inf (all return 0, false) Coverage improved: - intFromAny: 96.7% -> 100% - floatFromAny: 95.0% -> 100% --- pkg/proxmox/replication_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/proxmox/replication_test.go b/pkg/proxmox/replication_test.go index 82f1ccc..6ec3482 100644 --- a/pkg/proxmox/replication_test.go +++ b/pkg/proxmox/replication_test.go @@ -95,6 +95,9 @@ func TestIntFromAny(t *testing.T) { {"float32 integer", float32(42.0), 42, true}, {"float32 round down", float32(42.4), 42, true}, {"float32 round up", float32(42.6), 43, true}, + {"float32 NaN", float32(math.NaN()), 0, false}, + {"float32 +Inf", float32(math.Inf(1)), 0, false}, + {"float32 -Inf", float32(math.Inf(-1)), 0, false}, {"float64 integer", float64(42.0), 42, true}, {"float64 round half", float64(42.5), 43, true}, {"float64 NaN", math.NaN(), 0, false}, @@ -219,6 +222,9 @@ func TestFloatFromAny(t *testing.T) { {"float64 +Inf", math.Inf(1), 0, false}, {"float64 -Inf", math.Inf(-1), 0, false}, {"float32", float32(3.14), float64(float32(3.14)), true}, + {"float32 NaN", float32(math.NaN()), 0, false}, + {"float32 +Inf", float32(math.Inf(1)), 0, false}, + {"float32 -Inf", float32(math.Inf(-1)), 0, false}, // int types {"int", int(42), 42, true},