2 Commits

Author SHA1 Message Date
8b6fb23bac Use size utils in arena tests 2024-08-23 21:50:22 +01:00
1fb340561f Add size utils 2024-08-23 21:48:38 +01:00
2 changed files with 7 additions and 1 deletions

View File

@@ -3,6 +3,11 @@
#include "aliases.h"
#define KB(SIZE) (SIZE * 1024ull)
#define MB(SIZE) (KB(SIZE) * 1024)
#define GB(SIZE) (MB(SIZE) * 1024)
#define TB(SIZE) (GB(SIZE) * 1024)
#define wapp_misc_utils_padding_size(SIZE) \
u8 reserved_padding[sizeof(void *) - ((SIZE) % sizeof(void *))]

View File

@@ -1,6 +1,7 @@
#include "test_arena.h"
#include "aliases.h"
#include "mem_arena.h"
#include "misc_utils.h"
#include "tester.h"
#include <stdbool.h>
#include <stdlib.h>
@@ -19,7 +20,7 @@ TestFuncResult test_arena_init(void) {
TestFuncResult test_arena_init_succeeds_when_reserving_very_large_size(void) {
Arena *large_arena = NULL;
u64 capacity = 512ull * 1024ull * 1024ull * 1024ull;
u64 capacity = GB(512);
bool result = wapp_mem_arena_init(&large_arena, capacity,
WAPP_MEM_ALLOC_RESERVE, false);
if (result) {