Rename cpath
This commit is contained in:
+22
-22
@@ -13,8 +13,8 @@ WpTestFuncResult test_cpath_join_path(void) {
|
||||
WpStr8 out = wpStr8Buf(MAIN_BUF_SIZE);
|
||||
WpStr8 tmp = wpStr8Buf(TMP_BUF_SIZE);
|
||||
|
||||
wpStr8Format(&expected, "%chome%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wpStr8Format(&tmp, "%c", WAPP_PATH_SEP);
|
||||
wpStr8Format(&expected, "%chome%cabdelrahman%cDocuments", WP_PATH_SEP, WP_PATH_SEP, WP_PATH_SEP);
|
||||
wpStr8Format(&tmp, "%c", WP_PATH_SEP);
|
||||
|
||||
WpStr8List parts = wpDblList(WpStr8);
|
||||
wpDblListPushBack(WpStr8, &parts, &tmp);
|
||||
@@ -27,7 +27,7 @@ WpTestFuncResult test_cpath_join_path(void) {
|
||||
|
||||
wpDblListPopFront(WpStr8, &parts);
|
||||
|
||||
wpStr8Format(&expected, "home%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wpStr8Format(&expected, "home%cabdelrahman%cDocuments", WP_PATH_SEP, WP_PATH_SEP);
|
||||
|
||||
wpCpathJoinPath(&out, &parts);
|
||||
result = result && wpStr8Equal(&out, &expected);
|
||||
@@ -36,27 +36,27 @@ WpTestFuncResult test_cpath_join_path(void) {
|
||||
wpDblListPopFront(WpStr8, &parts);
|
||||
wpDblListPushFront(WpStr8, &parts, &tmp);
|
||||
|
||||
wpStr8Format(&expected, "%chome%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wpStr8Format(&expected, "%chome%cabdelrahman%cDocuments", WP_PATH_SEP, WP_PATH_SEP, WP_PATH_SEP);
|
||||
|
||||
wpCpathJoinPath(&out, &parts);
|
||||
result = result && wpStr8Equal(&out, &expected);
|
||||
|
||||
wpStr8Format(&tmp, "home%c", WAPP_PATH_SEP);
|
||||
wpStr8Format(&tmp, "home%c", WP_PATH_SEP);
|
||||
wpDblListPopFront(WpStr8, &parts);
|
||||
wpDblListPushFront(WpStr8, &parts, &wpStr8Lit("home"));
|
||||
|
||||
wpStr8Format(&expected, "home%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wpStr8Format(&expected, "home%cabdelrahman%cDocuments", WP_PATH_SEP, WP_PATH_SEP);
|
||||
|
||||
wpCpathJoinPath(&out, &parts);
|
||||
result = result && wpStr8Equal(&out, &expected);
|
||||
|
||||
wpDblListEmpty(WpStr8, &parts);
|
||||
|
||||
wpStr8Format(&tmp, "%chome", WAPP_PATH_SEP);
|
||||
wpStr8Format(&tmp, "%chome", WP_PATH_SEP);
|
||||
wpDblListPushBack(WpStr8, &parts, &tmp);
|
||||
wpDblListPushBack(WpStr8, &parts, &wpStr8Lit(""));
|
||||
|
||||
wpStr8Format(&expected, "%chome", WAPP_PATH_SEP);
|
||||
wpStr8Format(&expected, "%chome", WP_PATH_SEP);
|
||||
|
||||
wpCpathJoinPath(&out, &parts);
|
||||
result = result && wpStr8Equal(&out, &expected);
|
||||
@@ -93,8 +93,8 @@ WpTestFuncResult test_cpath_dirname(void) {
|
||||
WpStr8 tmp = wpStr8Buf(TMP_BUF_SIZE);
|
||||
|
||||
// CASE 1
|
||||
wpStr8Format(&tmp, "%c", WAPP_PATH_SEP);
|
||||
wpStr8Format(&expected, "%c", WAPP_PATH_SEP);
|
||||
wpStr8Format(&tmp, "%c", WP_PATH_SEP);
|
||||
wpStr8Format(&expected, "%c", WP_PATH_SEP);
|
||||
|
||||
output = wpCpathDirname(&arena, &tmp);
|
||||
result = output != NULL && wpStr8Equal(output, &expected);
|
||||
@@ -110,15 +110,15 @@ WpTestFuncResult test_cpath_dirname(void) {
|
||||
result = result && output != NULL && wpStr8Equal(output, &expected);
|
||||
|
||||
// CASE 4
|
||||
wpStr8Format(&tmp, "%chome%ctest", WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wpStr8Format(&expected, "%chome", WAPP_PATH_SEP);
|
||||
wpStr8Format(&tmp, "%chome%ctest", WP_PATH_SEP, WP_PATH_SEP);
|
||||
wpStr8Format(&expected, "%chome", WP_PATH_SEP);
|
||||
|
||||
output = wpCpathDirname(&arena, &tmp);
|
||||
result = result && output != NULL && wpStr8Equal(output, &expected);
|
||||
|
||||
// CASE 5
|
||||
wpStr8Format(&tmp, "%chome%ctest%c", WAPP_PATH_SEP, WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wpStr8Format(&expected, "%chome", WAPP_PATH_SEP);
|
||||
wpStr8Format(&tmp, "%chome%ctest%c", WP_PATH_SEP, WP_PATH_SEP, WP_PATH_SEP);
|
||||
wpStr8Format(&expected, "%chome", WP_PATH_SEP);
|
||||
|
||||
output = wpCpathDirname(&arena, &tmp);
|
||||
result = result && output != NULL && wpStr8Equal(output, &expected);
|
||||
@@ -141,35 +141,35 @@ WpTestFuncResult test_cpath_dirup(void) {
|
||||
WpStr8 tmp = wpStr8Buf(TMP_BUF_SIZE);
|
||||
|
||||
// CASE 1
|
||||
wpStr8Format(&tmp, "%c", WAPP_PATH_SEP);
|
||||
wpStr8Format(&expected, "%c", WAPP_PATH_SEP);
|
||||
wpStr8Format(&tmp, "%c", WP_PATH_SEP);
|
||||
wpStr8Format(&expected, "%c", WP_PATH_SEP);
|
||||
|
||||
output = wpCpathDirup(&arena, &tmp, 3);
|
||||
result = output != NULL && wpStr8Equal(output, &expected);
|
||||
|
||||
// CASE 2
|
||||
wpStr8Format(&tmp, "%chome%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wpStr8Format(&expected, "%c", WAPP_PATH_SEP);
|
||||
wpStr8Format(&tmp, "%chome%cabdelrahman%cDocuments", WP_PATH_SEP, WP_PATH_SEP, WP_PATH_SEP);
|
||||
wpStr8Format(&expected, "%c", WP_PATH_SEP);
|
||||
|
||||
output = wpCpathDirup(&arena, &tmp, 3);
|
||||
result = result && output != NULL && wpStr8Equal(output, &expected);
|
||||
|
||||
// CASE 3
|
||||
wpStr8Format(&tmp, "home%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wpStr8Format(&tmp, "home%cabdelrahman%cDocuments", WP_PATH_SEP, WP_PATH_SEP);
|
||||
wpStr8CopyCstrCapped(&expected, ".");
|
||||
|
||||
output = wpCpathDirup(&arena, &tmp, 3);
|
||||
result = result && output != NULL && wpStr8Equal(output, &expected);
|
||||
|
||||
// CASE 4
|
||||
wpStr8Format(&tmp, "%chome%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wpStr8Format(&expected, "%chome", WAPP_PATH_SEP);
|
||||
wpStr8Format(&tmp, "%chome%cabdelrahman%cDocuments", WP_PATH_SEP, WP_PATH_SEP, WP_PATH_SEP);
|
||||
wpStr8Format(&expected, "%chome", WP_PATH_SEP);
|
||||
|
||||
output = wpCpathDirup(&arena, &tmp, 2);
|
||||
result = result && output != NULL && wpStr8Equal(output, &expected);
|
||||
|
||||
// CASE 5
|
||||
wpStr8Format(&tmp, "home%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wpStr8Format(&tmp, "home%cabdelrahman%cDocuments", WP_PATH_SEP, WP_PATH_SEP);
|
||||
wpStr8CopyCstrCapped(&expected, "home");
|
||||
|
||||
output = wpCpathDirup(&arena, &tmp, 2);
|
||||
|
||||
Reference in New Issue
Block a user