applied a patch from matthias which checks on the upper bound of

Mon Sep 19 17:23:23 2005  Tim Janik  <timj@imendio.com>

        * glib/gpattern.c: applied a patch from matthias which checks on the
        upper bound of GPatternSpec length to optimize matches.
        cosmetic fixups.

        * tests/patterntest.c: added more match cases.
This commit is contained in:
Tim Janik
2005-09-19 15:27:17 +00:00
committed by Tim Janik
parent 3fc9c7a45a
commit a2ff6e7982
5 changed files with 41 additions and 4 deletions

View File

@@ -58,6 +58,7 @@ struct _GPatternSpec
GMatchType match_type;
guint pattern_length;
guint min_length;
guint max_length;
gchar *pattern;
};
@@ -273,8 +274,13 @@ main (int argc, char** argv)
TEST_MATCH("ab*", "ab\xc3\xa4\xc3\xb6", TRUE);
TEST_MATCH("ab*\xc3\xb6", "ab\xc3\xa4\xc3\xb6", TRUE);
TEST_MATCH("ab*\xc3\xb6", "aba\xc3\xb6x\xc3\xb6", TRUE);
TEST_MATCH("", "", TRUE);
TEST_MATCH("", "abc", FALSE);
TEST_MATCH("", "", TRUE);
TEST_MATCH("abc", "abc", TRUE);
TEST_MATCH("*fo1*bar", "yyyfoxfo1bar", TRUE);
TEST_MATCH("12*fo1g*bar", "12yyyfoxfo1gbar", TRUE);
TEST_MATCH("__________:*fo1g*bar", "__________:yyyfoxfo1gbar", TRUE);
verbose ("\n%u tests passed, %u failed\n", passed, failed);