─── ValidateTemperatureParam ─────────────────────────────────────────────────
(t *testing.T)
| 195 | // ─── ValidateTemperatureParam ───────────────────────────────────────────────── |
| 196 | |
| 197 | func TestValidateTemperatureParam(t *testing.T) { |
| 198 | tests := []struct { |
| 199 | value string |
| 200 | wantErr bool |
| 201 | }{ |
| 202 | {"0.0", false}, |
| 203 | {"0.7", false}, |
| 204 | {"1.0", false}, |
| 205 | {"2.0", false}, |
| 206 | {"0", false}, |
| 207 | {"2", false}, |
| 208 | {"-0.1", true}, |
| 209 | {"2.1", true}, |
| 210 | {"3.0", true}, |
| 211 | {"abc", true}, |
| 212 | {"", true}, |
| 213 | // NaN and Inf must be rejected (strconv.ParseFloat accepts them) |
| 214 | {"NaN", true}, |
| 215 | {"nan", true}, |
| 216 | {"+Inf", true}, |
| 217 | {"-Inf", true}, |
| 218 | {"Inf", true}, |
| 219 | } |
| 220 | for _, tt := range tests { |
| 221 | t.Run(tt.value, func(t *testing.T) { |
| 222 | err := ValidateTemperatureParam(tt.value) |
| 223 | if tt.wantErr { |
| 224 | assert.Error(t, err, "temperature=%q should fail validation", tt.value) |
| 225 | } else { |
| 226 | assert.NoError(t, err, "temperature=%q should pass validation", tt.value) |
| 227 | } |
| 228 | }) |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | // ─── UnrecognizedParams ─────────────────────────────────────────────────────── |
| 233 |
nothing calls this directly
no test coverage detected