General cleanup of the test suite directories.

tests/valid/*:
	Renamed `*.nl' as `*.m'.
	Added a few new test cases.
	Removed a couple of duplicate test cases.
	Fixed up the Mmake file so that `mmake check' now works.
This commit is contained in:
Fergus Henderson
1995-11-14 08:03:46 +00:00
parent 996275b0f0
commit fa77e70a46
26 changed files with 125 additions and 103 deletions

View File

@@ -8,25 +8,42 @@ include ../Mmake
#-----------------------------------------------------------------------------#
SOURCES= \
assoc_list.nl \
det_inference.nl \
det_switch.nl \
easy_nondet_test.nl \
easy_nondet_test_2.nl \
mode_merge_insts.nl \
name_mangling.nl \
same_length_2.nl \
same_length_3.nl \
indexing.nl \
tiny.nl
SOURCES= \
complicated_unify.m \
dcg_test.m \
det_condition.m \
det_inference.m \
det_switch.m \
easy_nondet_test.m \
easy_nondet_test_2.m \
error.m \
followcode_det_problem.m \
higher_order.m \
implied_mode.m \
indexing.m \
loop.m \
name_mangling.m \
semidet_disj.m \
stack_alloc.m \
switches.m \
unreachable_code.m
OBJS= $(SOURCES:%.nl=%.o)
NOS = $(SOURCES:%.nl=%.no)
PROGS = $(SOURCES:%.nl=%)
# The mode system can't handle the following test cases yet:
# assoc_list.m
# determinism.m
# mode_merge_insts.m
# There is a bug which prevents us from passing this test case:
# same_length_2.m
depend: tiny.depend
OBJS= $(SOURCES:%.m=%.o)
NOS = $(SOURCES:%.m=%.no)
PROGS = $(SOURCES:%.m=%)
all: $(OBJS) tiny
all: objs
check: objs
objs: $(OBJS)
depend:
clean:
rm -f *.c *.o *.err2 *.d
#-----------------------------------------------------------------------------#

View File

@@ -6,7 +6,7 @@
:- pred assoc_list_member(pair(K,V), list(pair(K,V))).
:- mode assoc_list_member(bound(free - ground) -> ground, in) is semidet.
:- mode assoc_list_member(bound(free - free) -> ground, in) is det.
:- mode assoc_list_member(bound(free - free) -> ground, in) is nondet.
assoc_list_member(X, [X|_]).
assoc_list_member(X, [_|Xs]) :-

View File

@@ -6,6 +6,12 @@
:- pred q is semidet.
:- pred r is semidet.
:- pred s is semidet.
:- external(q/2).
:- external(r/2).
:- external(s/2).
:- external(q/0).
:- external(r/0).
:- external(s/0).
:- pred p(int::in, int::out) is nondet.

View File

@@ -1,6 +1,6 @@
:- module det_inference.
:- pred p1.
:- pred p1 is det.
:- pred p2.
:- pred p3.
:- pred p4.

View File

@@ -5,7 +5,7 @@
:- pred p(enum, int) is det.
:- mode p(in, out) is det.
:- mode p(out, in) is semidet.
:- mode p(out, out) is nondet.
:- mode p(out, out) is multi.
p(a, 1).
p(b, 2).

View File

@@ -37,7 +37,5 @@ p3 :-
r(Y),
X = Y.
/*
:- external(q/1).
:- external(r/1).
*/

View File

@@ -5,7 +5,7 @@
q(X) :-
p(X).
:- pred p(int::out) is nondet.
:- pred p(int::out) is multi.
p(X) :-
X = 1 ; X = 2.

View File

@@ -4,13 +4,13 @@
:- pred q(int::out) is nondet.
% q(1).
% q(2).
q(1).
q(2).
:- pred r(int::out) is nondet.
% r(3).
% r(4).
r(3).
r(4).
p(X) :-
q(X) ; r(X).

View File

@@ -2,6 +2,6 @@
:- import_module require.
:- pred t(int::out) is det.
t(X) :-
t(_X) :-
error("").

View File

@@ -3,12 +3,12 @@
:- pred p(int::out) is semidet.
p(X) :-
Z = 4,
(
Z = 3
;
Z = 4
),
Z = 4,
q(X).
:- pred q(int::out) is det.

View File

