Add a couple of new test cases.

tests/general:
	Add a couple of new test cases.
	Remove `Entry' and `NP_Entry', since they aren't needed now that
	I've removed the crud from ../Mmake.
This commit is contained in:
Fergus Henderson
1995-06-23 10:49:14 +00:00
parent fcedd5b5f2
commit 26f56c6789
3 changed files with 90 additions and 1 deletions

View File

@@ -7,7 +7,10 @@ include ../Mmake
#-----------------------------------------------------------------------------#
PROGS= arithmetic string_test string_test_2 interpreter disj_disj \
nondet_disj partition petdr1
nondet_disj partition nasty_nondet
# We do not yet pass the following tests:
# petdr1
DEPENDS=$(PROGS:%=%.depend)
OUTS= $(PROGS:%=%.out)
EXPS= $(PROGS:%=%.exp)

View File

@@ -0,0 +1,41 @@
:- module nasty_nondet.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is det.
:- implementation.
:- import_module list, int, std_util.
:- pred p(int::in, int::out) is multidet.
:- pred q(int::in, int::out) is multidet.
p(Z, Y) :-
(if some [X, R] (
(X = 1 ; X = 2),
q(Z, R),
X = R
)
then
Y is X * X + R
else
Y = 42
).
q(_, 0).
q(_, 1).
q(_, 2).
main -->
{ solutions(p(100), List) },
write_int_list(List).
:- pred write_int_list(list(int)::in, io__state::di, io__state::uo) is det.
write_int_list([]) --> [].
write_int_list([X|Xs]) -->
io__write_int(X),
io__write_string("\n"),
write_int_list(Xs).

View File

@@ -0,0 +1,45 @@
% nondet_ite.m: test nondet if-then-else with nondet condition.
:- module nondet_ite.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is det.
:- implementation.
:- import_module list, int, std_util.
:- pred q(int::out, int::out) is nondet.
q(X, Y) :-
p(X),
(if some [Y1] p(Y1) then
Y = Y1
else
Y = 42
).
:- pred p(int::out) is nondet.
p(0).
p(1).
p(2).
:- pred r(int::out) is nondet.
r(Z) :-
q(X, Y),
Z is X * 100 + Y.
main -->
{ solutions(r, List) },
write_int_list(List).
:- pred write_int_list(list(int)::in, io__state::di, io__state::uo) is det.
write_int_list([]) --> [].
write_int_list([X|Xs]) -->
io__write_int(X),
io__write_string("\n"),
write_int_list(Xs).