Improve early exit code in test_cpath
This commit is contained in:
parent
77e634ec2d
commit
8d8fcf9dc5
@ -16,7 +16,7 @@ TestFuncResult test_cpath_join_path(void) {
|
|||||||
|
|
||||||
bool result = strcmp(out, expected) == 0;
|
bool result = strcmp(out, expected) == 0;
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return wapp_tester_result(result);
|
goto TEST_JOIN_PATH_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(out, 0, strlen(out));
|
memset(out, 0, strlen(out));
|
||||||
@ -25,7 +25,7 @@ TestFuncResult test_cpath_join_path(void) {
|
|||||||
|
|
||||||
result = result && strcmp(out, expected) == 0;
|
result = result && strcmp(out, expected) == 0;
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return wapp_tester_result(result);
|
goto TEST_JOIN_PATH_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(out, 0, strlen(out));
|
memset(out, 0, strlen(out));
|
||||||
@ -36,7 +36,7 @@ TestFuncResult test_cpath_join_path(void) {
|
|||||||
|
|
||||||
result = result && strcmp(out, expected) == 0;
|
result = result && strcmp(out, expected) == 0;
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return wapp_tester_result(result);
|
goto TEST_JOIN_PATH_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(out, 0, strlen(out));
|
memset(out, 0, strlen(out));
|
||||||
@ -47,7 +47,7 @@ TestFuncResult test_cpath_join_path(void) {
|
|||||||
|
|
||||||
result = result && strcmp(out, expected) == 0;
|
result = result && strcmp(out, expected) == 0;
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return wapp_tester_result(result);
|
goto TEST_JOIN_PATH_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(out, 0, strlen(out));
|
memset(out, 0, strlen(out));
|
||||||
@ -58,7 +58,7 @@ TestFuncResult test_cpath_join_path(void) {
|
|||||||
|
|
||||||
result = result && strcmp(out, expected) == 0;
|
result = result && strcmp(out, expected) == 0;
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return wapp_tester_result(result);
|
goto TEST_JOIN_PATH_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(out, 0, strlen(out));
|
memset(out, 0, strlen(out));
|
||||||
@ -67,7 +67,7 @@ TestFuncResult test_cpath_join_path(void) {
|
|||||||
|
|
||||||
result = result && strcmp(out, expected) == 0;
|
result = result && strcmp(out, expected) == 0;
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return wapp_tester_result(result);
|
goto TEST_JOIN_PATH_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(out, 0, strlen(out));
|
memset(out, 0, strlen(out));
|
||||||
@ -76,6 +76,7 @@ TestFuncResult test_cpath_join_path(void) {
|
|||||||
|
|
||||||
result = result && strcmp(out, expected) == 0;
|
result = result && strcmp(out, expected) == 0;
|
||||||
|
|
||||||
|
TEST_JOIN_PATH_EXIT:
|
||||||
return wapp_tester_result(result);
|
return wapp_tester_result(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,21 +87,21 @@ TestFuncResult test_cpath_dirname(void) {
|
|||||||
wapp_cpath_dirname(buf, "/");
|
wapp_cpath_dirname(buf, "/");
|
||||||
bool result = strcmp(buf, "/") == 0;
|
bool result = strcmp(buf, "/") == 0;
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return wapp_tester_result(result);
|
goto TEST_DIRNAME_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(buf, 0, strlen(buf));
|
memset(buf, 0, strlen(buf));
|
||||||
wapp_cpath_dirname(buf, "home");
|
wapp_cpath_dirname(buf, "home");
|
||||||
result = strcmp(buf, ".") == 0;
|
result = strcmp(buf, ".") == 0;
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return wapp_tester_result(result);
|
goto TEST_DIRNAME_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(buf, 0, strlen(buf));
|
memset(buf, 0, strlen(buf));
|
||||||
wapp_cpath_dirname(buf, "");
|
wapp_cpath_dirname(buf, "");
|
||||||
result = strcmp(buf, ".") == 0;
|
result = strcmp(buf, ".") == 0;
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return wapp_tester_result(result);
|
goto TEST_DIRNAME_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(buf, 0, strlen(buf));
|
memset(buf, 0, strlen(buf));
|
||||||
@ -108,7 +109,7 @@ TestFuncResult test_cpath_dirname(void) {
|
|||||||
wapp_cpath_dirname(buf, tmp);
|
wapp_cpath_dirname(buf, tmp);
|
||||||
result = strcmp(buf, "/home") == 0;
|
result = strcmp(buf, "/home") == 0;
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return wapp_tester_result(result);
|
goto TEST_DIRNAME_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(buf, 0, strlen(buf));
|
memset(buf, 0, strlen(buf));
|
||||||
@ -117,6 +118,7 @@ TestFuncResult test_cpath_dirname(void) {
|
|||||||
wapp_cpath_dirname(buf, tmp);
|
wapp_cpath_dirname(buf, tmp);
|
||||||
result = strcmp(buf, "/home") == 0;
|
result = strcmp(buf, "/home") == 0;
|
||||||
|
|
||||||
|
TEST_DIRNAME_EXIT:
|
||||||
return wapp_tester_result(result);
|
return wapp_tester_result(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +129,7 @@ TestFuncResult test_cpath_dirup(void) {
|
|||||||
wapp_cpath_dirup(buf, 3, "/");
|
wapp_cpath_dirup(buf, 3, "/");
|
||||||
bool result = strcmp(buf, "/") == 0;
|
bool result = strcmp(buf, "/") == 0;
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return wapp_tester_result(result);
|
goto TEST_DIRUP_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(buf, 0, strlen(buf));
|
memset(buf, 0, strlen(buf));
|
||||||
@ -135,7 +137,7 @@ TestFuncResult test_cpath_dirup(void) {
|
|||||||
wapp_cpath_dirup(buf, 3, tmp);
|
wapp_cpath_dirup(buf, 3, tmp);
|
||||||
result = strcmp(buf, "/") == 0;
|
result = strcmp(buf, "/") == 0;
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return wapp_tester_result(result);
|
goto TEST_DIRUP_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(buf, 0, strlen(buf));
|
memset(buf, 0, strlen(buf));
|
||||||
@ -144,7 +146,7 @@ TestFuncResult test_cpath_dirup(void) {
|
|||||||
wapp_cpath_dirup(buf, 3, tmp);
|
wapp_cpath_dirup(buf, 3, tmp);
|
||||||
result = strcmp(buf, ".") == 0;
|
result = strcmp(buf, ".") == 0;
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return wapp_tester_result(result);
|
goto TEST_DIRUP_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(buf, 0, strlen(buf));
|
memset(buf, 0, strlen(buf));
|
||||||
@ -152,7 +154,7 @@ TestFuncResult test_cpath_dirup(void) {
|
|||||||
wapp_cpath_dirup(buf, 2, tmp);
|
wapp_cpath_dirup(buf, 2, tmp);
|
||||||
result = strcmp(buf, "/home") == 0;
|
result = strcmp(buf, "/home") == 0;
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return wapp_tester_result(result);
|
goto TEST_DIRUP_EXIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(buf, 0, strlen(buf));
|
memset(buf, 0, strlen(buf));
|
||||||
@ -161,5 +163,6 @@ TestFuncResult test_cpath_dirup(void) {
|
|||||||
wapp_cpath_dirup(buf, 2, tmp);
|
wapp_cpath_dirup(buf, 2, tmp);
|
||||||
result = strcmp(buf, "home") == 0;
|
result = strcmp(buf, "home") == 0;
|
||||||
|
|
||||||
|
TEST_DIRUP_EXIT:
|
||||||
return wapp_tester_result(result);
|
return wapp_tester_result(result);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user