Wiki Discussion: Using SWI-Prolog unit tests

This is a topic to discuss the Wiki

Using SWI-Prolog unit tests

One of the primary items that should be in the Wiki are examples of how to use the various options.

Example of

set (AnswerTerm Cmp Instances)

Similar to all(AnswerTerm Cmp Instances) , but before testing both the bindings of AnswerTerm and Instances are sorted using sort/2. This removes duplicates and places both sets in the same order.2

add_element(X,L1,L2) :-

:- begin_tests(add_element).


test(add_element_success,[forall(add_element_test(success,X,L1,Expected_result)),set(L2 == Expected_result )]) :-

:- end_tests(add_element).