fixed intersections with relative components and roots

This commit is contained in:
Leonard Iklé committed 2018-09-01 15:58:01 +02:00
1 parent 5e17e2be99
commit c43003bd00
4 files changed
+161 -12

No files matched your search

+56
View File
@@ -1,6 +1,62 @@
#include <cwalk.h>
#include <stdlib.h>
int intersection_relative()
{
cwk_path_set_style(CWK_STYLE_UNIX);
if (cwk_path_get_intersection("/test/abc/../foo/bar", "/test/foo/har") !=
16) {
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
int intersection_one_root_only()
{
cwk_path_set_style(CWK_STYLE_WINDOWS);
if (cwk_path_get_intersection("C:/abc/test.txt", "C:/") != 3) {
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
int intersection_same_roots()
{
cwk_path_set_style(CWK_STYLE_WINDOWS);
if (cwk_path_get_intersection("C:/abc/test.txt", "C:/def/test.txt") != 3) {
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
int intersection_relative_absolute_mix()
{
cwk_path_set_style(CWK_STYLE_UNIX);
if (cwk_path_get_intersection("/test/abc.txt", "test/abc.txt") != 0) {
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
int intersection_unequal_roots()
{
cwk_path_set_style(CWK_STYLE_WINDOWS);
if (cwk_path_get_intersection("C:/test/abc.txt", "D:/test/abc.txt") != 0) {
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
int intersection_empty()
{
cwk_path_set_style(CWK_STYLE_UNIX);
+12
View File
@@ -3,6 +3,18 @@
#include <stdlib.h>
#include <string.h>
int windows_intersection_case()
{
cwk_path_set_style(CWK_STYLE_WINDOWS);
if (cwk_path_get_intersection("C:\\MYFOLDER\\MYILE.TXT",
"c:\\myfolder\\myile.txt") != 21) {
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
int windows_get_root_relative()
{
size_t size;