mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-15 17:33:38 +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.
70 lines
2.0 KiB
Mathematica
70 lines
2.0 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% Test array.all_{true, false}/2.
|
|
|
|
:- module array_all_tf.
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io::di, io::uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module array.
|
|
:- import_module int.
|
|
:- import_module list.
|
|
|
|
main(!IO) :-
|
|
EvensArray = array([2, 4, 6, 8, 10]),
|
|
io.write_string("TEST: all_true(even, ", !IO),
|
|
io.write(EvensArray, !IO),
|
|
io.write_string("): ", !IO),
|
|
( if array.all_true(int.even, EvensArray)
|
|
then io.write_string("PASSED\n", !IO)
|
|
else io.write_string("FAILED\n", !IO)
|
|
),
|
|
|
|
io.write_string("TEST: all_false(odd, ", !IO),
|
|
io.write(EvensArray, !IO),
|
|
io.write_string("): ", !IO),
|
|
( if array.all_false(int.odd, EvensArray)
|
|
then io.write_string("PASSED\n", !IO)
|
|
else io.write_string("FAILED\n", !IO)
|
|
),
|
|
|
|
array.make_empty_array(EmptyArray : array(int)),
|
|
io.write_string("TEST: all_true(even, ", !IO),
|
|
io.write(EmptyArray, !IO),
|
|
io.write_string("): ", !IO),
|
|
( if array.all_true(int.even, EmptyArray)
|
|
then io.write_string("PASSED\n", !IO)
|
|
else io.write_string("FAILED\n", !IO)
|
|
),
|
|
|
|
io.write_string("TEST: all_false(even, ", !IO),
|
|
io.write(EmptyArray, !IO),
|
|
io.write_string("): ", !IO),
|
|
( if array.all_false(int.even, EmptyArray)
|
|
then io.write_string("PASSED\n", !IO)
|
|
else io.write_string("FAILED\n", !IO)
|
|
),
|
|
|
|
io.write_string("TEST: not all_true(odd, ", !IO),
|
|
io.write(EvensArray, !IO),
|
|
io.write_string("): ", !IO),
|
|
( if not array.all_true(int.odd, EvensArray)
|
|
then io.write_string("PASSED\n", !IO)
|
|
else io.write_string("FAILED\n", !IO)
|
|
),
|
|
|
|
io.write_string("TEST: not all_false(even, ", !IO),
|
|
io.write(EvensArray, !IO),
|
|
io.write_string("): ", !IO),
|
|
( if not array.all_false(int.even, EvensArray)
|
|
then io.write_string("PASSED\n", !IO)
|
|
else io.write_string("FAILED\n", !IO)
|
|
).
|