Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -722,11 +722,14 @@ Six suites run under CTest:
- **`test_vectors`** — replays the shared `assets/test_vectors.json` for encode,
decode, byte-at-a-time streaming and field skipping (every vector carrying
`skip_ids`, whole and one byte at a time): the `vectors`, `invalid_utf8`,
`sequence_growth`, `header_limits` and `boolean_tolerant` groups — the last
being §4.4's "canonical on encode, tolerant on decode", where every non-zero
value at a boolean position decodes to `true` and re-encodes to `1` — plus
guards that fail when the file's envelope drifts or the loader stops carrying
the sizes the vectors need.
`sequence_growth`, `header_limits`, `header_limits_nested` and
`boolean_tolerant` groups — the last being §4.4's "canonical on encode,
tolerant on decode", where every non-zero value at a boolean position decodes
to `true` and re-encodes to `1` — plus guards that fail when the file's
envelope drifts or the loader stops carrying the sizes the vectors need. The
nested header-ceiling block runs a second pass with the ceiling lifted, so a
rejection that came from somewhere other than the ceiling cannot read as
coverage.
- **`test_bench_tools`** — holds the benchmark tooling to BENCH_SPEC: the
workload list, both output tables, and the cross-port parity sizes.
- **`test_ci_workflows`** — reads `.github/workflows/` and requires both build
Expand Down
45 changes: 31 additions & 14 deletions test/shared/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,16 @@ fixed-size, and main() measures the largest loaded skip list, id, array and
payload against the sizes the current file needs, so a cap that truncated one
would fail loudly rather than quietly test less.

The file carries six top-level groups and this repo runs five of them: `vectors`
The file carries six top-level groups and this repo runs all six: `vectors`
(the wire-format ground truth), `invalid_utf8` (negative `string` payloads),
`sequence_growth` (CORELIB_PLAN §7.2 item 8 — a wrapper array's container growth,
keyed by a delivery sequence of element ids rather than by bytes, with indices
relative to the port's own configured `max_dyn_array_count`), `header_limits`
(§6.2.1/§6.3 — bytes that declare a length or count and then end, with no payload
behind them) and `boolean_tolerant` (§4.4 — see below). The sixth,
`header_limits_nested`, is not adopted here yet; an unknown top-level block is
ignored by a consumer that does not know it, which is the corpus's
forward-compatibility rule. The growth block is gated by a `dynamic_arrays`
capability tag: a statically bounded profile never grows and skips it. This
corelib collects into `std::vector`, so it runs it.
behind them), `header_limits_nested` (the same bytes one or two sequence frames
deeper) and `boolean_tolerant` (§4.4 — see below). The growth block is gated by a
`dynamic_arrays` capability tag: a statically bounded profile never grows and
skips it. This corelib collects into `std::vector`, so it runs it.

`header_limits` is gated by `receiver_caps`, a *profile* capability: a port
declares it when its generated code carries §6.2.1 receiver caps distinct from
Expand All @@ -56,6 +54,25 @@ reduced-build rejection a *vector* gets: the cases assert a rejection with a
specific category, so a build that cannot represent the construct would reject
it for an unrelated reason and appear to pass while testing nothing.

`header_limits_nested` is the **depth** axis of that same block, and a separate
top-level key deliberately: its byte strings open with a sequence header, so a
runner that ignored the new `frames` key would bind its ceiling at the top level,
cap nothing, and answer `incomplete` where the case demands `limit_exceeded`. It
adds `frames` — the chain of sequence field ids the target field is nested in,
outermost first — and nothing else; the loader, the leaf read and the terminality
rule are the flat block's, shared. Depth is its own axis because a port can carry
the schema bound into a sequence and leave the receiver cap bound at the top
level.

That block runs a **second, independent pass with the ceiling lifted**, and that
pass is what makes it evidence. Its cases end at end-of-input with one or two
frames still open, which is a fully sufficient second reason to answer
`incomplete` — so a rejection that came from somewhere else entirely (a depth
guard, a refusal of unclosed frames) would pass the forward pass while never
consulting the ceiling under test. Lifting the ceiling must change the answer;
the pass asserts only that it *changed*, and asserts how many cases it checked,
because a control loop that examined nothing is green and proves nothing.

`boolean_tolerant` (CORELIB_PLAN §4.4) is the one block whose bytes no conforming
encoder produces, which is why it is hand-authored and cannot live in `vectors`:
"canonical on encode, tolerant on decode" says an encoder MUST write `true` as
Expand Down Expand Up @@ -131,13 +148,13 @@ happens:
authoritative format description.

The **envelope** — the file's top-level keys — is upstream's too, and it has
grown a key four times (`invalid_utf8`, then `sequence_growth`, then
`header_limits`, then `boolean_tolerant`). `test/test_vectors.cpp` reads and parses
the file exactly once and walks every group off that single parse; each walker
demands its own top-level key and fails the run when it is absent, renamed or
empty. A re-sync that reshapes the envelope therefore shows up as a red
`test_vectors` reporting `vector file has no non-empty "<key>" array`, not as
a green run that silently tested nothing.
grown a key five times (`invalid_utf8`, then `sequence_growth`, then
`header_limits`, then `header_limits_nested`, then `boolean_tolerant`).
`test/test_vectors.cpp` reads and parses the file exactly once and walks every
group off that single parse; each walker demands its own top-level key and
fails the run when it is absent, renamed or empty. A re-sync that reshapes the
envelope therefore shows up as a red `test_vectors` reporting `vector file has
no non-empty "<key>" array`, not as a green run that silently tested nothing.

After any re-sync, run the suite (`ctest --test-dir build`) — a green
`test_vectors` run is what proves this implementation still matches the shared
Expand Down
Loading
Loading