MCPcopy Create free account
hub / github.com/github/gh-aw / TestValidateTemperatureParam

Function TestValidateTemperatureParam

pkg/workflow/model_alias_validation_test.go:197–230  ·  view source on GitHub ↗

─── ValidateTemperatureParam ─────────────────────────────────────────────────

(t *testing.T)

Source from the content-addressed store, hash-verified

195// ─── ValidateTemperatureParam ─────────────────────────────────────────────────
196
197func 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

Callers

nothing calls this directly

Calls 3

ValidateTemperatureParamFunction · 0.85
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected