48 static void check_combine(
const char *src,
const char *dst,
const char *exp) {
52 fail_unless(strcmp(
res, exp) == 0,
"path_combine(%s, %s) = %s but should be %s", src, dst,
res, exp);
62 fail_unless(strcmp(
tmp, exp) == 0,
"path_normalize(%s) = %s but should be %s",
path,
tmp, exp);
69 fail_unless(strcmp(
res, exp) == 0,
"path_combine_and_normalize(%s, %s) = %s but should be %s", src, dst,
res, exp);
73 check_combine(
"/path1/file1",
"/path2/file2",
"/path2/file2");
75 check_combine(
"/path1/file1",
"path2/file2",
"/path1/path2/file2");
76 check_combine(
"path1/file1",
"path2/file2",
"path1/path2/file2");
93 check_normalize(
"//a//b//..//c//d//..//e//..//..//f//g//..//h",
"/a/f/h");
129 Suite *s = suite_create(
"path");
130 TCase *tc_core = tcase_create(
"Core");
135 suite_add_tcase(s, tc_core);
136 tcase_add_test(tc_core, test_path_combine);
137 tcase_add_test(tc_core, test_path_normalize);
138 tcase_add_test(tc_core, test_path_combine_and_normalize);
146 SRunner *sr = srunner_create(s);
148 srunner_set_xml(sr, LOGDIR
"/unit/common/path.xml");
149 srunner_set_log(sr, LOGDIR
"/unit/common/path.out");
150 srunner_run_all(sr, CK_ENV);
151 nf = srunner_ntests_failed(sr);
153 return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;