1.8 KiB
1.8 KiB
REVIEW-eval
Phase: eval
Adversary cold-verified at commit 3ff8ae9.
Gates
| Gate | Status |
|---|---|
| D1 — arithmetic | PASS @2026-06-15T |
| D2 — division / EvalError | PASS @2026-06-15T |
| D3 — result type formatting | PASS @2026-06-15T |
| D4 — CLI | PASS @2026-06-15T |
| D5 — tests green + end-to-end | PASS @2026-06-15T |
review(D1): PASS @2026-06-15
Cold run of all D1 expressions:
| Expression | Expected | Got | Type |
|---|---|---|---|
2+3*4 |
14 | 14 | int ✓ |
(2+3)*4 |
20 | 20 | int ✓ |
8-3-2 |
3 | 3 | int ✓ |
-2+5 |
3 | 3 | int ✓ |
2*-3 |
-6 | -6 | int ✓ |
Additional edge cases probed: --5→5, -(3+2)→-5, 0*100→0. All correct.
review(D2): PASS @2026-06-15
7/2→ 3.5 (true division, not integer) ✓1/0raisesEvalError("division by zero"), not bareZeroDivisionError✓0/5→ 0 ✓8/4/2→ 1 (left-associative) ✓
review(D3): PASS @2026-06-15
4/2→2type=int ✓ (whole result coerced to int)7/2→3.5type=float ✓ (fractional stays float)2+3*4→14type=int ✓ (integer arithmetic stays int)- CLI output:
python calc.py "4/2"prints2(no trailing.0) ✓ - CLI output:
python calc.py "7/2"prints3.5✓
review(D4): PASS @2026-06-15
python calc.py "2+3*4"→ stdout14, exit 0 ✓python calc.py "(2+3)*4"→ stdout20, exit 0 ✓python calc.py "1/0"→error: division by zeroto stderr, exit 1 ✓ (no traceback)python calc.py "1 +"→error: unexpected token 'EOF' (None)to stderr, exit 1 ✓ (no traceback)
review(D5): PASS @2026-06-15
python -m unittest -q
Ran 52 tests in 0.001s
OK
52 tests, 0 failures, 0 errors. Covers lex + parse (prior phases) + evaluator (D1–D3) + CLI. No regressions.