Unit testing environment for SWI-Prolog and SICStus Prolog. For usage, please visit https://www.swi-prolog.org/pldoc/package/plunit.
never
, always
, normal
(only if not optimised)manual
, make
or make(all)
.tty
or log
. tty
uses terminal
control to overwrite successful tests, allowing the
user to see the currently running tests and output
from failed tests. This is the default of the output
is a tty. log
prints a full log of the executed
tests and their result and is intended for non-interactive
usage.always
, emit all output as it is produced, if never
,
suppress all output and if on_failure
, emit the output
if the test fails.occurs_check
flag during
testing.true
(default =false), cleanup report at the end
of run_tests/1. Used to improve cooperation with
memory debuggers such as dmalloc.end_tests(UnitName)
.test(Name, Options)
:- Body into a clause for
'unit test'/4 and 'unit body'/2.test(Name, Options)
.begin_tests(Name,
Options)
.true
, false
or
throw(E)
.The predicate run_tests/2 is synchronized. Concurrent testing may be achieved using the relevant options. See set_test_options/1. Options are passed to set_test_options/1. In addition the following options are processed:
Unit:Tests
lists, where
blocked tests or tests whose condition fails are already removed.
Each test in Tests is a term @(Test,Line)
, which serves as a
unique identifier of the test.forall(Generator, Test)
counts
as a single test. During the execution, the concrete tests of the
forall are considered "sub tests".forall(Generator, Test)
timeout
and occurs_check
option (Global -> Unit -> Test).time_limit_exceeded(Limit)
cmp_error(Cmp, E)
wrong_answer(Cmp)
wrong_error(Expect, E)
wrong_answer(Expected, Bindings)
v(V1, ...)
containing all variables at the left
side of the comparison operator on Expected.true
if Goal left
no choicepoints and false
otherwise.silent
message:
plunit(begin(Unit:Test, File:Line, Progress))
plunit(end(Unit:Test, File:Line, Progress))
fixme
for What.print_message(Level, Term)
, where Level is one of silent
or
informational
(default).forall(Gen,Test)
set. Mapped
to forall(FTotal, FFailed)
tty
format, which reuses the current
output line if the test is successful.