49 static void check_combine(
const char *src,
const char *dst,
const char *exp) {
53 FAIL_UNLESS(strcmp(
res, exp) == 0,
"path_combine(%s, %s) = %s but should be %s", src, dst,
res, exp);
70 FAIL_UNLESS(strcmp(
res, exp) == 0,
"path_combine_and_normalize(%s, %s) = %s but should be %s", src, dst,
res, exp);
74 check_combine(
"/path1/file1",
"/path2/file2",
"/path2/file2");
76 check_combine(
"/path1/file1",
"path2/file2",
"/path1/path2/file2");
77 check_combine(
"path1/file1",
"path2/file2",
"path1/path2/file2");
94 check_normalize(
"//a//b//..//c//d//..//e//..//..//f//g//..//h",
"/a/f/h");
130 Suite *s = suite_create(
"path");
131 TCase *tc_core = tcase_create(
"Core");
136 suite_add_tcase(s, tc_core);
137 tcase_add_test(tc_core, test_path_combine);
138 tcase_add_test(tc_core, test_path_normalize);
139 tcase_add_test(tc_core, test_path_combine_and_normalize);
147 SRunner *sr = srunner_create(s);
149 srunner_set_xml(sr, LOGDIR
"/unit/common/path.xml");
150 srunner_set_log(sr, LOGDIR
"/unit/common/path.out");
151 srunner_run_all(sr, CK_ENV);
152 nf = srunner_ntests_failed(sr);
154 return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;