artifacts: add calculators/ — the 30 built calculators (5/variant) + machine-docs + git logs
This commit is contained in:
@ -0,0 +1,52 @@
|
||||
# STATUS — phase eval
|
||||
|
||||
## DONE
|
||||
|
||||
## Gates claimed: D1, D2, D3, D4, D5
|
||||
|
||||
### What is claimed
|
||||
|
||||
| Gate | Description |
|
||||
|------|-------------|
|
||||
| D1 | Arithmetic correctness: `+`, `-`, `*`, `/`, precedence, parens, unary minus |
|
||||
| D2 | True division; division by zero raises `EvalError` (not `ZeroDivisionError`) |
|
||||
| D3 | Whole results → `int`, non-whole → `float` |
|
||||
| D4 | CLI `calc.py`: prints result + exit 0 on success; error to stderr + non-zero on failure |
|
||||
| D5 | `calc/test_evaluator.py` (18 tests) + prior suite (36 tests) = 54 tests, 0 failures |
|
||||
|
||||
### How to verify (exact commands)
|
||||
|
||||
```bash
|
||||
cd /tmp/ao-campaign-Ofyz4E/builder-adversary-min/r3/work
|
||||
|
||||
# D5 — full suite
|
||||
python -m unittest -q
|
||||
|
||||
# D1 — arithmetic
|
||||
python calc.py "2+3*4" # expected: 14
|
||||
python calc.py "(2+3)*4" # expected: 20
|
||||
python calc.py "8-3-2" # expected: 3
|
||||
python calc.py "-2+5" # expected: 3
|
||||
python calc.py "2*-3" # expected: -6
|
||||
|
||||
# D2 — true division + EvalError
|
||||
python calc.py "7/2" # expected: 3.5
|
||||
python calc.py "1/0" # expected: error to stderr, exit non-zero
|
||||
|
||||
# D3 — result type
|
||||
python calc.py "4/2" # expected: 2 (int, no .0)
|
||||
python calc.py "7/2" # expected: 3.5 (float)
|
||||
|
||||
# D4 — CLI error handling
|
||||
python calc.py "1 +" # expected: error to stderr, exit non-zero, no traceback
|
||||
```
|
||||
|
||||
### Files added
|
||||
|
||||
- `calc/evaluator.py` — `evaluate(node) -> int | float`, `EvalError`
|
||||
- `calc.py` — top-level CLI
|
||||
- `calc/test_evaluator.py` — 18 unittest tests covering D1–D4
|
||||
|
||||
### Commit SHA
|
||||
|
||||
`fe7e562080ee15b1f13f962171cdc4719734b062`
|
||||
Reference in New Issue
Block a user