|
110 | 110 | Solutions == [if_(1=1,a=a,2), error(type_error(callable,2),call/1)]
|
111 | 111 | )).
|
112 | 112 |
|
| 113 | +test(W, loader:call(T)) :- |
| 114 | + member(T, [ |
| 115 | + cuts_outside(!), |
| 116 | + cuts_outside(foo:!), |
| 117 | + cuts_outside((a,!)), |
| 118 | + cuts_outside((!;b(_))), |
| 119 | + cuts_outside(((a;b(_,_);c),!,d)), |
| 120 | + \+ cuts_outside(call((a,!))), |
| 121 | + \+ cuts_outside(((a;b;c),\+ !,d)), |
| 122 | + \+ cuts_outside((! -> a; b)), |
| 123 | + \+ cuts_outside(((x,!;y) -> a; b)), |
| 124 | + catch((cuts_outside(_),false), E0, E0 = stop(type_error(callable,_))), |
| 125 | + catch((cuts_outside(2),false), E1, E1 == stop(type_error(callable,2))), |
| 126 | + catch((cuts_outside(1:!),false), E2, E2 == stop(type_error(atom,1))), |
| 127 | + catch((cuts_outside(_:!),false), E3, E3 = stop(type_error(atom,_))), |
| 128 | + (G0 = a(G0), catch((cuts_outside(G0),false), E4, E4 = stop(type_error(acyclic_term,_)))), |
| 129 | + (G1 = m:G1, catch((cuts_outside(G1),false), E5, E5 = stop(type_error(acyclic_term,_)))), |
| 130 | + (cut_contained(a, X0), X0 == a), |
| 131 | + (cut_contained(!, X1), X1 == call(!)), |
| 132 | + (cut_contained((a,b;c,d), X2), X2 == (a,b;c,d)), |
| 133 | + (cut_contained((\+ \+ a), X3), X3 == (\+ \+ a)), |
| 134 | + % Questionable test case, see #2739 |
| 135 | + (cut_contained((!,a->c;d), X4), X4 == (!,a->c;d)), |
| 136 | + (cut_contained((x,a->!;d), X5), X5 == call((x,a->!;d))), |
| 137 | + (cut_contained((a,b,c,!), X6), X6 == call((a,b,c,!))), |
| 138 | + \+ cut_contained(0, _), |
| 139 | + \+ cut_contained(_, _), |
| 140 | + \+ cut_contained((a,_), _), |
| 141 | + \+ cut_contained((a,b;1), _) |
| 142 | + ]), |
| 143 | + phrase(format_("callable cut: ~q", [T]), W). |
| 144 | + |
113 | 145 | result_or_exception(Goal, Result) :-
|
114 | 146 | catch((Goal,Result=Goal), Result, true).
|
115 | 147 |
|
|
0 commit comments