object

lgtunit

A simple unit test framework.

author:
Paulo Moura
version:
1.2
date:
2010/7/6
compilation:
static, context_switching_calls
implements:
public expanding
uses:
list
term

Public interface

run/2

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).

compilation:
static
template:
run(File,Mode)
mode – number of solutions:
run(+atom,+atom) – one

run/0

Runs the unit tests, writing the results to the current output stream.

compilation:
static
mode – number of solutions:
run – one
run – one

(=~=)/2

Compares two float values for approximate equality using 100*epsilon for the absolute error and, if that fails, 99.999% accuracy for the relative error. Altough handy when writing certain unit tests, the default precision values may not be adequate for all cases.

compilation:
static
template:
Float1=~=Float2
mode – number of solutions:
+float=~= +float – zero_or_one

Protected interface

run_tests/0

compilation:
static

run_tests/1

Runs a list of defined tests.

compilation:
static
template:
run_tests(Tests)
mode – number of solutions:
run_tests(+list(callable)) – one

setup/0

Setup environment before running the test set. Defaults to the goal true.

compilation:
static
mode – number of solutions:
setup – zero_or_one

cleanup/0

Cleanup environment after running the test set. Defaults to the goal true.

compilation:
static
mode – number of solutions:
cleanup – zero_or_one

Private predicates

test/2

Specifies a unit test.

compilation:
static
template:
test(Identifier,Outcome)
mode – number of solutions:
test(?atom,?nonvar) – zero_or_more

test_/1

Table of defined tests.

compilation:
dynamic
mode – number of solutions:
test_(?compound) – zero_or_more

passed_/1

Counter for passed tests.

compilation:
dynamic
mode – number of solutions:
passed_(?integer) – zero_or_one

failed_/1

Counter for failed tests.

compilation:
dynamic
mode – number of solutions:
failed_(?callable) – zero_or_one

Remarks

(none)