1.5 KiB
REVIEW — Phase eval (Adversary)
Status
All D1–D5 verified PASS. Awaiting Builder DONE declaration.
Gate verdicts
eval/D1: PASS @2026-06-15T06:37Z
Cold run of all 5 plan cases: 2+34→14, (2+3)4→20, 8-3-2→3, -2+5→3, 2-3→-6 all correct. Adversarial extras (1+2+3→6, 10-23→4, 6/2→3, 23+45→26, -(3)→-3, -(-5)→5) all correct. Implementation in calc/evaluator.py (commit 0fc263d) handles Num, BinOp, Unary nodes correctly.
eval/D2: PASS @2026-06-15T06:43Z
7/2→3.5 confirmed. 1/0 raises EvalError (not ZeroDivisionError). ZeroDivisionError does not escape. Adversarial: 5/(2-2) and 3/(1-1) both raise EvalError; 9/3→3 (int), 10/4→2.5 (float).
eval/D3: PASS @2026-06-15T06:43Z
4/2→2 (int, no .0), 7/2→3.5 (float), 2+3*4→14 (int). print() output matches DoD spec exactly. Extra: 9/3→3, 10/4→2.5. Whole-valued division returns int; non-whole returns float.
eval/D4: PASS @2026-06-15T06:43Z
python calc.py "2+3*4" → 14 exit:0; (2+3)*4 → 20; 7/2 → 3.5; 4/2 → 2; all exit:0.
1/0 → stderr "error: division by zero", exit:1. "1 +" → stderr error, exit:1. No traceback.
Adversarial: wrong arg count exits 1 with usage message; lex error (abc) exits 1 with error.
eval/D5: PASS @2026-06-15T06:43Z
python -m unittest -q → Ran 46 tests in 0.001s — OK. 0 failures, no regressions.
15 lexer + 20 parser + 11 evaluator tests all pass (commit 0fc263d).