154
test_strconcat (void)
158
out = strconcat ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
159
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
160
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
161
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
162
"1", "2", "3", "4", "5", "6", "7", NULL);
167
out = strconcat ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
168
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
169
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
170
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
171
"1", "2", "3", "4", "5", "6", "7", "8", NULL);
174
else if (errno != EINVAL)
177
out = strconcat ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
178
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
179
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
180
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
181
"1", "2", "3", "4", "5", "6", "7", "8", "9", NULL);
184
else if (errno != EINVAL)
187
#if __GNUC__ < 4 /* gcc 4.0 has a sentinel attribute. */
188
out = strconcat (NULL);
192
out = strconcat (NULL, NULL);
195
out = strconcat ("", NULL);
200
out = strconcat ("", "", NULL);
205
out = strconcat ("a", "b", NULL);
206
if (!out || strcmp (out, "ab"))
209
out = strconcat ("a", "b", "c", NULL);
210
if (!out || strcmp (out, "abc"))
214
out = strconcat ("a", "b", "cc", NULL);
215
if (!out || strcmp (out, "abcc"))
218
out = strconcat ("a1", "b1", "c1", NULL);
219
if (!out || strcmp (out, "a1b1c1"))
223
out = strconcat ("", " long b ", "", "--even-longer--", NULL);
224
if (!out || strcmp (out, " long b --even-longer--"))
228
out = strconcat ("", " long b ", "", "--even-longer--", NULL);
229
if (!out || strcmp (out, " long b --even-longer--"))
235
test_xstrconcat (void)
239
out = xstrconcat ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
240
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
241
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
242
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
243
"1", "2", "3", "4", "5", "6", "7", NULL);
247
#if __GNUC__ < 4 /* gcc 4.0 has a sentinel attribute. */
248
out = xstrconcat (NULL);
252
out = xstrconcat (NULL, NULL);
255
out = xstrconcat ("", NULL);
260
out = xstrconcat ("", "", NULL);
265
out = xstrconcat ("a", "b", NULL);
266
if (!out || strcmp (out, "ab"))
269
out = xstrconcat ("a", "b", "c", NULL);
270
if (!out || strcmp (out, "abc"))
274
out = xstrconcat ("a", "b", "cc", NULL);
275
if (!out || strcmp (out, "abcc"))
278
out = xstrconcat ("a1", "b1", "c1", NULL);
279
if (!out || strcmp (out, "a1b1c1"))
283
out = xstrconcat ("", " long b ", "", "--even-longer--", NULL);
284
if (!out || strcmp (out, " long b --even-longer--"))
288
out = xstrconcat ("", " long b ", "", "--even-longer--", NULL);
289
if (!out || strcmp (out, " long b --even-longer--"))
296
test_make_filename_try (void)
299
const char *home = gethome ();
300
size_t homelen = home? strlen (home):0;
302
out = make_filename_try ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
303
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
304
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
305
"1", "2", "3", NULL);
308
else if (errno != EINVAL)
311
out = make_filename_try ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
312
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
313
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
314
"1", "2", "3", "4", NULL);
317
else if (errno != EINVAL)
321
out = make_filename_try ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
322
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
323
"1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
325
if (!out || strcmp (out,
326
"1/2/3/4/5/6/7/8/9/10/"
327
"1/2/3/4/5/6/7/8/9/10/"
328
"1/2/3/4/5/6/7/8/9/10/"
333
out = make_filename_try ("foo", "~/bar", "baz/cde", NULL);
334
if (!out || strcmp (out, "foo/~/bar/baz/cde"))
338
out = make_filename_try ("foo", "~/bar", "baz/cde/", NULL);
339
if (!out || strcmp (out, "foo/~/bar/baz/cde/"))
343
out = make_filename_try ("/foo", "~/bar", "baz/cde/", NULL);
344
if (!out || strcmp (out, "/foo/~/bar/baz/cde/"))
348
out = make_filename_try ("//foo", "~/bar", "baz/cde/", NULL);
349
if (!out || strcmp (out, "//foo/~/bar/baz/cde/"))
353
out = make_filename_try ("", "~/bar", "baz/cde", NULL);
354
if (!out || strcmp (out, "/~/bar/baz/cde"))
359
out = make_filename_try ("~/foo", "bar", NULL);
364
if (strlen (out) < homelen + 7)
366
if (strncmp (out, home, homelen))
368
if (strcmp (out+homelen, "/foo/bar"))
373
if (strcmp (out, "~/foo/bar"))
378
out = make_filename_try ("~", "bar", NULL);
383
if (strlen (out) < homelen + 3)
385
if (strncmp (out, home, homelen))
387
if (strcmp (out+homelen, "/bar"))
392
if (strcmp (out, "~/bar"))
122
400
main (int argc, char **argv)