Windtrap_coverageSourceCoverage data collection and reporting.
Instrumented code calls register_file at module load time; visit functions increment counters during execution; an at_exit handler writes .coverage files to disk. The test runner reads data directly for inline reporting.
set_output_prefix path sets the directory and filename prefix for .coverage files written at exit. For example, set_output_prefix "/project/_build/_coverage/windtrap" writes files like /project/_build/_coverage/windtrap123456789.coverage. The directory is created automatically when coverage data is written. Can be overridden by the WINDTRAP_COVERAGE_FILE environment variable.
Register an instrumented source file. Called by PPX-generated code at module load time. Returns a visit function that increments the counter for a given point index. Registers an at_exit handler on first call.
Return the accumulated in-memory coverage data. Empty if no instrumented files have been registered.
Reset all counters to zero without removing registered files.
Magic header for .coverage files.
Serialize coverage data to the binary format used by .coverage files.
Read a single .coverage file. Returns an empty list if the file has an invalid header, is unreadable, or is truncated.
merge tbl files folds files into tbl, using saturating addition when the same source file appears more than once.
Compute aggregate (visited, total) counts across all files.
Per-file summaries sorted by filename.
Return a color style based on coverage percentage: green >= 80%, yellow >= 60%, red < 60%. Useful with Pp.styled for inline output.
collapse_ranges lines collapses a sorted list of line numbers into contiguous ranges. E.g., [1; 2; 3; 7; 8] becomes [(1, 3); (7, 8)].
format_ranges ranges formats ranges as "1-3, 7-8". Single lines appear without a dash.
Build deterministic per-file coverage reports with uncovered points and uncovered line numbers.
source_paths is used to resolve source files for line mapping. When a source file can't be found or read, uncovered_lines is empty and source_available is false.
val print_summary :
per_file:bool ->
skip_covered:bool ->
?source_paths:string list ->
coverage ->
unitPrint a human-readable coverage report to stdout with color-coded percentages. When per_file is true and source_paths is provided, uncovered line ranges are shown below each file. When skip_covered is true, files with 100% coverage are omitted from the per-file report.
Print uncovered source code snippets with surrounding context lines. Each uncovered line is prefixed with > and highlighted. Context lines are dimmed. Only files with uncovered lines and available source are shown. context defaults to 1.