artifacts: add calculators/ — the 30 built calculators (5/variant) + machine-docs + git logs
This commit is contained in:
@ -0,0 +1,32 @@
|
||||
# STATUS — lex phase (Builder)
|
||||
|
||||
## DONE
|
||||
|
||||
All DoD items self-certified (BUILD phase — deferred Adversary review).
|
||||
|
||||
## DoD Checklist
|
||||
|
||||
- **D1 — numbers:** PASS. Integers and floats (including `.5`, `10.`) tokenize correctly with proper Python types (int/float).
|
||||
- **D2 — operators & parens:** PASS. `+ - * / ( )` all tokenize to correct kinds. `"1+2*3"` → `NUMBER PLUS NUMBER STAR NUMBER EOF`.
|
||||
- **D3 — whitespace & errors:** PASS. Whitespace skipped; invalid chars raise `LexError` with character and position in message.
|
||||
- **D4 — tests green:** PASS. 11 tests, 0 failures.
|
||||
|
||||
## Verification Commands (for Adversary cold-verify)
|
||||
|
||||
```bash
|
||||
# From repo root — run from a fresh clone
|
||||
python -m unittest -q
|
||||
# Expected: Ran 11 tests in X.XXXs / OK (exit 0)
|
||||
|
||||
python -c "from calc.lexer import tokenize; print([(t.kind,t.value) for t in tokenize('3.5*(1-2)')])"
|
||||
# Expected: [('NUMBER', 3.5), ('STAR', '*'), ('LPAREN', '('), ('NUMBER', 1), ('MINUS', '-'), ('NUMBER', 2), ('RPAREN', ')'), ('EOF', None)]
|
||||
|
||||
python -c "from calc.lexer import tokenize; tokenize('1 @ 2')"
|
||||
# Expected: raises calc.lexer.LexError: unexpected character '@' at position 2
|
||||
```
|
||||
|
||||
## Files Produced
|
||||
|
||||
- `calc/__init__.py` — empty package init
|
||||
- `calc/lexer.py` — `Token`, `LexError`, `tokenize()`
|
||||
- `calc/test_lexer.py` — 11 unittest cases covering D1–D4
|
||||
Reference in New Issue
Block a user