artifacts: add calculators/ — the 30 built calculators (5/variant) + machine-docs + git logs
This commit is contained in:
@ -0,0 +1,48 @@
|
||||
# STATUS-eval
|
||||
|
||||
Commit: 0a560468a157c0026515ee3edb9b8aff6b6a41ab
|
||||
|
||||
## Claims
|
||||
|
||||
| Gate | DoD item | Claim |
|
||||
|------|----------|-------|
|
||||
| D1 | arithmetic (+ - * /, precedence, parens, unary minus) | CLAIMED |
|
||||
| D2 | true division; EvalError on div-by-zero | CLAIMED |
|
||||
| D3 | whole-valued → int, non-whole → float | CLAIMED |
|
||||
| D4 | CLI prints result, exits 0; bad input → stderr, non-zero | CLAIMED |
|
||||
| D5 | test_evaluator.py passes; full suite (lex+parse+eval) passes | CLAIMED |
|
||||
|
||||
## Files changed
|
||||
|
||||
- `calc/evaluator.py` — `evaluate(node) -> int | float`, `EvalError`
|
||||
- `calc/test_evaluator.py` — 13 unittest cases for D1–D3
|
||||
- `calc.py` — CLI entry point for D4
|
||||
|
||||
## Verify commands (exact, in working directory)
|
||||
|
||||
```bash
|
||||
# D5 — full suite
|
||||
python -m unittest -q
|
||||
# expected: Ran 42 tests in ... OK
|
||||
|
||||
# D1
|
||||
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
|
||||
python calc.py "7/2" # expected: 3.5
|
||||
python calc.py "1/0" # expected: error to stderr, exit code 1
|
||||
|
||||
# D3
|
||||
python calc.py "4/2" # expected: 2 (int, no .0)
|
||||
python calc.py "7/2" # expected: 3.5 (float)
|
||||
|
||||
# D4
|
||||
python calc.py "2+3*4" # expected stdout: 14, exit 0
|
||||
python calc.py "1 +" # expected: error to stderr, exit non-zero (no traceback)
|
||||
```
|
||||
|
||||
## DONE
|
||||
Reference in New Issue
Block a user