Test reserving a massive arena

This commit is contained in:
Abdelrahman Said 2024-06-03 08:05:14 +01:00
parent 6499dd7be9
commit 8d89695fcc
3 changed files with 14 additions and 0 deletions

View File

@ -19,6 +19,18 @@ TestFuncResult test_arena_init(void) {
return wapp_tester_result(result);
}
TestFuncResult test_arena_init_succeeds_when_reserving_very_large_size(void) {
Arena *large_arena = NULL;
u64 capacity = 512ull * 1024ull * 1024ull * 1024ull;
bool result =
wapp_mem_arena_init(&large_arena, capacity, WAPP_MEM_ALLOC_RESERVE, false);
if (result) {
wapp_mem_arena_destroy(&large_arena);
}
return wapp_tester_result(result);
}
TestFuncResult test_arena_alloc_succeeds_when_within_capacity(void) {
array = wapp_mem_arena_alloc(arena, count * sizeof(i32));
bool result = array != NULL;

View File

@ -8,6 +8,7 @@ extern "C" {
#endif // __cplusplus
TestFuncResult test_arena_init(void);
TestFuncResult test_arena_init_succeeds_when_reserving_very_large_size(void);
TestFuncResult test_arena_alloc_succeeds_when_within_capacity(void);
TestFuncResult test_arena_alloc_fails_when_over_capacity(void);
TestFuncResult test_arena_clear(void);

View File

@ -4,6 +4,7 @@
int main(void) {
wapp_tester_run_tests(test_arena_init,
test_arena_init_succeeds_when_reserving_very_large_size,
test_arena_alloc_succeeds_when_within_capacity,
test_arena_alloc_fails_when_over_capacity,
test_arena_clear, test_arena_destroy);