#include "test_allocator.h" #include "wapp.h" #include TestFuncResult test_arena_allocator(void) { Allocator allocator = wapp_mem_arena_allocator_init(4096); b8 result = allocator.obj != NULL && allocator.alloc != NULL && allocator.alloc_aligned != NULL && allocator.realloc != NULL && allocator.realloc_aligned != NULL && allocator.free == NULL; void *ptr = wapp_mem_allocator_alloc(&allocator, 20); result = result && (ptr != NULL); wapp_mem_arena_allocator_destroy(&allocator); return wapp_tester_result(result); } TestFuncResult test_arena_allocator_with_buffer(void) { u8 buffer[KiB(4)] = {0}; Allocator allocator = wapp_mem_arena_allocator_init_with_buffer(buffer, KiB(4)); b8 result = allocator.obj != NULL && allocator.alloc != NULL && allocator.alloc_aligned != NULL && allocator.realloc != NULL && allocator.realloc_aligned != NULL && allocator.free == NULL; void *ptr = wapp_mem_allocator_alloc(&allocator, 20); result = result && (ptr != NULL); wapp_mem_arena_allocator_destroy(&allocator); return wapp_tester_result(result); }