interp: deterministic interpreter, aji run, run tests (P0-11, P0-12)
- src/interp/machine.zig: format-0 interpreter on the air64 target; checked/wrapping arithmetic, shifts, casts, aggregates, calls with a 1024-frame limit, traps as records with T0xxx codes - aji run: prints one JSON run record; exit code 4 on trap - conformance runner: `expect: run` with `result:`/`trap:`, every run executed twice and compared byte-for-byte; header keys must be single lowercase words - Phase 0 corpus: 3 accept, 19 reject, 15 run tests (41 total)
This commit is contained in:
1 parent
50bf990355
commit
1f5008bb37
45 files changed
+1463
-23
No files matched your search
@@ -8,6 +8,7 @@ Run with `zig build conformance` (add `-- --json` for JSON Lines, `-- --filter <
|
||||
tests/conformance/
|
||||
phase<N>/accept/*.air modules a conforming verifier MUST accept
|
||||
phase<N>/reject/*.air modules a conforming verifier MUST reject
|
||||
phase<N>/run/*.air modules that MUST verify and produce a given run record
|
||||
```
|
||||
|
||||
`phase<N>` is the implementation phase (`docs/plan/README.md`) that first requires the test to pass.
|
||||
@@ -18,11 +19,15 @@ Every test starts with a block of `;` lines. Keys:
|
||||
|
||||
| Key | Required | Value |
|
||||
|---|---|---|
|
||||
| `expect` | yes | `accept`, or `reject` followed by one or more codes from `docs/reference/error-codes.md` |
|
||||
| `expect` | yes | `accept`; `reject` followed by one or more codes from `docs/reference/error-codes.md`; or `run` |
|
||||
| `result` | with `run` | expected `value` of the run record as canonical JSON, e.g. `42` or `{"x":1}` |
|
||||
| `trap` | with `run` | expected trap code, e.g. `T0003` |
|
||||
| `phase` | yes | implementation phase number |
|
||||
| `spec` | yes | spec section that justifies the expectation |
|
||||
|
||||
Header lines without a `key:` are free-form description. The runner blanks the header before handing the module to the pipeline, so line numbers in diagnostics are unchanged and the AIR grammar does not need to know about test metadata.
|
||||
A key is a single lowercase word; header lines without a `key:` prefix are free-form description. The runner blanks the header before handing the module to the pipeline, so line numbers in diagnostics are unchanged and the AIR grammar does not need to know about test metadata.
|
||||
|
||||
`run` executes `@main` twice and fails if the two run records differ (spec 11); otherwise it compares the record with `result` or `trap`. Exactly one of them is required.
|
||||
|
||||
`reject` compares the exact multiset of error codes. Listing a code twice means two diagnostics with that code are expected.
|
||||
|
||||
@@ -32,11 +37,11 @@ Header lines without a `key:` are free-form description. The runner blanks the h
|
||||
|---|---|
|
||||
| `PASS` | result matches `expect` |
|
||||
| `FAIL` | result differs, or the header is malformed; the run exits 1 |
|
||||
| `PENDING` | the pipeline stage needed for this input is not implemented yet |
|
||||
| `PENDING` | the test's `phase` is later than `aji.implemented_phase`, or the pipeline stage it needs is not implemented yet |
|
||||
|
||||
## Rules
|
||||
|
||||
- Every verifier rule gets at least one `accept` and one `reject` test (AGENTS.md, testing policy).
|
||||
- One defect per `reject` test. A test that triggers several unrelated errors is hard to repair against.
|
||||
- Keep tests minimal: the smallest module that exhibits the rule.
|
||||
- Text AIR syntax in the seed tests is provisional until the text AIR grammar is specified (Phase 0, task P0-1). Update the tests when the grammar lands.
|
||||
- Tests are written in text AIR format 0 (`docs/reference/air-text.ebnf`) and start with the four-line module header.
|
||||
Reference in new issue
Block a user