Tasks
- Accumulate user queries
- Suggest tests from user queries
make_tests(+Module, +File, +Out) is det- Create tests from queries stored in File and write the tests for
Module to the stream Out.
make_test(+Query:callable, -Module, -Test:term) is det- Generate a test from a query. Test is returned as a clause of
test/1 or test/2 to be inserted between begin_tests and
end_tests.
find_test_module(+QuerySpec, ?Module, -Query)[private]- Find module to test from a query. Note that it is very common
for toplevel usage to rely on SWI-Prolog's DWIM.
- To be done
- - What if multiple modules match? We can select the
local one or ask the user.
pred_name(+Callable, -Name) is det[private]- Suggest a name for the test. In the plunit framework the name
needs not be unique, so we simply take the predicate name.
test_result(+Callable, +Maxtime, -Result) is det[private]- Try running goal and get meaningful results. Results are:
true(Templ == Var)
- fail
all(Templ == Bindings)
throws(Error)
- timeout
success(+Bindings, +Templ, -Result) is det[private]- Create test-results from non-error cases.
error(+ErrorTerm, -Result)[private]
make_template(+Vars, -Template) is det[private]- Make a nice looking template
call_test(:Goal, -Det) is nondet[private]- True if Goal succeeded. Det is unified to
true
if Goal left
no choicepoints and false
otherwise.