diff tests/test-c-strcasestr.c @ 9630:729b6d4ffac1

Convert c-strcasestr to be more efficient. * modules/c-strcasestr (Files): Use Two-Way, not KMP. (Depends-on): Add c-strcase, remove malloca, strnlen. * tests/test-c-strcasestr.c (main): Enhance test. * lib/c-strcasestr.c (c_strcasestr): Rewrite to new algorithm. Signed-off-by: Eric Blake <ebb9@byu.net>
author Eric Blake <ebb9@byu.net>
date Wed, 16 Jan 2008 20:35:00 -0700
parents bbbbbf4cd1c5
children daf5ba9fe2d9
line wrap: on
line diff
--- a/tests/test-c-strcasestr.c
+++ b/tests/test-c-strcasestr.c
@@ -1,5 +1,5 @@
 /* Test of case-insensitive searching in a string.
-   Copyright (C) 2007 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -62,6 +62,12 @@
     ASSERT (result == NULL);
   }
 
+  {
+    const char input[] = "ABC ABCDAB ABCDABCDABDE";
+    const char *result = c_strcasestr (input, "ABCDaBCD");
+    ASSERT (result == input + 11);
+  }
+
   /* Check that a very long haystack is handled quickly if the needle is
      short and occurs near the beginning.  */
   {