[semidet]show_coverage(:Goal)
[semidet]show_coverage(:Goal,
+Options)
[semidet]show_coverage(:Goal,
+Modules:list(atom))Report on coverage by Goal. Goal is executed as in once/1. Options
processed:
- modules(+Modules)
- Provide a detailed report on Modules. For backwards
compatibility this is the same as providing a list of modules in the
second argument.
- annotate(+Bool)
- Create an annotated file for the detailed results. This is implied if
the
ext
or dir
option are specified.
- ext(+Ext)
- Extension to use for the annotated file. Default is‘.cov`.
- dir(+Dir)
- Dump the annotations in the given directory. If not given, the annotated
files are created in the same directory as the source file. Each clause
that is related to a physical line in the file is annotated with one of:
### | 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.
- line_numbers(Boolean)
- If
true
(default), add line numbers to the annotated file.
- color(Boolean)
- Controls using ANSI escape sequences to color the output in the
annotated source. Default is
true
.
For example, run a goal and create annotated files in a directory
cov
using:
?- show_coverage(mygoal, [dir(cov)]).
- bug
- Color annotations are created using ANSI escape sequences. On most
systems these are displayed if the file is printed on the terminal. On
most systems
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)
.