Fix MSVC errors and warnings

This commit is contained in:
2024-10-05 20:07:48 +01:00
parent 1ddc5610f9
commit ffb99a3644
9 changed files with 77 additions and 51 deletions

View File

@@ -26,12 +26,13 @@ TestFuncResult test_commander_cmd_out_buf_success(void) {
char buf[64] = {0};
char expected_output[64] = {0};
const char *msg = "hello world";
u64 length = strlen(msg);
sprintf(expected_output, "%s\n", msg);
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, buf, 64, "echo", msg);
bool succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
result.error == SHELL_ERR_NO_ERROR &&
strcmp(buf, expected_output) == 0;
strncmp(buf, expected_output, length) == 0;
return wapp_tester_result(succeeded);
}
@@ -39,9 +40,10 @@ TestFuncResult test_commander_cmd_out_buf_success(void) {
TestFuncResult test_commander_cmd_out_buf_failure(void) {
char buf[4] = {0};
const char *msg = "hello world";
u64 length = strlen(msg);
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, buf, 4, "echo", msg);
bool failed = !result.exited && result.exit_code != EXIT_SUCCESS &&
result.error == SHELL_ERR_OUT_BUF_FULL && strcmp(buf, msg) != 0;
result.error == SHELL_ERR_OUT_BUF_FULL && strncmp(buf, msg, length) != 0;
return wapp_tester_result(failed);
}