4.1 KiB
REVIEW — Phase review
Adversary cold-verification record.
Status
COMPREHENSIVE PASS @2026-06-16T00:21Z — all D1–D4 items verified.
D1 — Full cold re-verify (all prior phase DoD items)
Cold-verified from work-adv clone at commit bfd5972 (post-pull).
Lexer DoD
- INTEGER:
tokenize('42')→[Token('NUMBER', 42), Token('EOF', None)],valueisint✓ - FLOAT:
tokenize('3.14')→[Token('NUMBER', 3.14), Token('EOF', None)]✓ - LEADING DOT:
tokenize('.5')→Token('NUMBER', 0.5)✓ - OPERATORS:
tokenize('+-*/()')→ PLUS, MINUS, STAR, SLASH, LPAREN, RPAREN, EOF (correct kinds) ✓ - WHITESPACE: spaces and tabs skipped ✓
- LexError message contains char + position:
unexpected character '$' at position 1✓ - Unknown chars
@,$, letters raiseLexError✓
PASS
Parser DoD
- Single int:
parse(tokenize('1'))→Num(1)✓ - Single float:
parse(tokenize('3.14'))→Num(3.14)✓ - BinOp shape:
parse(tokenize('1+2'))→BinOp('+', Num(1), Num(2))✓ - Unary shape:
parse(tokenize('-5'))→Unary('-', Num(5))✓ - Precedence:
parse(tokenize('2+3*4'))→BinOp('+', Num(2), BinOp('*', Num(3), Num(4)))(mul binds tighter) ✓ - Left-associativity:
parse(tokenize('1-2-3'))→BinOp('-', BinOp('-', Num(1), Num(2)), Num(3))✓ - Empty input: raises
ParseError✓ - Unclosed paren
(1+: raisesParseError✓ - Two numbers adjacent
1 2: raisesParseError✓
PASS
Evaluator DoD
- Arithmetic:
2+3*4→14,(2+3)*4→20,8-3-2→3,-2+5→3,2*-3→-6 ✓ - True division:
7/2→3.5 ✓ - Division by zero:
1/0raisesEvalError("division by zero"), NOT bareZeroDivisionError✓ - fmt_result:
fmt_result(2.0)→'2',fmt_result(3.5)→'3.5',fmt_result(42)→'42'✓ - CLI:
python calc.py "2+3*4"→ stdout14, exit 0 ✓ - CLI:
python calc.py "(2+3)*4"→ stdout20, exit 0 ✓ - CLI:
python calc.py "7/2"→ stdout3.5, exit 0 ✓ - CLI:
python calc.py "4/2"→ stdout2, exit 0 ✓ - CLI error:
python calc.py "1/0"→ stderrerror: division by zero, exit 1, no traceback ✓ - CLI error:
python calc.py "1 +"→ stderrerror: unexpected token 'EOF' (None), exit 1 ✓
PASS
D2 — Full suite green
python -m unittest -v
Ran 64 tests in 0.002s
OK
All 64 tests pass (calc.test_lexer, calc.test_parser, calc.test_evaluator). Zero failures, zero errors.
PASS
D3 — Cross-feature break-it
All tests run independently against the actual CLI and Python API:
| Expression | Expected | Actual | Result |
|---|---|---|---|
-(-(1+2)) |
3 |
3 |
PASS |
2+3*4-5/5 |
13 |
13 (raw 13.0, fmt→13) |
PASS |
--5 |
5 |
5 |
PASS |
((((3)))) |
3 |
3 |
PASS |
1+2*3+4*5+6 |
33 |
33 |
PASS |
( 1.5 + 2.5 ) * 2 |
8 |
8 (raw 8.0, fmt→8) |
PASS |
2.5 + ( 3.5 * 2 ) |
9.5 |
9.5 |
PASS |
(1+2)*(3+4) |
21 |
21 |
PASS |
Error propagation:
| Input | Expected error type | Actual | Result |
|---|---|---|---|
1 @ 2 |
LexError |
LexError: unexpected character '@' at position 2 |
PASS |
1/0 |
EvalError |
EvalError: division by zero (no bare ZeroDivisionError) |
PASS |
(1+ |
ParseError |
ParseError: unexpected token 'EOF' (None) |
PASS |
bad input @# |
CLI exit 1 | error: unexpected character 'b' at position 0, exit 1 |
PASS |
CLI exit codes:
- Valid expressions → exit 0 ✓
- Invalid expressions (lex/parse/eval errors) → exit 1 ✓
- No tracebacks on errors ✓
Note: 2+3*4-5/5 raw result is 13.0 (float, because 5/5 returns 1.0), but fmt_result(13.0) → '13' — correct behavior.
No defects found. PASS
D4 — Findings cleared
No findings were filed. No VETO. Nothing to clear.
PASS
OVERALL VERDICT
review(all): PASS @2026-06-16T00:21Z
Comprehensive cold-verification of all D1–D4 from the review phase plan (covering lex, parse, eval, and CLI) passes in full. 64 unit tests green. All cross-feature integration probes pass. No defects, no VETO.
Builder may now write ## DONE to STATUS-review.md.