return EXIT_FAILURE;
}
+static int test_path_relative(const struct test* t) {
+ char path[PATH_MAX];
+
+ ASSERT_SUCCESS(pakfire_path_relative(path, "/", "/usr/bin/bash"));
+ ASSERT_STRING_EQUALS(path, "usr/bin/bash");
+
+ ASSERT_SUCCESS(pakfire_path_relative(path, "/usr", "/usr/bin/bash"));
+ ASSERT_STRING_EQUALS(path, "bin/bash");
+
+ ASSERT_SUCCESS(pakfire_path_relative(path, "/usr/bin", "/usr/bin/bash"));
+ ASSERT_STRING_EQUALS(path, "bash");
+
+ ASSERT_SUCCESS(pakfire_path_relative(path, "/usr/sbin", "/usr/bin/bash"));
+ ASSERT_STRING_EQUALS(path, "../bin/bash");
+
+ ASSERT_SUCCESS(pakfire_path_relative(path, "/dev", "/usr/bin/bash"));
+ ASSERT_STRING_EQUALS(path, "../usr/bin/bash");
+
+ return EXIT_SUCCESS;
+
+FAIL:
+ return EXIT_FAILURE;
+}
+
int main(int argc, const char* argv[]) {
testsuite_add_test(test_path_normalize, 0);
testsuite_add_test(test_path_append, 0);
testsuite_add_test(test_path_merge, 0);
testsuite_add_test(test_path_basename, 0);
testsuite_add_test(test_path_dirname, 0);
+ testsuite_add_test(test_path_relative, 0);
return testsuite_run(argc, argv);
}