View source with raw comments or as raw
    1:- module(clp_disequality_test,
    2          [ run_test/0
    3          ]).    4
    5:- use_module(clp_disequality).    6
    7run_test :-
    8    template(_A = 5),
    9    template(_B .\=. 4),
   10    template((C .\=. 5, C = 5)),
   11    template(p(1,2) .\=. p(_D1, _D2)),
   12    template((E .\=. 25, E .\=. 3, [E,E,E] = [E,E,4])),
   13    template((F .\=. 4, F .\=. 5)),
   14    template(( G .\=. 6, G .\=. 5, G = 4)),
   15    template((H .\=. 6, H .\=. 5, p(H,3) .\=. p(4,H))),
   16    template((I1 .\=.3, I2 .\=. 5, I1 .\=. I2)),
   17    template((s(_K) = s(5))).
   18
   19template(Goal) :-
   20    format('\n--------------------------\n'),
   21    copy_term(Goal, Copy),
   22    format('TEST ~w',Copy),nl,
   23    term_variables(Goal, Var),
   24    term_variables(Copy, CVar),
   25    (   intercept(call(Goal),_,fail),
   26        format('Result: '),
   27        print_list(-(Var,CVar)),nl,
   28        fail
   29    ;   \+ call(Goal),
   30        format('Result: \n\tfails\n')
   31    ).
   32template(_).
   33
   34
   35print_list(-([],[])).
   36print_list(-([X|Xs],[Cx|Cxs])) :-
   37    \+ \+ ( numbervars(Cx+X, 0, _, [attvar(skip)]),
   38            format('\n\t~p is ~p', [Cx, X])
   39          ),
   40    print_list(-(Xs,Cxs))