Reformat
This commit is contained in:
parent
a0dfe8acd0
commit
16a1b8fa35
@ -19,12 +19,9 @@ internal inline void *mem_arena_realloc_aligned(void *ptr, u64 old_size, u64 new
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
/***************************************************************************/ //
|
/***************************************************************************/ //
|
||||||
|
|
||||||
Allocator wapp_mem_arena_allocator_init_custom(u64 base_capacity,
|
Allocator wapp_mem_arena_allocator_init_custom(u64 base_capacity, MemAllocFlags flags, bool zero_buffer) {
|
||||||
MemAllocFlags flags,
|
|
||||||
bool zero_buffer) {
|
|
||||||
Allocator allocator = {0};
|
Allocator allocator = {0};
|
||||||
bool initialised = wapp_mem_arena_init_custom(
|
bool initialised = wapp_mem_arena_init_custom((Arena **)(&allocator.obj), base_capacity, flags, zero_buffer);
|
||||||
(Arena **)(&allocator.obj), base_capacity, flags, zero_buffer);
|
|
||||||
if (!initialised) {
|
if (!initialised) {
|
||||||
return allocator;
|
return allocator;
|
||||||
}
|
}
|
||||||
@ -57,8 +54,7 @@ internal inline void *mem_arena_alloc(u64 size, void *alloc_obj) {
|
|||||||
return wapp_mem_arena_alloc(arena, size);
|
return wapp_mem_arena_alloc(arena, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal inline void *mem_arena_alloc_aligned(u64 size, u64 alignment,
|
internal inline void *mem_arena_alloc_aligned(u64 size, u64 alignment, void *alloc_obj) {
|
||||||
void *alloc_obj) {
|
|
||||||
Arena *arena = (Arena *)alloc_obj;
|
Arena *arena = (Arena *)alloc_obj;
|
||||||
return wapp_mem_arena_alloc_aligned(arena, size, alignment);
|
return wapp_mem_arena_alloc_aligned(arena, size, alignment);
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
TestFuncResult test_commander_cmd_success(void) {
|
TestFuncResult test_commander_cmd_success(void) {
|
||||||
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, NULL, 0,
|
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, NULL, 0, "echo", "hello world");
|
||||||
"echo", "hello world");
|
|
||||||
|
|
||||||
bool succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
|
bool succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
|
||||||
result.error == SHELL_ERR_NO_ERROR;
|
result.error == SHELL_ERR_NO_ERROR;
|
||||||
|
|
||||||
@ -17,9 +15,7 @@ TestFuncResult test_commander_cmd_success(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TestFuncResult test_commander_cmd_failure(void) {
|
TestFuncResult test_commander_cmd_failure(void) {
|
||||||
CMDResult result =
|
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, NULL, 0, "grep");
|
||||||
wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, NULL, 0, "grep");
|
|
||||||
|
|
||||||
bool failed = result.exited && result.exit_code != EXIT_SUCCESS &&
|
bool failed = result.exited && result.exit_code != EXIT_SUCCESS &&
|
||||||
result.error == SHELL_ERR_NO_ERROR;
|
result.error == SHELL_ERR_NO_ERROR;
|
||||||
|
|
||||||
@ -32,9 +28,7 @@ TestFuncResult test_commander_cmd_out_buf_success(void) {
|
|||||||
const char *msg = "hello world";
|
const char *msg = "hello world";
|
||||||
sprintf(expected_output, "%s\n", msg);
|
sprintf(expected_output, "%s\n", msg);
|
||||||
|
|
||||||
CMDResult result =
|
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, buf, 64, "echo", msg);
|
||||||
wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, buf, 64, "echo", msg);
|
|
||||||
|
|
||||||
bool succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
|
bool succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
|
||||||
result.error == SHELL_ERR_NO_ERROR &&
|
result.error == SHELL_ERR_NO_ERROR &&
|
||||||
strcmp(buf, expected_output) == 0;
|
strcmp(buf, expected_output) == 0;
|
||||||
@ -45,9 +39,7 @@ TestFuncResult test_commander_cmd_out_buf_success(void) {
|
|||||||
TestFuncResult test_commander_cmd_out_buf_failure(void) {
|
TestFuncResult test_commander_cmd_out_buf_failure(void) {
|
||||||
char buf[4] = {0};
|
char buf[4] = {0};
|
||||||
const char *msg = "hello world";
|
const char *msg = "hello world";
|
||||||
CMDResult result =
|
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, buf, 4, "echo", msg);
|
||||||
wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, buf, 4, "echo", msg);
|
|
||||||
|
|
||||||
bool failed = !result.exited && result.exit_code != EXIT_SUCCESS &&
|
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 && strcmp(buf, msg) != 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user