If you run extensive tests on your code, you often want to figure out if the tests exercise all parts of the code. This is called (test) coverage. The file coverage.fs contains tools for measuring the coverage as well as execution frequency.
Code coverage inserts counting code in every basic block (straight-line code sequence) loaded after coverage.fs. Each time that code is run, it increments the counter for that basic block. Later you can show the source file with the counts inserted in these basic blocks.
.coverage( – ) gforth-experimental “.coverage”
Show code with execution frequencies.
annotate-cov( – ) gforth-experimental “annotate-cov”
For every file with coverage information, produce a
file that has the execution frequencies inserted. We recommend
bw-cover first (with the default
color-cover you get escape sequences in the files).
cov%( – ) gforth-experimental “cov%”
Print the percentage of basic blocks loaded after coverage.fs that are executed at least once.
.cover-raw( – ) gforth-experimental “.cover-raw”
Print raw execution counts.
By default, the counts are shown in colour (using ANSI escape
sequences), but you can use
bw-cover to show them in
parenthesized form without escape sequences.
bw-cover( – ) gforth-1.0 “bw-cover”
Print execution counts in parentheses (source-code compatible). Remove coverage comment.
color-cover( – ) gforth-1.0 “color-cover”
Print execution counts in colours (default).
You can save and reload the coverage counters in binary format, to aggregate coverage counters across several test runs.
save-cov( – ) gforth-experimental “save-cov”
Save coverage counters.
load-cov( – ) gforth-experimental “load-cov”
Load coverage counters. obtains library handle obtains symbol address allocates and initializes proc stub stub format: linked list in library address of proc ptr to OS name of symbol as counted string threaded code for invocation Creates a named proc stub loads library "file" and creates a proc defining word "name" library format: linked list of libraries library handle linked list of library’s procs OS name of library as counted string link between callbacks
cov+( – ) gforth-experimental “cov+”
Add a coverage tag here.