mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-16 09:53:36 +00:00
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.
38 lines
945 B
Mathematica
38 lines
945 B
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% "Hello World" in Mercury.
|
|
|
|
:- module myset_test.
|
|
:- interface.
|
|
:- import_module io.
|
|
|
|
:- pred main(io__state::di, io__state::uo) is cc_multi.
|
|
|
|
:- implementation.
|
|
:- import_module myset.
|
|
:- import_module list.
|
|
|
|
main -->
|
|
print_myset_rep({1}), nl,
|
|
print_myset_rep({1} + {2}), nl,
|
|
print_myset_rep({2} + {1}), nl,
|
|
( { {1} + {2} = [First | Rest] } ->
|
|
print(First), print("+"), print_myset_rep(Rest), nl
|
|
;
|
|
print("failed\n")
|
|
),
|
|
( { {2} + {1} = [First2 | Rest2] } ->
|
|
print(First2), print("+"), print_myset_rep(Rest2), nl
|
|
;
|
|
print("failed\n")
|
|
),
|
|
{ S1 = {3} + {4} },
|
|
{ S2 = {4} + {3} },
|
|
( { append([S1], [S2], [S2, S1]) } ->
|
|
print("yes"), nl
|
|
;
|
|
print("no"), nl
|
|
).
|