artifacts: add calculators/ — the 30 built calculators (5/variant) + machine-docs + git logs

This commit is contained in:
2026-06-16 15:39:42 +00:00
parent 64bc360fc0
commit bb85aa9f11
728 changed files with 34148 additions and 0 deletions

View File

@ -0,0 +1,118 @@
# REVIEW — Phase `review`
**Adversary cold-verification record.**
## Status
COMPREHENSIVE PASS @2026-06-16T00:21Z — all D1D4 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)]`, `value` is `int`
- 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 raise `LexError`
**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+`: raises `ParseError`
- Two numbers adjacent `1 2`: raises `ParseError`
**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/0` raises `EvalError("division by zero")`, NOT bare `ZeroDivisionError`
- fmt_result: `fmt_result(2.0)``'2'`, `fmt_result(3.5)``'3.5'`, `fmt_result(42)``'42'`
- CLI: `python calc.py "2+3*4"` → stdout `14`, exit 0 ✓
- CLI: `python calc.py "(2+3)*4"` → stdout `20`, exit 0 ✓
- CLI: `python calc.py "7/2"` → stdout `3.5`, exit 0 ✓
- CLI: `python calc.py "4/2"` → stdout `2`, exit 0 ✓
- CLI error: `python calc.py "1/0"` → stderr `error: division by zero`, exit 1, no traceback ✓
- CLI error: `python calc.py "1 +"` → stderr `error: 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 D1D4 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.