artifacts: add calculators/ — the 30 built calculators (5/variant) + machine-docs + git logs
This commit is contained in:
@ -0,0 +1,54 @@
|
||||
# STATUS — eval phase (Builder)
|
||||
|
||||
## Current State
|
||||
SELF-CERTIFIED (build phase per REVIEW CADENCE — DEFERRED rule)
|
||||
|
||||
All DoD items implemented and verified locally. Test suite: 53 tests, 0 failures.
|
||||
|
||||
## Commit
|
||||
`6b5f4d2` feat(eval): implement evaluator + CLI — all D1-D5 green, 53 tests pass
|
||||
|
||||
## Files Produced
|
||||
- `calc/evaluator.py` — `evaluate(node) -> int|float`, `EvalError`
|
||||
- `calc.py` — CLI entry point
|
||||
- `calc/test_evaluator.py` — unittest suite covering D1–D4
|
||||
|
||||
## Verification Commands (Adversary can cold-verify)
|
||||
|
||||
```bash
|
||||
# Full suite (D5 — 53 tests, 0 failures)
|
||||
python -m unittest -q
|
||||
|
||||
# D1 — arithmetic / precedence / parens / unary minus
|
||||
python calc.py "2+3*4" # → 14
|
||||
python calc.py "(2+3)*4" # → 20
|
||||
python calc.py "8-3-2" # → 3
|
||||
python calc.py "-2+5" # → 3
|
||||
python calc.py "2*-3" # → -6
|
||||
|
||||
# D2 — true division + EvalError
|
||||
python calc.py "7/2" # → 3.5
|
||||
python calc.py "1/0" # → error to stderr, exit 1
|
||||
|
||||
# D3 — result type printing
|
||||
python calc.py "4/2" # → 2 (no trailing .0)
|
||||
python calc.py "7/2" # → 3.5
|
||||
|
||||
# D4 — CLI error path
|
||||
python calc.py "1 +" # → error to stderr, exit 1 (no traceback)
|
||||
```
|
||||
|
||||
## Expected Outputs (exact)
|
||||
| command | stdout | stderr | exit |
|
||||
|---------|--------|--------|------|
|
||||
| `python calc.py "2+3*4"` | `14` | (empty) | 0 |
|
||||
| `python calc.py "(2+3)*4"` | `20` | (empty) | 0 |
|
||||
| `python calc.py "8-3-2"` | `3` | (empty) | 0 |
|
||||
| `python calc.py "-2+5"` | `3` | (empty) | 0 |
|
||||
| `python calc.py "2*-3"` | `-6` | (empty) | 0 |
|
||||
| `python calc.py "7/2"` | `3.5` | (empty) | 0 |
|
||||
| `python calc.py "4/2"` | `2` | (empty) | 0 |
|
||||
| `python calc.py "1/0"` | (empty) | `error: division by zero` | 1 |
|
||||
| `python calc.py "1 +"` | (empty) | `error: ...` | 1 |
|
||||
|
||||
## DONE
|
||||
Reference in New Issue
Block a user