|Did you know ...||Search Documentation:|
|test_util_iso.pl -- ECLiPSe test automation|
3.0 > 3 should_fail. X is 3.0+4 should_give X==7.0. throw(ball) should_throw ball. arg(0,atom,A) should_throw error(type_error(compound,atom),_).
The file name should have a .tst extension, e.g. mytests.tst. Then run
all the test in that file by loading this library and calling
test('mytests.tst'). This will print a message for every test, and a
summary at the end. To write the results to a file, use test/2 (see
To temporarily disable a test in a test file, use the fixme prefix, e.g.
fixme X is 0/0 should_throw error(evaluation_error(undefined),_).
The test procedure will skip those and print a count a the end.
CheckGoal can be an arbitrary user-defined goal. In this case, the first solution of Goal is committed to, and CheckGoal executed with the variable instantiations of this solution.
To allow verification of goals with multiple solutions, one special form of CheckGoal is recognised:
multiple_solutions(SolCountVar, FinalCheck, SolutionCheck)
where SolCountVar should be a fresh variable. With such a CheckGoal, ALL solutions to Goal will be generated. For each solution, SolutionCheck will be executed with the variable instantiations of this solution, and with SolCountVar instantiated to the number of this solution (starting from 1). After all solutions have been found, FinalCheck will be executed, with SolCountVar instantiated to the total number of solutions.
member(X,[a,b,c]) should_give multiple_solutions(K, K==3, ( K==1 -> X==a ; K==2 -> X==b ; K==3 -> X==c )).