Files
wizapp-stdlib/tests/allocator/test_allocator.cc
Abdelrahman Said b7eff6a3e4 Switch to using b32
2025-09-14 21:25:56 +01:00

18 lines
670 B
C++

#include "test_allocator.h"
#include "wapp.h"
#include <stdlib.h>
TestFuncResult test_arena_allocator(void) {
Allocator allocator = wapp_mem_arena_allocator_init(4096);
b32 result = allocator.obj != nullptr && allocator.alloc != nullptr &&
allocator.alloc_aligned != nullptr &&
allocator.realloc != nullptr && allocator.realloc_aligned != nullptr &&
allocator.free == nullptr;
void *ptr = wapp_mem_allocator_alloc(&allocator, 20);
result = result && (ptr != nullptr);
wapp_mem_arena_allocator_destroy(&allocator);
return wapp_tester_result(result);
}