Files
mercury/tests/hard_coded/string_sub_string_search.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

38 lines
1.1 KiB
Mathematica
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

%---------------------------------------------------------------------------%
% vim: ts=4 sw=4 et ft=mercury
%---------------------------------------------------------------------------%
:- module string_sub_string_search.
:- interface.
:- import_module io.
:- pred main(io::di, io::uo) is det.
%---------------------------------------------------------------------------%
:- implementation.
:- import_module string.
main(!IO) :-
(
string.sub_string_search("", "", 0),
not string.sub_string_search("", "dog", _),
not string.sub_string_search("cat", "catdog", _),
string.sub_string_search("cat", "", 0),
string.sub_string_search("cat", "cat", 0),
string.sub_string_search("cat", "at", 1),
string.sub_string_search("cat", "t", 2),
string.sub_string_search_start("catcatcat", "cat", 1, 3),
not string.sub_string_search_start("catcatcat", "cat", 9, _),
string.sub_string_search("cαtcατcat", "cατ", length("cαt"))
->
io.write_string("test succeeded\n", !IO)
;
io.write_string("test failed\n", !IO)
).