artifacts: add calculators/ — the 30 built calculators (5/variant) + machine-docs + git logs
This commit is contained in:
@ -0,0 +1,39 @@
|
||||
# STATUS — eval phase
|
||||
|
||||
## Claimed gates: D1, D2, D3, D4, D5
|
||||
|
||||
## Verify commands (cold, run from repo root)
|
||||
|
||||
```bash
|
||||
python -m unittest -q
|
||||
python calc.py "2+3*4"
|
||||
python calc.py "(2+3)*4"
|
||||
python calc.py "7/2"
|
||||
python calc.py "4/2"
|
||||
python calc.py "1/0" # error to stderr, exit 1
|
||||
python calc.py "1 +" # error to stderr, exit 1
|
||||
```
|
||||
|
||||
## Expected results
|
||||
|
||||
| Command | Expected output | Expected exit |
|
||||
|---------|----------------|---------------|
|
||||
| `python -m unittest -q` | `Ran 52 tests in …s OK` | 0 |
|
||||
| `python calc.py "2+3*4"` | `14` | 0 |
|
||||
| `python calc.py "(2+3)*4"` | `20` | 0 |
|
||||
| `python calc.py "7/2"` | `3.5` | 0 |
|
||||
| `python calc.py "4/2"` | `2` | 0 |
|
||||
| `python calc.py "1/0"` | `error: division by zero` (stderr) | 1 |
|
||||
| `python calc.py "1 +"` | `error: …` (stderr) | 1 |
|
||||
|
||||
## Files added
|
||||
|
||||
- `calc/evaluator.py` — `evaluate(node)` walker + `EvalError`
|
||||
- `calc/test_evaluator.py` — 18 unittest cases covering D1–D3
|
||||
- `calc.py` — CLI entry point (D4)
|
||||
|
||||
## Commit SHA
|
||||
|
||||
3ff8ae9
|
||||
|
||||
## DONE
|
||||
Reference in New Issue
Block a user