object
A unit test framework supporting predicate clause coverage, determinism testing, input/output testing, and multiple test dialects.
Paulo Moura
2.7
2015/10/17
static, context_switching_calls
public expanding
logtalk::trace_event/2
Declares entities being tested for which code coverage information should be collected.
static
cover(Entity)
cover(?entity_identifier) – zero_or_more
Runs the unit tests, writing the results to the specified file. Mode can be either "write" (to create a new file) or "append" (to add results to an existing file).
static
run(File,Mode)
run(+atom,+atom) – one
Runs the unit tests, writing the results to the current output stream.
static
run – one
True if a goal succeeds once without leaving choice-points.
static
deterministic(Goal)
deterministic(0)
deterministic(+callable) – zero_or_one
Benchmarks a goal and returns the total execution time in seconds.
static
benchmark(Goal,Time)
benchmark(0,*)
benchmark(+callable,-float) – zero_or_one
Benchmarks a goal by repeating it the specified number of times and returning the total execution time in seconds.
static
benchmark(Goal,Repetitions,Time)
benchmark(0,*,*)
benchmark(+callable,+integer,-float) – zero_or_one
Compares two floats for approximate equality using 100*epsilon for the absolute error and, if that fails, 99.999% accuracy for the relative error. Handy when writing certain unit tests but the default precision values may not be adequate for all cases.
static
=~=(Float1,Float2)
=~=(+float,+float) – zero_or_one
Runs all defined unit tests.
static
run_tests – one
Runs a list of defined tests.
static
run_tests(Tests,File)
run_tests(+list(callable),+atom) – one
Verifies conditions for running the tests. Defaults to the goal true.
static
condition – zero_or_one
Setup environment before running the test set. Defaults to the goal true.
static
setup – zero_or_one
Cleanup environment after running the test set. Defaults to the goal true.
static
cleanup – zero_or_one
Note to be printed after the test results. Defaults to the empty atom.
static
note(?atom) – zero_or_one
Creates a temporary file with the given text contents and opens it for reading referenced by the given alias and using the additional options. If not eof_action/1 option is specified, its value will be the default used by the backend compiler.
static
set_text_input(Alias,Contents,Options)
set_text_input(+atom,+atom,+list(stream_option)) – one
Creates a temporary file with the given text contents and opens it for reading referenced by the given alias and using the default end-of-file action for the used backend compiler.
static
set_text_input(Alias,Contents)
set_text_input(+atom,+atom) – one
Creates a temporary file with the given text contents, opens it for reading using the default end-of-file action for the used backend compiler, and sets the current input stream to the file.
static
set_text_input(Contents)
set_text_input(+atom) – one
Checks that the temporary file being written have the expected text contents.
static
check_text_input(Alias,Contents)
check_text_input(+atom,+atom) – zero_or_one
Checks that the temporary file being written have the expected text contents.
static
check_text_input(Contents)
check_text_input(+atom) – zero_or_one
Cleans the temporary file used when testing text input.
static
clean_text_input – one
Creates a temporary file with the given binary contents and opens it for reading referenced by the given alias and using the additional options. If not eof_action/1 option is specified, its value will be the default used by the backend compiler.
static
set_binary_input(Alias,Bytes,Options)
set_binary_input(+atom,+list(byte),+list(stream_option)) – one
Creates a temporary file with the given binary contents and opens it for reading referenced by the given alias and using the default end-of-file action for the used backend compiler.
static
set_binary_input(Alias,Bytes)
set_binary_input(+atom,+list(byte)) – one
Creates a temporary file with the given binary contents, opens it for reading using the default end-of-file action for the used backend compiler, and sets the current input stream to the file.
static
set_binary_input(Bytes)
set_binary_input(+list(byte)) – one
Checks that the temporary file (referenced with the given alias) have the expected binary contents.
static
check_binary_input(Alias,Bytes)
check_binary_input(+atom,+list(byte)) – zero_or_one
Checks that the temporary file have the expected binary contents.
static
check_binary_input(Bytes)
check_binary_input(+list(byte)) – zero_or_one
Cleans the temporary file used when testing binary input.
static
clean_binary_input – one
Creates a temporary file with the given text contents and referenced with the given alias.
static
set_text_output(Alias,Contents)
set_text_output(+atom,+atom) – one
Creates a temporary file with the given text contents and sets the current output stream to the file.
static
set_text_output(Contents)
set_text_output(+atom) – one
Checks that the temporary file being written have the expected text contents.
static
check_text_output(Alias,Contents)
check_text_output(+atom,+atom) – zero_or_one
Checks that the temporary file being written have the expected text contents.
static
check_text_output(Contents)
check_text_output(+atom) – zero_or_one
Cleans the temporary file used when testing text output.
static
clean_text_output – one
Creates a temporary file with the given binary contents and referenced with the given alias.
static
set_binary_output(Alias,Bytes)
set_binary_output(+atom,+list(byte)) – one
Creates a temporary file with the given binary contents and sets the current output stream to the file.
static
set_binary_output(Bytes)
set_binary_output(+list(byte)) – one
Checks that the temporary file (referenced with the given alias) have the expected binary contents.
static
check_binary_output(Alias,Bytes)
check_binary_output(+atom,+list(byte)) – zero_or_one
Checks that the temporary file have the expected binary contents.
static
check_binary_output(Bytes)
check_binary_output(+list(byte)) – zero_or_one
Cleans the temporary file used when testing binary output.
static
clean_binary_output – one
Creates a text file with the given contents.
static
create_text_file(File,Contents)
create_text_file(+atom,+atom) – one
Creates a binary file with the given contents.
static
create_binary_file(File,Bytes)
create_binary_file(+atom,+list(byte)) – one
Checks that the contents of a text file match the expected contents.
static
check_text_file(File,Contents)
check_text_file(+atom,+atom) – zero_or_one
Checks the contents of a binary file match the expected contents.
static
check_binary_file(File,Bytes)
check_binary_file(+atom,+list(byte)) – zero_or_one
Closes any existing stream associated with the file and deletes the file if it exists.
static
clean_file(File)
clean_file(+atom) – one
Opens a temporary file with the given options for reading, closes it, and returns its stream handle.
static
closed_input_stream(Stream,Options)
closed_input_stream(-stream,+list(stream_option)) – one
Opens a temporary file with the given options for writing, closes it, and returns its stream handle.
static
closed_output_stream(Stream,Options)
closed_output_stream(-stream,+list(stream_option)) – zero_or_one
Returns a syntactically valid stream position.
static
stream_position(Position)
stream_position(-stream_position) – one
Specifies a unit test.
static
test(Identifier,Variables,Outcome)
test(?atom,?list(variable),?nonvar) – zero_or_more
Table of defined tests.
dynamic
test_(Identifier,Test)
test_(?atom,?compound) – zero_or_more
Counter for skipped tests.
dynamic
skipped_(Counter)
skipped_(?integer) – zero_or_one
Counter for passed tests.
dynamic
passed_(Counter)
passed_(?integer) – zero_or_one
Counter for failed tests.
dynamic
failed_(Counter)
failed_(?callable) – zero_or_one
Fired clauses when running the unit tests.
dynamic
fired_(Entity,Predicate,Clause)
fired_(?entity_identifier,?predicate_indicator,?integer) – zero_or_more
Auxiliary predicate for collecting statistics on clause coverage.
dynamic
covered_(Covered,Total)
covered_(?integer,?integer) – zero_or_more