42
struct test_data {
43
const char *from; /* input: transform from this ... */
44
const char *to; /* output: ... to this. */
45
+ const char *alternative; /* output: ... or this. */
46
};
47
48
static int test_function(struct test_data *data, char *(*func)(char *input),
59
strcpy(buffer, data[i].from);
60
to = func(buffer);
61
}
61
- if (strcmp(to, data[i].to)) {
62
+ if (!strcmp(to, data[i].to))
63
+ continue;
64
+ if (!data[i].alternative)
65
error("FAIL: %s(%s) => '%s' != '%s'\n",
66
funcname, data[i].from, to, data[i].to);
64
- failed = 1;
65
- }
67
+ else if (!strcmp(to, data[i].alternative))
68
+ continue;
69
+ else
70
+ error("FAIL: %s(%s) => '%s' != '%s', '%s'\n",
71
+ funcname, data[i].from, to, data[i].to,
72
+ data[i].alternative);
73
+ failed = 1;
74
}
75
return failed;
76
}
82
{ ".", "." },
83
{ "..", ".." },
84
{ "/", "/" },
77
-#if defined(__CYGWIN__) && !defined(NO_LIBGEN_H)
78
- { "//", "//" },
79
- { "///", "//" },
80
- { "////", "//" },
81
-#else
82
- { "//", "/" },
83
- { "///", "/" },
84
- { "////", "/" },
85
-#endif
85
+ { "//", "/", "//" },
86
+ { "///", "/", "//" },
87
+ { "////", "/", "//" },
88
{ "usr", "usr" },
89
{ "/usr", "usr" },
90
{ "/usr/", "usr" },
94
{ "usr/lib///", "lib" },
95
96
#if defined(__MINGW32__) || defined(_MSC_VER)
95
-
97
/* --- win32 type paths --- */
98
{ "\\usr", "usr" },
99
{ "\\usr\\", "usr" },
112
{ "C:a", "a" },
113
{ "C:/", "/" },
114
{ "C:///", "/" },
114
-#if defined(NO_LIBGEN_H)
115
- { "\\", "\\" },
116
- { "\\\\", "\\" },
117
- { "\\\\\\", "\\" },
118
-#else
119
-
120
- /* win32 platform variations: */
121
-#if defined(__MINGW32__)
122
- { "\\", "/" },
123
- { "\\\\", "/" },
124
- { "\\\\\\", "/" },
125
-#endif
126
-
127
-#if defined(_MSC_VER)
128
- { "\\", "\\" },
129
- { "\\\\", "\\" },
130
- { "\\\\\\", "\\" },
131
-#endif
132
-
133
-#endif
115
+ { "\\", "\\", "/" },
116
+ { "\\\\", "\\", "/" },
117
+ { "\\\\\\", "\\", "/" },
118
#endif
119
{ NULL, NULL }
120
};
126
{ ".", "." },
127
{ "..", "." },
128
{ "/", "/" },
145
- { "//", "//" },
146
-#if defined(__CYGWIN__) && !defined(NO_LIBGEN_H)
147
- { "///", "//" },
148
- { "////", "//" },
149
-#else
150
- { "///", "/" },
151
- { "////", "/" },
152
-#endif
129
+ { "//", "/", "//" },
130
+ { "///", "/", "//" },
131
+ { "////", "/", "//" },
132
{ "usr", "." },
133
{ "/usr", "/" },
134
{ "/usr/", "/" },
138
{ "usr/lib///", "usr" },
139
140
#if defined(__MINGW32__) || defined(_MSC_VER)
162
-
141
/* --- win32 type paths --- */
142
{ "\\", "\\" },
143
{ "\\\\", "\\\\" },
158
{ "C:usr/lib///", "C:usr" },
159
{ "\\\\\\", "\\" },
160
{ "\\\\\\\\", "\\" },
183
-#if defined(NO_LIBGEN_H)
184
- { "C:", "C:." },
185
-#else
186
-
187
- /* win32 platform variations: */
188
-#if defined(__MINGW32__)
189
- /* the following is clearly wrong ... */
190
- { "C:", "." },
191
-#endif
192
-
193
-#if defined(_MSC_VER)
194
- { "C:", "C:." },
195
-#endif
196
-
197
-#endif
161
+ { "C:", "C:.", "." },
162
#endif
163
{ NULL, NULL }
164
};