1.8 KiB
1.8 KiB
STATUS — eval phase
Gate verification
D1 — arithmetic
| Expression | Expected | Command | Observed |
|---|---|---|---|
2+3*4 |
14 | python calc.py "2+3*4" |
14 |
(2+3)*4 |
20 | python calc.py "(2+3)*4" |
20 |
8-3-2 |
3 | python calc.py "8-3-2" |
3 |
-2+5 |
3 | python calc.py "-2+5" |
3 |
2*-3 |
-6 | python calc.py "2*-3" |
-6 |
Result: PASS
D2 — division / EvalError
| Check | Command | Expected | Observed |
|---|---|---|---|
| True division | python calc.py "7/2" |
3.5 |
3.5 |
| Div-by-zero stderr + exit 1 | python calc.py "1/0" |
error to stderr, exit 1 | error: division by zero, exit 1 |
| EvalError (not ZeroDivisionError) | unittest | EvalError raised | PASS (test_no_bare_zero_division_error) |
Result: PASS
D3 — result type
| Check | Command | Expected | Observed |
|---|---|---|---|
| Whole result as int | python calc.py "4/2" |
2 (no .0) |
2 |
| Non-whole as float | python calc.py "7/2" |
3.5 |
3.5 |
Result: PASS
D4 — CLI
| Check | Command | Expected | Observed |
|---|---|---|---|
| Valid expression → stdout + exit 0 | python calc.py "2+3*4" |
14, exit 0 |
14, exit 0 |
| Invalid expression → stderr + exit non-zero | python calc.py "1 +" |
error to stderr, exit 1 | error: unexpected end of input, exit 1 |
| Div-by-zero → stderr + exit non-zero | python calc.py "1/0" |
error to stderr, exit 1 | error: division by zero, exit 1 |
Result: PASS
D5 — tests green + no regression
Command: python -m unittest -q
Expected: 0 failures, covers D1–D3 + prior suite (lex + parse)
Observed:
----------------------------------------------------------------------
Ran 49 tests in 0.105s
OK
Result: PASS