2.6 KiB
REVIEW — Phase eval (Adversary)
D1: PASS @2026-06-15T05:01Z
Cold-ran all five DoD arithmetic checks from the plan:
2+3*4→ 14 ✓ (precedence:*before+)(2+3)*4→ 20 ✓ (parens override precedence)8-3-2→ 3 ✓ (left-associativity)-2+5→ 3 ✓ (unary minus)2*-3→ -6 ✓ (unary minus in binary context)
Break-it probes:
--5→ 5 ✓ (double unary, recursive)((2+3))→ 5 ✓ (nested parens)1+2+3+4→ 10 ✓ (chain addition)2*3+4/2→ 8 ✓ (mixed precedence,4/2→ int 2,6+2→ int 8)
D2: PASS @2026-06-15T05:01Z
7/2→ 3.5 (true division) ✓1/0→ raisesEvalError("division by zero"), NOTZeroDivisionError✓- Break-it:
0/0→EvalError✓ (zero-zero handled by sameright == 0check) - Break-it:
-1/0→EvalError✓
Code review: evaluator.py:30–31 — explicit if right == 0: raise EvalError(...) before Python's / operator, so ZeroDivisionError can never escape. Correct.
D3: PASS @2026-06-15T05:01Z
4/2→2(typeint) ✓7/2→3.5(typefloat) ✓- Break-it:
6/3→2int ✓ - Break-it:
0/1→0int ✓ - Break-it:
2+3(no division) →5int ✓ (integer arithmetic always stays int) - Break-it:
1/3→0.333...float ✓
Code review: evaluator.py:33–35 — if result == int(result): return int(result) applied only in the / branch. Correct scope.
CLI check: python calc.py '4/2' → 2 (no .0) ✓; python calc.py '7/2' → 3.5 ✓
D4: PASS @2026-06-15T05:01Z
Valid expressions:
python calc.py "2+3*4"→ stdout14, exit 0 ✓python calc.py "(2+3)*4"→ stdout20, exit 0 ✓python calc.py "7/2"→ stdout3.5, exit 0 ✓python calc.py "4/2"→ stdout2, exit 0 ✓
Error cases:
python calc.py "1/0"→ stderrerror: division by zero, exit 1, stdout empty ✓python calc.py "1 +"→ stderrerror: unexpected token 'EOF' (None), exit 1, stdout empty ✓
Break-it probes:
- No
Tracebackin stderr for either error case ✓ - No-arg case (
python calc.py) → stderrusage: python calc.py <expression>, exit 1 ✓ LexErroralso caught (imported and handled incalc.py:17) ✓
D5: PASS @2026-06-15T05:01Z
Cold-ran: python -m unittest -q
Output: Ran 63 tests in 0.232s OK — 0 failures ✓
Prior suite (37 lex+parse tests) still passes; 26 new evaluator tests added. No regressions.
Plan's exact Verify-section commands all ran with matching expected outputs.
No adversary findings — all DoD gates verified PASS
All D1–D5 gates independently verified with break-it probes. No defects found. Builder may mark DONE.