bde955c276
These small examples are designed to run quickly with the Gerrit prolog-shell, but not depending on a local Gerrit repository server. Change-Id: I8f58a6740c6f2c79ae1314f2ae593409ee60440d
21 lines
557 B
Prolog
21 lines
557 B
Prolog
:- load([rules,utils]).
|
|
:- begin_tests(t1).
|
|
|
|
:- test1(true). % expect true to pass
|
|
:- test0(false). % expect false to fail
|
|
|
|
:- test1(X = 3). % unification should pass
|
|
:- test1(_ = 3). % unification should pass
|
|
:- test0(X \= 3). % not-unified should fail
|
|
|
|
% (7-4) should have expected result
|
|
:- test1((X is (7-4), X =:= 3)).
|
|
:- test1((X is (7-4), X =\= 4)).
|
|
|
|
% memberchk should pass/fail exactly once
|
|
:- test1(memberchk(3,[1,3,5,3])).
|
|
:- test0(memberchk(2,[1,3,5,3])).
|
|
:- test0(memberchk(2,[])).
|
|
|
|
:- end_tests_or_halt(0). % expect no failure
|