call(Goal)
, collecting coverage information while Goal
is running. If Goal succeeds with a choice point, coverage
collection is suspended and resumed if we backtrack into Goal.
Calls to
coverage/1 may
be nested.true
(default), call show_coverage/1
passing Options to show the collected coverage data and reset
the data. When
false
, collect the data but do not reset it. If there is
already existing data the new data is added.dir(Dir)
, detailed line-by-line annotated files are created
in the directory Dir. Other options control the level of detail.
ext
or dir
option are specified.
### Clause was never executed. ++N Clause was entered N times and always succeeded --N Clause was entered N times and never succeeded +N-M Clause has succeeded N times and failed M times +N*M Clause was entered N times and succeeded M times
All call sites are annotated using the same conventions,
except that ---
is used to annotate subgoals that were
never called.
true
(default), add line numbers to the annotated file.true
.
For example, run a goal and create annotated files in a directory
cov
using:
?- show_coverage([dir(cov)]).
less
may be used with the -r
flag. Alternatively, programs such as ansi2html
(Linux) may
be used to convert the files to HTML. It would probably be better to
integrate the output generation with library(pldoc/doc_htmlsrc)
.
The File is opened using lock(exclusive)
,
which implies that, provided the OS and file system implements file
locking, multiple processes may save coverage data to the same file.
The saved data is highly specific to the setup in which it has been created. It can typically only be reloaded using cov_load_data/2 in the same Prolog executable using the same options and with all relevant source file unmodified at the same location.
Reproducibility can be improved by using‘.qlf` files or saved states.
true
, do not emit messages on not loaded source files.
Data is assumed to be reliable if the Nth-clause of a predicate is
loaded from the same file at the same line number and has the same size.
Unreliable data is ignored, silently if silent(true)
is
used.