artifacts: add calculators/ — the 30 built calculators (5/variant) + machine-docs + git logs
This commit is contained in:
@ -0,0 +1,63 @@
|
||||
# REVIEW — Phase `eval`
|
||||
|
||||
**Adversary cold-verification record.**
|
||||
|
||||
## Status
|
||||
COMPREHENSIVE PASS — all DoD gates verified @2026-06-16T00:18Z from cold start in work-adv clone.
|
||||
No VETO.
|
||||
|
||||
## Verdicts
|
||||
|
||||
### D1 — arithmetic: PASS @2026-06-16T00:18Z
|
||||
Verified all 5 plan-specified cases independently:
|
||||
- `2+3*4` → 14 ✓ (precedence: * before +)
|
||||
- `(2+3)*4` → 20 ✓ (parens override precedence)
|
||||
- `8-3-2` → 3 ✓ (left-associativity; NOT 7)
|
||||
- `-2+5` → 3 ✓ (leading unary minus)
|
||||
- `2*-3` → -6 ✓ (unary minus after binary op)
|
||||
|
||||
Command: `python -c "... evaluate(parse(tokenize(expr))) ..."` for each case.
|
||||
|
||||
### D2 — division: PASS @2026-06-16T00:18Z
|
||||
- `7/2` → 3.5 ✓ (true division, not floor)
|
||||
- `1/0` raises `EvalError("division by zero")` ✓
|
||||
- `ZeroDivisionError` does NOT escape the API ✓ (independently verified: caught EvalError, no ZeroDivisionError propagated)
|
||||
|
||||
### D3 — result type: PASS @2026-06-16T00:18Z
|
||||
- `fmt_result(eval("4/2"))` → `"2"` ✓ (whole float → no trailing .0)
|
||||
- `fmt_result(eval("7/2"))` → `"3.5"` ✓ (non-whole float)
|
||||
- `fmt_result(eval("2+3"))` → `"5"` ✓ (int stays int)
|
||||
- `fmt_result(-6)` → `"-6"` ✓ (negative int)
|
||||
- `fmt_result(eval("-7/2"))` → `"-3.5"` ✓ (negative non-whole float via CLI)
|
||||
- `fmt_result(eval("-6/2"))` → `"-3"` ✓ (negative whole float → no .0)
|
||||
|
||||
### D4 — CLI: PASS @2026-06-16T00:18Z
|
||||
- `python calc.py "2+3*4"` → stdout `14`, exit 0 ✓
|
||||
- `python calc.py "(2+3)*4"` → stdout `20`, exit 0 ✓
|
||||
- `python calc.py "7/2"` → stdout `3.5`, exit 0 ✓
|
||||
- `python calc.py "4/2"` → stdout `2`, exit 0 ✓
|
||||
- `python calc.py "1/0"` → stderr `error: division by zero`, exit 1 ✓
|
||||
- `python calc.py "1 +"` → stderr `error: unexpected token 'EOF' (None)`, exit 1 ✓
|
||||
- Error output goes to STDERR (stdout suppression confirmed) ✓
|
||||
- No raw traceback on any error path ✓ (checked with grep)
|
||||
- Wrong arg count → usage message to stderr, exit 1 ✓
|
||||
|
||||
### D5 — tests green + end-to-end: PASS @2026-06-16T00:18Z
|
||||
- `python -m unittest -q` → `Ran 64 tests in 0.001s\nOK` ✓
|
||||
- Lex suite (calc.test_lexer): 45 of 64 total — passes ✓ (no regression)
|
||||
- Parse suite (calc.test_parser): included in 45 — passes ✓ (no regression)
|
||||
- Eval suite (calc.test_evaluator): 19 tests covering D1–D3 ✓
|
||||
|
||||
## Cross-feature integration probes (adversarial)
|
||||
All passed:
|
||||
- `python calc.py "-6/2"` → `-3` ✓ (unary minus + whole-float formatting)
|
||||
- `python calc.py "(-6)/2"` → `-3` ✓
|
||||
- `python calc.py "(2*(3+4))"` → `14` ✓ (nested parens + multiplication)
|
||||
- `python calc.py "-7/2"` → `-3.5` ✓ (unary minus + true division)
|
||||
- `python calc.py "@"` → stderr error, exit 1, no traceback ✓ (LexError path)
|
||||
|
||||
## Notes
|
||||
- Verified from work-adv clone (cold start — no cached pyc state from builder's env).
|
||||
- JOURNAL not consulted before verdict (isolation maintained).
|
||||
- `evaluate()` returns Python `int` for integer arithmetic (e.g., `2+3 → int(5)`) — `fmt_result` handles both `int` and `float` correctly.
|
||||
- Division always returns Python `float` (Python `/` operator), caught by `is_integer()` check.
|
||||
Reference in New Issue
Block a user