# HG changeset patch # User Matti Hamalainen # Date 1455709322 -7200 # Node ID 3a020aa05f284005a2ef4a591cfc165e190155ef # Parent effb2786f6a6b7653975b452fef099e02f133b70 More tests. diff -r effb2786f6a6 -r 3a020aa05f28 tests.c --- a/tests.c Wed Feb 17 13:36:36 2016 +0200 +++ b/tests.c Wed Feb 17 13:42:02 2016 +0200 @@ -180,6 +180,11 @@ test_result(( fun (str1, str2) == 0) == ret); \ } while (0) +#define TEST2B(fun, str1, str2, ret) do { \ + test_start(# fun "('%s', '%s')", str1, str2); \ + test_result( fun (str1, str2) == ret); \ + } while (0) + #define TEST3(fun, str1, str2, len, ret) do { \ test_start(# fun "('%s', '%s', %d)", str1, str2, len); \ test_result(( fun (str1, str2, len) == 0) == ret); \ @@ -199,11 +204,23 @@ TEST3(th_strncasecmp, "aSdFq", "QsDfq", 0, TRUE); TEST3(th_strncasecmp, "aSdFq", "QsDfq", 1, FALSE); + TEST2B(th_strmatch, "abba ABBAkukka lol", "*lol", TRUE); + TEST2B(th_strmatch, "abba ABBAkukka lol", "*lo*", TRUE); + TEST2B(th_strmatch, "abba ABBAkukka lol", "*lo", FALSE); + TEST2B(th_strmatch, "abba ABBAkukka lol", "abba", FALSE); + TEST2B(th_strmatch, "abba ABBAkukka lol", "abba*", TRUE); + TEST2B(th_strmatch, "abba ABBAkukka lol", "abbak*", FALSE); + TEST2B(th_strcasematch, "abba ABBAkukka lol", "abbak*", FALSE); + TEST2B(th_strcasematch, "abba ABBAkukka lol", "*abbak*", TRUE); + TEST2B(th_strcasematch, "abba ABBAkukka lol", "*abbak?", FALSE); + TEST2B(th_strcasematch, "abba ABBAkukka lol", "?bba?abba*", TRUE); + // Tests that test for things that do not work correctly yet // Unicode / multibyte UTF-8 causes problems here TEST2(th_strcasecmp, "ÖÄÅ", "öäå", FALSE); // SHOULD match TEST3(th_strncasecmp, "Aäöå", "aöå", 2, TRUE); // should NOT match + // // Print summary and exit //