mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-20 20:03:44 +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.8 KiB
Mathematica
55 lines
1.8 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% vim: ts=4 sw=4 et ft=mercury
|
|
%---------------------------------------------------------------------------%
|
|
%
|
|
% The "match-app" Benchmark
|
|
% Part of the DPPD Library.
|
|
%
|
|
% A very naive string matcher, written with 2 appends. Same runtime
|
|
% queries as match.kmp. This benchmark contains no builtins or negations.
|
|
|
|
:- module match_append.
|
|
|
|
:- interface.
|
|
|
|
:- pred match_append is semidet.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module list.
|
|
:- import_module match_append_impl.
|
|
|
|
match_append :-
|
|
match_aab([a, a, a, a, c, d, a, a, a, e, f, g, h, a, a, b, d, f]),
|
|
match_aab([a, b, a, b, a, a, a, a, c, a, a, a, a, a, a, a, a, b]),
|
|
match_aab([a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,
|
|
a, a, a, a, a, b]),
|
|
match_aab([a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s,
|
|
t, u, v, a, a, b, w, x, y, z]).
|
|
|
|
% The partial deduction query
|
|
%
|
|
% :- match([a, a, b], String).
|
|
%
|
|
% The run-time queries
|
|
%
|
|
% :- match([a, a, b], [a, a, a, a, c, d, a, a, a, e, f, g, h, a, a, b, d, f]).
|
|
% :- match([a, a, b], [a, b, a, b, a, a, a, a, c, a, a, a, a, a, a, a, a, b]).
|
|
% :- match([a, a, b], [a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a,
|
|
% a, a, a, a, a, a, b]).
|
|
% :- match([a, a, b], [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r,
|
|
% s, t, u, v, a, a, b, w, x, y, z]).
|
|
%
|
|
% Example solution
|
|
%
|
|
% The following can be obtained by the ECCE partial deduction system .
|
|
% Although it runs considerably faster than the original program (33
|
|
% times actually) it is still not a KMP style matcher.
|
|
%
|
|
% match__1([X1, X2, X3 | X4]) :- app__app(X4, X1, X2, X3).
|
|
%
|
|
% app__app(X1, a, a, b).
|
|
% app__app([X1 | X2], X3, X4, X5) :- app__app(X2, X4, X5, X1).
|
|
%
|
|
% Michael Leuschel / K.U. Leuven / michael@cs.kuleuven.ac.be
|