Did you know ... Search Documentation:
test_wizard.pl -- Test Generation Wizard
PublicShow source

Tasks

  • Accumulate user queries
  • Suggest tests from user queries
Source make_tests(+Module, +File, +Out) is det
Create tests from queries stored in File and write the tests for Module to the stream Out.
Source 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.
Source 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.
Source 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.
Source 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
Source success(+Bindings, +Templ, -Result) is det[private]
Create test-results from non-error cases.
Source error(+ErrorTerm, -Result)[private]
Source make_template(+Vars, -Template) is det[private]
Make a nice looking template
Source call_test(:Goal, -Det) is nondet[private]
True if Goal succeeded. Det is unified to true if Goal left no choicepoints and false otherwise.