Test fixture
Code transformation while preserving behavior and intent.
The model receives the prompt (and optional system message). The run uses scorer rubric_json_metrics with the JSON configuration below. Pass/fail and partial credit are determined entirely by that scorer against the model output; no human grading.
Return JSON only with keys refactor, rationale, tests. Refactor if/else arithmetic operation dispatch into an operation map. Keep divide-by-zero handling unchanged.
{
"metrics": {
"visible": {
"checks": [
{
"contains": [
"operation map"
]
},
{
"contains": [
"calculator"
]
},
{
"contains": [
"divide"
]
}
]
},
"hidden": {
"checks": [
{
"contains": [
"divide-by-zero"
]
},
{
"contains": [
"unchanged"
]
},
{
"contains": [
"unknown operation"
]
}
]
},
"intent": {
"checks": [
{
"contains": [
"dispatch"
]
},
{
"contains": [
"control flow"
]
},
{
"contains": [
"map"
]
}
]
}
}
}temperature
0
max_tokens
460
timeout (s)
120
type
scored
file
refactor-calculator-operation-map.json