mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-16 01:43:35 +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.
55 lines
1.3 KiB
Mathematica
55 lines
1.3 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% This is a regression test --
|
|
% a previous version of Mercury generated code for this test
|
|
% which ran out of memory, if the test was compiled with `-O3'.
|
|
|
|
:- module bigtest.
|
|
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io__state::di, io__state::uo) is cc_multi.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module float.
|
|
:- import_module list.
|
|
:- import_module lp.
|
|
:- import_module pair.
|
|
:- import_module require.
|
|
:- import_module term.
|
|
:- import_module varset.
|
|
|
|
main -->
|
|
{ data(Eqns, Dir, Obj, Varset) },
|
|
lp_solve(Eqns, Dir, Obj, Varset, Result),
|
|
(
|
|
{ Result = satisfiable(_, _) },
|
|
io__write_string("satisfiable.\n")
|
|
;
|
|
{ Result = unsatisfiable },
|
|
io__write_string("unsatisfiable.\n")
|
|
).
|
|
|
|
:- pred data(equations::out, direction::out, objective::out, varset::out)
|
|
is det.
|
|
|
|
data(Eqns, max, Obj, Varset) :-
|
|
varset__init(Varset0 ),
|
|
varset__new_vars(80, Vars0, Varset0, Varset),
|
|
list__sort(Vars0, Vars),
|
|
list__map(mkeqn, Vars, Eqns),
|
|
list__map(mkobj, Vars, Obj).
|
|
|
|
:- pred mkeqn(var::in, equation::out) is det.
|
|
|
|
mkeqn(Var, eqn([Var - 1.0], (=<), 42.0)).
|
|
|
|
:- pred mkobj(var::in, coeff::out) is det.
|
|
|
|
mkobj(Var, Var - 1.0).
|