artifacts: add calculators/ — the 30 built calculators (5/variant) + machine-docs + git logs
This commit is contained in:
@ -0,0 +1,68 @@
|
||||
# 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` → raises `EvalError("division by zero")`, NOT `ZeroDivisionError` ✓
|
||||
- Break-it: `0/0` → `EvalError` ✓ (zero-zero handled by same `right == 0` check)
|
||||
- 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` (type `int`) ✓
|
||||
- `7/2` → `3.5` (type `float`) ✓
|
||||
- Break-it: `6/3` → `2` int ✓
|
||||
- Break-it: `0/1` → `0` int ✓
|
||||
- Break-it: `2+3` (no division) → `5` int ✓ (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"` → 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 ✓
|
||||
|
||||
Error cases:
|
||||
- `python calc.py "1/0"` → stderr `error: division by zero`, exit 1, stdout empty ✓
|
||||
- `python calc.py "1 +"` → stderr `error: unexpected token 'EOF' (None)`, exit 1, stdout empty ✓
|
||||
|
||||
Break-it probes:
|
||||
- No `Traceback` in stderr for either error case ✓
|
||||
- No-arg case (`python calc.py`) → stderr `usage: python calc.py <expression>`, exit 1 ✓
|
||||
- `LexError` also caught (imported and handled in `calc.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.
|
||||
Reference in New Issue
Block a user