Skip to content

Commit 5859f7a

Browse files
committed
Add more tests after review
1 parent 60179bc commit 5859f7a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/tests/reif.pl

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,23 @@
9696
maplist(_+\(N,Ts)^maplist(=(N),Ts), S)
9797
)).
9898

99+
test("cut in one of the branches does not influence condition", (
100+
findall(X-Y, if_(X=1,!,Y=a), Solutions),
101+
Expected = [1-Y1,X2-a],
102+
subsumes_term(Expected, Solutions),
103+
Solutions = Expected,
104+
var(Y1),
105+
var(X2), dif(X2, 1)
106+
)).
107+
108+
test("non-callable branch throws meaningful error", (
109+
findall(R, result_or_exception(if_(_=1, _=a, 2), R), Solutions),
110+
Solutions == [if_(1=1,a=a,2), error(type_error(callable,2),call/1)]
111+
)).
112+
113+
result_or_exception(Goal, Result) :-
114+
catch((Goal,Result=Goal), Result, true).
115+
99116
random_test_vector(TestVector) :-
100117
random_integer(0, 1000, Length),
101118
length(TestVector, Length),

0 commit comments

Comments
 (0)