Files
mercury/tests/hard_coded/compare_rep_array.m
Zoltan Somogyi 33eb3028f5 Clean up the tests in half the test directories.
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.
2015-02-14 20:14:03 +11:00

43 lines
1.0 KiB
Mathematica

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
%
:- module compare_rep_array.
:- interface.
:- import_module io.
:- pred main(io__state::di, io__state::uo) is cc_multi.
:- implementation.
:- import_module array.
:- import_module list.
:- import_module std_util.
main -->
test(d1, d2),
test(d2, d3),
test(d3, d3).
:- type val == pair(string, univ).
:- func d1 = val.
d1 = "{1, 2, 3} : array(int)" - univ(array([1, 2, 3])).
:- func d2 = val.
d2 = "{1, 4, 9} : array(int)" - univ(array([1, 4, 9])).
:- func d3 = val.
d3 = "{1.0, 1.1, 1.2} : array(float)" - univ(array([1.0, 1.1, 1.2])).
:- pred test(val::in, val::in, io__state::di, io__state::uo) is cc_multi.
test(SA - A, SB - B) -->
io__write_string(SA),
io__nl,
io__write_string(SB),
io__nl,
{ std_util__compare_representation(Res, A, B) },
io__write_string("Result = "),
io__write(Res),
io__write_string(".\n\n").