summaryrefslogtreecommitdiff
path: root/Build/source/texk/xdvik/tests
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2009-12-22 09:36:56 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2009-12-22 09:36:56 +0000
commit58f4ce64a9bcf111ffe932548e671f6f8c317b95 (patch)
tree15d7161f6593f08771dde00509471b155da9306a /Build/source/texk/xdvik/tests
parent31122c570e91a22d4d8143189b766b76e9c1e3f9 (diff)
build fix
git-svn-id: svn://tug.org/texlive/trunk@16476 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/xdvik/tests')
-rw-r--r--Build/source/texk/xdvik/tests/test_string_utils.c15
1 files changed, 10 insertions, 5 deletions
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;
}
}