Files
mercury/tests/declarative_debugger/special_term_dep.m
Zoltan Somogyi 33eb3028f5 Clean up the tests in half the test directories.
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
    Make these tests use four-space indentation, and ensure that
    each module is imported on its own line. (I intend to use the latter
    to figure out which subdirectories' tests can be executed in parallel.)

    These changes usually move code to different lines. For the debugger tests,
    specify the new line numbers in .inp files and expect them in .exp files.
2015-02-14 20:14:03 +11:00

80 lines
1.4 KiB
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
:- module special_term_dep.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is det.
% Term dependencies in the presence of calls to special predicates.
:- implementation.
:- import_module list.
main -->
test1, % compare
test2. % unify
%---------------------------------------------------------------------------%
:- pred test1(io__state::di, io__state::uo) is det.
test1 -->
{ p(L) },
io__write(L),
io__nl.
:- pred p(list(int)).
:- mode p(out) is det.
p(L) :-
pa(L0),
(
compare('>', L0, [1])
->
L = L0
;
L = []
).
:- pred pa(list(int)).
:- mode pa(out) is det.
pa([2, 3]).
%---------------------------------------------------------------------------%
:- pred test2(io__state::di, io__state::uo) is det.
test2 -->
(
{ q([1, 2], L) }
->
io__write(L),
io__nl
;
io__write_string("no\n")
).
:- pred q(list(int), list(int)).
:- mode q(in, out) is semidet.
q(A, B) :-
qa(A),
qb(A, B).
:- pred qa(list(int)).
:- mode qa(out) is det.
qa([1, 2]).
:- pred qb(list(int), list(int)).
:- mode qb(in, out) is det.
qb(_, [3]).
%---------------------------------------------------------------------------%