mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-16 01:43:35 +00:00
tests/declarative_debugger/*.m:
tests/exceptions/*.m:
tests/general/*.m:
tests/grade_subdirs/*.m:
tests/purity/*.m:
tests/submodules/*.m:
tests/typeclasses/*.m:
Update programming style.
tests/declarative_debugger/*.inp:
Update line numbers in breakpoint commands.
tests/declarative_debugger/*.exp:
Update expected line numbers.
tests/exceptions/Mercury.options:
tests/general/Mercury.options:
Disable some warnings that are irrelevant to the test.
65 lines
1.0 KiB
Mathematica
65 lines
1.0 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module aadebug.
|
|
:- interface.
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module int.
|
|
:- import_module std_util.
|
|
|
|
main(!IO) :-
|
|
( if
|
|
p('a', X),
|
|
test(X)
|
|
then
|
|
io.write_string("yes\n", !IO)
|
|
else
|
|
io.write_string("no\n", !IO)
|
|
).
|
|
|
|
:- pred test(int).
|
|
:- mode test(in) is semidet.
|
|
|
|
test(_) :-
|
|
semidet_fail.
|
|
|
|
:- pred p(character::in, int::out) is nondet.
|
|
|
|
p(A, D) :-
|
|
q(A, B),
|
|
( if
|
|
r(B, C)
|
|
then
|
|
(
|
|
s(C, D)
|
|
;
|
|
D = 31
|
|
)
|
|
else
|
|
not(
|
|
q(B, _)
|
|
),
|
|
D = 32
|
|
).
|
|
|
|
:- pred q(character::in, character::out) is nondet.
|
|
|
|
q('a', 'a').
|
|
q('a', 'b').
|
|
q('c', 'c').
|
|
|
|
:- pred r(character::in, int::out) is semidet.
|
|
|
|
r('a', 10).
|
|
|
|
:- pred s(int::in, int::out) is det.
|
|
|
|
s(N, 3 * N).
|
|
|