-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_Path.c
More file actions
30 lines (28 loc) · 1.45 KB
/
test_Path.c
File metadata and controls
30 lines (28 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "mocc.h"
void test_Path(void) {
assert(strcmp(Path_join("", "test.c"), "test.c") == 0);
assert(strcmp(Path_join("", "te/st.c"), "te/st.c") == 0);
assert(strcmp(Path_join(".", "test.c"), "./test.c") == 0);
assert(strcmp(Path_join(".", "te/st.c"), "./te/st.c") == 0);
assert(strcmp(Path_join("./", "test.c"), "./test.c") == 0);
assert(strcmp(Path_join("./", "te/st.c"), "./te/st.c") == 0);
assert(strcmp(Path_join("a", "test.c"), "a/test.c") == 0);
assert(strcmp(Path_join("a", "te/st.c"), "a/te/st.c") == 0);
assert(strcmp(Path_join("a/", "test.c"), "a/test.c") == 0);
assert(strcmp(Path_join("a/", "te/st.c"), "a/te/st.c") == 0);
assert(strcmp(Path_join("/", "test.c"), "/test.c") == 0);
assert(strcmp(Path_join("/", "te/st.c"), "/te/st.c") == 0);
assert(strcmp(Path_join("/a/b", "test.c"), "/a/b/test.c") == 0);
assert(strcmp(Path_join("/a/b", "te/st.c"), "/a/b/te/st.c") == 0);
assert(strcmp(Path_dir(""), "") == 0);
assert(strcmp(Path_dir("test.c"), "") == 0);
assert(strcmp(Path_dir("./"), "./") == 0);
assert(strcmp(Path_dir("./test.c"), "./") == 0);
assert(strcmp(Path_dir("a/b"), "a/") == 0);
assert(strcmp(Path_dir("a/b/"), "a/b/") == 0);
assert(strcmp(Path_dir("a/b/c"), "a/b/") == 0);
assert(strcmp(Path_dir("a/"), "a/") == 0);
assert(strcmp(Path_dir("/"), "/") == 0);
assert(strcmp(Path_dir("/a/b"), "/a/") == 0);
assert(strcmp(Path_dir("/a/b/"), "/a/b/") == 0);
}