1:- module(test_just,
2 [ test_just/0
3 ]). 4:- use_module('../prolog/scasp'). 5:- use_module('../prolog/scasp/human'). 6:- use_module(library(plunit)). 7:- use_module(library(debug)). 8
9:- meta_predicate
10 human(0, +). 11
12test_just :-
13 run_tests([ scasp_just_1
14 ]).
15
16:- begin_tests(scasp_just_1). 17:- dynamic q/0. 18
19p.
20pq :- not q.
21p(X) :- X #> 3.
22
23test(p) :-
24 human(p, "p holds").
25test(p1) :-
26 human(p(_X), "p holds for any number greater than 3").
27test(np1) :-
28 human(not p(_X), "there is no evidence that p holds for \c
29 any number less than or equal to 3").
30test(pq) :-
31 human(pq, "pq holds, because there is no evidence that q holds").
32
33:- end_tests(scasp_just_1). 34
35
36 39
40human(G, Expected) :-
41 once(scasp(G, [tree(Tree)])),
42 with_output_to(string(String0),
43 human_justification_tree(Tree, [])),
44 split_string(String0, "\n", " \n\u220e", Strings),
45 atomics_to_string(Strings, " ", String),
46 assertion(Expected == String)