Files
mercury/tests/debugger/switch_on_unbounded.m
Zoltan Somogyi 59b11f84ce Update the debugger test directory.
Replace __ with . as the module qualifier symbol.

Replace references to io.state with just io.

Replace DCGs with state variables.

Replace (C->T;E) syntax for if-then-elses with (if C then T else E) syntax.

Replace if-then-elses with switches when possible and where this does not
affect what is being tested.

Replace separate pred and mode declarations with predmode declarations.

Put predicate and function declarations just before the definition
of the predicate or function.

Delete unneeded module qualifications on predicate and function declarations
and definitions.

Update .exp files (and if needed, .inp files) for the line number changes
that result from the above.

For tests that have more than one .exp file and where one of those files
is affected by the above, add a section to the source file header that says
which .exp file is for what grade, with XXXs for the (as yet) unknown parts.
2018-08-28 21:20:59 +10:00

48 lines
1.1 KiB
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
%
% This test case tests the debugger's formatting of goal paths that include
% switches on types with an unbounded number of function symbols.
:- module switch_on_unbounded.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
:- implementation.
:- import_module solutions.
:- import_module list.
main(!IO) :-
( if edge(2, Two) then
io.write_int(Two, !IO),
io.nl(!IO)
else
io.write_string("edge(2, _) has no solution\n", !IO)
),
( if edge_str("2", TwoStr) then
io.write_string(TwoStr, !IO),
io.nl(!IO)
else
io.write_string("edge_str(2, _) has no solution\n", !IO)
).
:- pred edge(int::in, int::out) is semidet.
:- pragma no_inline(edge/2).
edge(1, 2).
edge(2, 1).
edge(3, 4).
:- pred edge_str(string::in, string::out) is semidet.
:- pragma no_inline(edge_str/2).
edge_str("1", "2").
edge_str("2", "1").
edge_str("3", "4").