1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
# test coverage inventory
this inventory covers runtime ownership boundaries, fuzzing and growth, variable hovers, unused-argument hints, the `rt.s_to_n` definition, string-literal types, and public standard-library documentation. it records existing tests and focused runs made during the documentation pass; it does not claim that the full suite ran.
## runtime `unchecked` boundaries
`src/runtime/rt.zc` still marks these functions `unchecked`: `rt.copy_w`, `rt.fill_w`, `rt.free`, `rt.recycle`, `rt.recycle_leaf`, `rt.cons`, `rt.triple`, `rt.dnew`, `rt.dgrow`, `rt.dpush`, `rt.reserve_mark`, `rt.gc`, and `rt.readfile`.
existing runtime acceptance coverage exercises portions of those paths: `tests/programs/allocfast.zc`, `buddy.zc`, `gc.zc`, `quarantine.zc`, `recycle.zc`, `roots.zc`, `share.zc`, `sys.zc`, and `strings.zc` cover allocation, collection, ownership cells, file access, and string conversion. `tests/drivers/compiler_growth_test.py` stresses mark work and collection after table growth. `tests/errors/unchecked_touch.zc` rejects access to a checked owned value from an unchecked block. `tests/errors/temporary_unknown.zc` and `storage_analysis_test.js` exercise conservative behavior for unknown or unchecked effects.
this is indirect coverage, not proof that each runtime function is now checked. `tests/drivers/core_lsp_test.js` checks maintained source files without severity-1 diagnostics, but an explicit `unchecked` function can pass that check while bypassing ownership analysis. there is no test that enumerates the runtime annotations, nor a per-function checked-call acceptance and rejection matrix for these boundaries. in particular, removal still needs regressions for the ownership and drop contracts of raw word copying, allocator fast paths, shared cells, growable arrays, collector work, and file results.
## fuzzing, image growth, memory limits, and lsp longevity
| area | existing tests and what they assert | remaining gap |
| --- | --- | --- |
| compiler, runtime, and stdlib fuzz | `fuzz_compiler.py` generates 128 arithmetic expressions, 300 scoped allocations plus collection, 16 runtime compiles, source-immutability checks, and 32 randomized `Text`/`Bytes` cases; it compares native, microcore, and optionally javascript output. `fuzz_malformed.py` runs 256 random token streams and 64 byte mutations on native and microcore, checking for crashes, timeouts, and host disagreement. `fuzz_wasm.js` covers 128 expressions, 300 allocations plus collection, and 32 `Text`/`Bytes` cases. | malformed inputs have no independent accept/reject oracle; generated ownership/analyzer properties are not fuzzed. the wasm fuzz does not include runtime compilation or source-immutability checks. |
| image and code growth | `image_growth_test.py` checks that image output grows past its initial buffer and genome slot while logical addresses and an older local remain valid. `code_emission_growth_test.py` checks stable functions, globals, strings, quotes, float payloads, and vm/micro recipes across code segments. `code_address_growth_test.py` checks new addresses, warm calls, bulk rewrites, and denied metadata growth. `seed_growth_test.py` checks stage-0 input over 5 mb and image output beyond its initial reservation. | there is no randomized compiler-image mutation or malformed-image oracle; these are focused growth and rewrite regressions. |
| memory limits | `memory_limits_test.py` checks invalid startup configuration, successful growth, denied growth, and changing limits on native, microcore, and javascript. `stack_growth_test.py` checks explicit reservations, failures, 40,000 operands, and 70,000 return addresses. `layout_config_test.py` checks map arithmetic rejection and generated controls. `compiler_growth_test.py` and `parser_growth_test.py` exercise growing tables and scratch storage. | coverage samples configured limits and selected capacities; it is not an exhaustive boundary matrix for every table or every host configuration. |
| long-running lsp | `fuzz_lsp.js` keeps one native server alive for 32 open/change sequences and 96 open/change/close/reopen cache cycles, requesting semantic tokens and checking diagnostic recovery. `lsp_growth_test.js` opens 32 documents with long uris and documentation, then checks diagnostics and hover text. `protocol_growth_test.js` checks long request ids, extra headers, nested json, and 24 document checks. `analysis_cache_test.js` checks reuse and invalidation after edits, includes, and reopen. | these check protocol/cache correctness, not process memory growth or bounded memory after prolonged use. the 96-cycle fuzz currently targets the native server, not wasm or vm hosts. |
## variable hovers and value previews
`hover_features_test.js` checks typed global and fixed-array hovers at uses, field and parameter hovers, inferred locals and function signatures, pointer aliases, closures, enum types, and embedded compiler/runtime/library documentation. it checks the type-first global format at both declarations and uses for a word-string global, a fixed global array, and a typed global. `hover_surface_test.js` checks embedded source, constants and backing arrays, asm descriptions, `include std;`, section comments, and trailing declaration comments. `storage_analysis_test.js` checks size and lifetime metadata, including bounds, ended lifetimes, stack storage, and unknown effects. `hover_values_test.js` checks position-specific local, global, constant, enum, integer, float, and string values, including invalidation after unknown calls, writes, and control flow. `vscode_hover_test.js` also checks a real editor hover for a value before and after an unknown call.
the coverage is spread across drivers. `hover_values_test.js` starts a fresh server for each hover, so it does not verify several value requests against one open fixture in one server session. the other hover drivers cover multiple requests or documents, but no single test matrix checks every variable form at both declaration and use positions across native, javascript, and wasm hosts. the javascript and wasm hover surfaces are exercised by `tests/test.sh`; the value-preview and feature drivers exist but are not invoked by that script.
## recursive type inference
the `inference` group in `toolchain_lsp_contract_test.js` checks type propagation from typed callees through caller parameters and return aliases, including a twelve-function chain declared in reverse order, an uncalled wrapper, and recursion anchored by a typed callee. it also checks that conflicting caller argument types and unknown reassignment do not produce an invented type, that array indices and typed fields do not force a scalar parameter type, and that owned raw-list results preserve `word.u` while capacity and caller parameters infer as `int`. `inference_growth_test.py` checks large function/local sets, late parameters and nested closures, plus stable pointer annotations for array and struct aliases. the learning example covers a reverse-declared chain, typed recursive anchor and owned raw-list returns.
## const fixed arrays
the `qualifiers` group in `toolchain_lsp_contract_test.js` checks both qualifier orders, hover shape, element writes, increments, compound writes with typechecking disabled, rebinding, mutable-reference conversion, read-only aliases, and explicit read-only parameters. mutable arrays are accepted by read-only formals. the compiler contract fixtures also check accepted reads, rejected mutation, packed elements and global arrays. the 15 compiler contracts pass on native and micro, and the three qualifier hover cases pass on the language server. standard-library array algorithms on const-qualified arrays have not been verified.
## public standard-library documentation
`src/lib/std.zc` documents public operations for output capture, numeric helpers, packed byte strings, host access, arenas, growable byte buffers, and array algorithms, including parameter and return behavior. the array algorithms document their callback roles, result types, traversal order, and reference sharing. the compiler carries the module through an `embed` declaration, so its embedded text is the module file as of the build. `hover_surface_test.js` and `hover_features_test.js` check selected embedded library documentation; they do not assert that every public function has a description. edge-case behavior for the broader standard-library API still needs dedicated acceptance tests.
## unused-argument hints
`hints_test.js` checks informational severity and positional `hints on`, `hints small`, and `hints off` behavior for local-variable hints and style hints. `small` retains these hint kinds with compact markers; it does not reduce the set of hints. the `magic` group in `toolchain_lsp_contract_test.js` checks compact severity, suppression after `off`, and magic-number suppression by an inline block comment immediately before a literal; a comment before another operand does not suppress it. the `arguments` group covers unused, used, discard, write-only, and shadowed parameters, plus method, closure, and generic arguments and the positional directives.
## `rt.s_to_n` definition navigation
`tests/programs/strings.zc` exercises runtime conversion through `rt.s_to_n`. `nav_test.js` checks definition navigation to a runtime function, standard-library functions and types, and embedded source text. the `navigation` group in `toolchain_lsp_contract_test.js` specifically checks that `rt.s_to_n` opens at its runtime declaration. virtual runtime source checks do not currently cover javascript or wasm hosts.
## string-literal types
word-string inference is covered at a global's declaration and use by `hover_features_test.js`, and `toolchain_lsp_contract_test.js` checks a grouped local and inferred word-string return. the same contract driver checks `bstr` through a declaration, parameter, return, and use. `completion_test.js` checks local completion details for both `char*` and `bstr`. runtime behavior has coverage in `tests/programs/strings.zc`, `bytes.zc`, `fuzz_compiler.py`, and `fuzz_wasm.js`.
the remaining string-type gaps include reassignment and consistent coverage across all supported hosts. the current focused cases cover representative inference and navigation paths, not every context or backend.
## file namespaces and array receivers
`toolchain_lsp_contract_test.js` checks that module-qualified use requires an explicit include and that completions expose only imported modules. `include_test.js` checks file-relative and nested includes, `include std;`, and diagnostics for missing or invalid modules; it passes with the current namespace fixture and diagnostic location. `learn.py` verifies a file-scoped namespace with multiple imports.
`completion_test.js` checks receiver completion for growable arrays and confirms that fixed arrays offer only `len` and `cap`; it also checks the nine standard-library algorithms on fixed arrays and requires `include std;` for them. the learn fixtures exercise array receiver syntax. `array_methods_test.py` covers growable and fixed receivers, packed elements, callbacks, inferred map results, fixed-array filter, searching, predicates, reduction, empty inputs, shallow sharing for references, missing imports, ownership transfers, resize cleanup, and aggregate-value restrictions. all 39 cases pass on native and micro, including pop ownership transfer, cleanup of removed children after shrink, borrowed callbacks, packed strings, and coercion.
## import quick fixes and module hovers
the `quickfix` group in `toolchain_lsp_contract_test.js` checks missing runtime, compiler and core imports; qualification of bare exports; preservation of namespaces, comments and crlf; no duplicate import; and no unrelated edits. the editor's `codeactions_client_test.js` checks workspace-edit conversion, rejects stale document versions, and keeps protocol version epochs separate from editor versions. `ext_cache_test.js` exercises the real editor client with the bundled wasm server, including its code-action and completion providers. the `modulehover` group checks include-name hovers for `rt`, `run`, `core`, `lsp`, `std` and `icon`, including comments and newlines in the include list and source-library overview comments after namespace/include headers. `namespacecompletion` checks exported members, signatures and docs for those modules. `navigation` checks the embedded `core.zc`, the distinction between `core.syscall` and `rt.syscall`, and identity-preserving references.
the formatter indents case labels one level inside their switch by default (`CaseIndent: 1`); `CaseIndent: 0` aligns the labels with the switch. `format_test.js` checks token preservation and idempotence for every repository `.zc` file.
## command-line help and run-only images
`cli_help_test.py` checks `--help` and `-h` with stdin left open and invalid memory environment settings for the native and micro vms, language server, bootstrap compiler, image converter, map generator, runner scripts, tool scripts, and javascript utilities. it checks unknown-option rejection and confirms that the language server's `--format`, `--annotate` and `--types` source options remain available. `runtime_image_test.py` checks self-hosted run-only images for enhancement startup, array algorithms, and owned `pop`; the runtime parses enhancement descriptors before initializing the heap. `make run` and `zcc` still compile through stage 0 and therefore accept its source subset, while `src/tools/build.zc` builds full-language run-only images.
## focused commands
run from the repository root. native binaries and the language server must already be built; the wasm command needs a built `build/web/zc.wasm` (`make web`).
```sh
python3 tests/drivers/fuzz_compiler.py build/bin/zy build/bin/zym --js
python3 tests/drivers/fuzz_malformed.py build/bin/zy build/bin/zym
node tests/drivers/fuzz_wasm.js build/web/zc.wasm
python3 tests/drivers/image_growth_test.py build/bin/zy
python3 tests/drivers/code_emission_growth_test.py build/bin/zy
python3 tests/drivers/code_address_growth_test.py build/bin/zy
python3 tests/drivers/seed_growth_test.py
python3 tests/drivers/memory_limits_test.py
python3 tests/drivers/stack_growth_test.py build/bin/zy
python3 tests/drivers/layout_config_test.py
python3 tests/drivers/compiler_growth_test.py build/bin/zy
python3 tests/drivers/parser_growth_test.py build/bin/zy
node tests/drivers/fuzz_lsp.js build/bin/zclsp
node tests/drivers/lsp_growth_test.js build/bin/zclsp
node tests/drivers/protocol_growth_test.js build/bin/zclsp
node tests/drivers/core_lsp_test.js build/bin/zclsp
node tests/drivers/hover_values_test.js build/bin/zclsp
node tests/drivers/hover_features_test.js build/bin/zclsp
node tests/drivers/hover_surface_test.js build/bin/zclsp
CONTRACT_GROUP=inference node tests/drivers/toolchain_lsp_contract_test.js build/bin/zclsp
CONTRACT_GROUP=qualifiers node tests/drivers/toolchain_lsp_contract_test.js build/bin/zclsp
python3 tests/drivers/compiler_contract_test.py build/bin/zy --group qualifiers
python3 tests/drivers/compiler_contract_test.py build/bin/zym --group qualifiers
python3 tests/drivers/inference_growth_test.py build/bin/zclsp
node tests/drivers/storage_analysis_test.js build/bin/zclsp
node tests/drivers/hints_test.js build/bin/zclsp
node tests/drivers/include_test.js build/bin/zclsp
CONTRACT_GROUP=quickfix node tests/drivers/toolchain_lsp_contract_test.js build/bin/zclsp
CONTRACT_GROUP=modulehover node tests/drivers/toolchain_lsp_contract_test.js build/bin/zclsp
CONTRACT_GROUP=namespacecompletion node tests/drivers/toolchain_lsp_contract_test.js build/bin/zclsp
CONTRACT_GROUP=navigation node tests/drivers/toolchain_lsp_contract_test.js build/bin/zclsp
node tests/drivers/codeactions_client_test.js
node tests/drivers/ext_cache_test.js
python3 tests/drivers/array_methods_test.py build/bin/zy
python3 tests/drivers/array_methods_test.py build/bin/zy --case map
python3 tests/drivers/array_methods_test.py build/bin/zy --case filter
python3 tests/drivers/array_methods_test.py build/bin/zy --case search
python3 tests/drivers/array_methods_test.py build/bin/zy --case reduce
python3 tests/drivers/cli_help_test.py
python3 tests/drivers/runtime_image_test.py
CONTRACT_GROUP=magic node tests/drivers/toolchain_lsp_contract_test.js build/bin/zclsp
CONTRACT_GROUP=strings node tests/drivers/toolchain_lsp_contract_test.js build/bin/zclsp
CONTRACT_GROUP=arguments node tests/drivers/toolchain_lsp_contract_test.js build/bin/zclsp
CONTRACT_GROUP=modules node tests/drivers/toolchain_lsp_contract_test.js build/bin/zclsp
node tests/drivers/nav_test.js build/bin/zclsp
tests/runerr.sh build/bin/zy tests/errors
```
|