mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-22 12:53:47 +00:00
tests/general/fail_detism.m:
tests/general/liveness_2.m:
tests/general/parse_list.m:
tests/general/petdr1.m:
Change code to avoid getting irrelevant warnings.
tests/general/Mercury.options:
Disable warnings which cannot be avoided by code changes
without affecting the purposes of the relevant test.
tests/general/dnf.m:
Fix language rot
tests/general/Mmakefile:
Reenable the dnf test case.
44 lines
1019 B
Mathematica
44 lines
1019 B
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% This tests whether the program as transformed by dnf still works.
|
|
% It does not (cannot) test whether dnf is applied, of course.
|
|
%
|
|
|
|
:- module dnf.
|
|
:- interface.
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module list.
|
|
:- import_module pair.
|
|
:- import_module solutions.
|
|
:- import_module string.
|
|
|
|
main(!IO) :-
|
|
solutions(
|
|
( pred(Pair::out) is multi :-
|
|
Pair = X - Y,
|
|
q(X, Y)
|
|
), List),
|
|
print_list(List, !IO).
|
|
|
|
:- pred print_list(list(pair(int))::in, io::di, io::uo) is det.
|
|
|
|
print_list([], !IO).
|
|
print_list([X - Y | XYs], !IO) :-
|
|
io.format("X = %d, Y = %d\n", [i(X), i(Y)], !IO),
|
|
print_list(XYs, !IO).
|
|
|
|
:- pred q(int::out, int::out) is multi.
|
|
|
|
:- pragma memo(pred(q/2)).
|
|
|
|
q(X, Y) :-
|
|
( X = 1 ; X = 2 ),
|
|
( Y = 41 ; Y = 42 ).
|