@@ -1,11 +1,8 @@
:- module higher_order.
:- import_module list, int.
:- pred call(pred(T1, T2), T1, T2).
:- mode call(in, in, out) is det.
:- pred map_list(pred(T1, T2), list(T1), list(T2)).
:- mode map_list(in, in, out) is det.
:- mode map_list(pred(in, out) is det, in, out) is det.
map_list(_P, [], []).
map_list(P, [X|Xs], [Y|Ys]) :-
@@ -28,6 +25,6 @@ t.
f :- fail.
:- pred test(pred).
:- mode test(out) is nondet.
:- mode test(out((pred) is semidet)) is nondet.
test(t).
test(f).

9
tests/valid/loop.m Normal file
View File

@@ -0,0 +1,9 @@
:- module loop.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is det.
:- implementation.
main --> main.

View File

@@ -2,15 +2,17 @@
:- type triple ---> triple(int, int, int).
:- type list(T) ---> [] ; [T | list(T)].
:- inst triple1 = bound(triple(ground, free, free)).
:- inst triple2 = bound(triple(free, ground, free)).
:- inst triple12 = bound(triple(ground, ground, free)).
:- pred p1(list(triple) :: free -> triple1) is det.
:- pred p2(list(triple) :: free -> triple2) is det.
:- pred q(list(triple) :: triple12 -> triple12) is det.
:- pred p1(triple :: free -> triple1) is det.
:- pred p2(triple :: free -> triple2) is det.
:- pred q(triple :: triple12 -> triple12) is det.
:- external(p1/1).
:- external(p2/1).
:- external(q/1).
:- pred p is det.

View File

@@ -0,0 +1,28 @@
:- module same_length_2.
:- import_module list.
:- mode my_input_list_skel :: list_skel -> list_skel.
:- mode my_output_list_skel :: free -> list_skel.
:- mode my_list_skel_output :: list_skel -> ground.
:- pred q(list(T)::my_input_list_skel).
:- pred r(list(T)::my_output_list_skel).
:- external(q/1).
:- external(r/1).
:- pred p.
p :-
r(X),
q(X).
:- pred p2(list(T)::my_output_list_skel).
p2(X) :-
r(X),
q(X)
;
r(X),
q(X).

View File

@@ -1,28 +0,0 @@
:- module same_length_2.
:- type list(T) ---> [] ; [T | list(T)].
:- inst list_skel = bound([] ; [free | list_skel]).
:- mode input_list_skel :: list_skel -> list_skel.
:- mode output_list_skel :: free -> list_skel.
:- mode list_skel_output :: list_skel -> ground.
:- pred q(list(T)::input_list_skel).
:- pred r(list(T)::output_list_skel).
:- pred p.
p :-
r(X),
q(X).
:- pred p2(list(T)::output_list_skel).
p2(X) :-
r(X),
q(X)
;
r(X),
q(X).

View File

@@ -1,28 +0,0 @@
:- module same_length_3.
:- type list(T) ---> [] ; [T | list(T)].
:- inst list_skel = bound([] ; [free | list_skel]).
:- mode input_list_skel :: list_skel -> list_skel.
:- mode output_list_skel :: free -> list_skel.
:- mode list_skel_output :: list_skel -> ground.
:- pred q(list(T)::input_list_skel) is det.
:- pred r(list(T)::output_list_skel) is det.
:- pred p is det.
p :-
r(X),
q(X).
:- pred p2(list(T)::output_list_skel) is nondet.
p2(X) :-
r(X),
q(X)
;
r(X),
q(X).

View File

@@ -0,0 +1,11 @@
:- module semidet_disj.
:- pred p(int::in) is semidet.
:- pred q(int::in) is semidet.
:- external(q/1).
:- pred r(int::in) is semidet.
:- external(r/1).
p(X) :-
q(X) ; r(X).

View File

@@ -3,6 +3,9 @@
:- pred in(int::in) is semidet.
:- pred out(int::out) is det.
:- external(in/1).
:- external(out/1).
:- pred p is semidet.
p :-

View File

@@ -1,8 +0,0 @@
:- module tiny.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
main --> [].

View File

@@ -0,0 +1,15 @@
:- module unreachable_code.
:- interface.
:- type foo ---> foo.
:- pred p(foo::in, foo::in) is semidet.
:- implementation.
:- import_module require.
p(X, Y) :-
error("err"),
X = Y.
%-----------------------------------------------------------------------------%