diff options
-rw-r--r-- | Build/source/texk/xdvik/ChangeLog.TL | 5 | ||||
-rw-r--r-- | Build/source/texk/xdvik/tests/test_string_utils.c | 15 |
2 files changed, 15 insertions, 5 deletions
diff --git a/Build/source/texk/xdvik/ChangeLog.TL b/Build/source/texk/xdvik/ChangeLog.TL index dd7ea8639eb..e9f9e24ced1 100644 --- a/Build/source/texk/xdvik/ChangeLog.TL +++ b/Build/source/texk/xdvik/ChangeLog.TL @@ -1,6 +1,11 @@ ChangeLog.TL: Changes for xdvik (TeX Live) ================================================== +2009-12-22 Peter Breitenlohner <peb@mppmu.mpg.de> + + * tests/test_string_utils.c (test_my_stristr): Make the test + more stringent (and closer to the original code). + 2009-12-21 Peter Breitenlohner <peb@mppmu.mpg.de> * tests/test_string_utils.c (test_my_stristr): Make test result diff --git a/Build/source/texk/xdvik/tests/test_string_utils.c b/Build/source/texk/xdvik/tests/test_string_utils.c index 0498524a661..90bdb8188f2 100644 --- a/Build/source/texk/xdvik/tests/test_string_utils.c +++ b/Build/source/texk/xdvik/tests/test_string_utils.c @@ -163,16 +163,21 @@ static Boolean test_my_stristr(int verbose) size_t i; Boolean result = True; for (i = 0; i < (sizeof tests / sizeof tests[0]); i++) { - char *res = my_stristr(tests[i].str1, tests[i].str2); + char *res_str = my_stristr(tests[i].str1, tests[i].str2); + /* We want to verify that my_stristr(STR1, STR2) is either NULL or + * a substring of STR1, but, e.g., `"oozah" == "paloozah" + 3' may + * or may not be true (depending on compiler optimizations). */ + char *test_str = tests[i].result ? + tests[i].str1 + strlen(tests[i].str1) - strlen(tests[i].result) : + NULL; if (verbose) { INFO((stderr, "my_stristr(%s, %s) -> %s == %s?\n", tests[i].str1, tests[i].str2, - res, - tests[i].result)); + res_str, + test_str)); } - if (res != tests[i].result && - (res == NULL || tests[i].result == NULL || strcmp(res, tests[i].result))) { + if (res_str != test_str) { result = False; } } |