Rename arena

This commit is contained in:
2026-06-26 17:17:22 +01:00
parent f0e9da26bd
commit 273dbf4535
12 changed files with 224 additions and 224 deletions
+28 -28
View File
@@ -77,7 +77,7 @@ WpTestFuncResult test_str8_buf(void) {
WpTestFuncResult test_str8_alloc_buf(void) {
b8 result;
WpAllocator allocator = wapp_mem_arena_allocator_init(KiB(100));
WpAllocator allocator = wpMemArenaAllocatorInit(KiB(100));
if (wpMemAllocatorInvalid(&allocator)) {
return wpTesterResult(false);
}
@@ -98,14 +98,14 @@ WpTestFuncResult test_str8_alloc_buf(void) {
result = result && s->capacity == capacity && s->size == strlen(cstr) && memcmp(s->buf, cstr, s->size) == 0;
TEST_ALLOC_BUF_CLEANUP:
wapp_mem_arena_allocator_destroy(&allocator);
wpMemArenaAllocatorDestroy(&allocator);
return wpTesterResult(result);
}
WpTestFuncResult test_str8_alloc_cstr(void) {
b8 result;
WpAllocator allocator = wapp_mem_arena_allocator_init(KiB(100));
WpAllocator allocator = wpMemArenaAllocatorInit(KiB(100));
if (wpMemAllocatorInvalid(&allocator)) {
return wpTesterResult(false);
}
@@ -119,14 +119,14 @@ WpTestFuncResult test_str8_alloc_cstr(void) {
result = s->size == length && memcmp(s->buf, str, length) == 0;
wapp_mem_arena_allocator_destroy(&allocator);
wpMemArenaAllocatorDestroy(&allocator);
return wpTesterResult(result);
}
WpTestFuncResult test_str8_alloc_str8(void) {
b8 result;
WpAllocator allocator = wapp_mem_arena_allocator_init(KiB(100));
WpAllocator allocator = wpMemArenaAllocatorInit(KiB(100));
if (wpMemAllocatorInvalid(&allocator)) {
return wpTesterResult(false);
}
@@ -139,14 +139,14 @@ WpTestFuncResult test_str8_alloc_str8(void) {
result = wpStr8Equal(s, &str);
wapp_mem_arena_allocator_destroy(&allocator);
wpMemArenaAllocatorDestroy(&allocator);
return wpTesterResult(result);
}
WpTestFuncResult test_str8_alloc_substr(void) {
b8 result;
WpAllocator allocator = wapp_mem_arena_allocator_init(KiB(100));
WpAllocator allocator = wpMemArenaAllocatorInit(KiB(100));
if (wpMemAllocatorInvalid(&allocator)) {
return wpTesterResult(false);
}
@@ -159,7 +159,7 @@ WpTestFuncResult test_str8_alloc_substr(void) {
result = s->size == 5 && memcmp(s->buf, "elrah", s->size) == 0;
wapp_mem_arena_allocator_destroy(&allocator);
wpMemArenaAllocatorDestroy(&allocator);
return wpTesterResult(result);
}
@@ -289,7 +289,7 @@ WpTestFuncResult test_str8_slice(void) {
WpTestFuncResult test_str8_alloc_concat(void) {
b8 result;
WpAllocator arena = wapp_mem_arena_allocator_init(KiB(100));
WpAllocator arena = wpMemArenaAllocatorInit(KiB(100));
WpStr8 str = wpStr8Lit("Hello world");
WpStr8 suffix1 = wpStr8Lit(" from me.");
@@ -305,7 +305,7 @@ WpTestFuncResult test_str8_alloc_concat(void) {
output = wpStr8AllocConcat(&arena, output, &suffix2);
result = result && output->size == concat2.size && wpStr8Equal(output, &concat2);
wapp_mem_arena_allocator_destroy(&arena);
wpMemArenaAllocatorDestroy(&arena);
return wpTesterResult(result);
}
@@ -410,7 +410,7 @@ WpTestFuncResult test_str8_rfind(void) {
WpTestFuncResult test_str8_split(void) {
b8 result;
WpAllocator arena = wapp_mem_arena_allocator_init(KiB(100));
WpAllocator arena = wpMemArenaAllocatorInit(KiB(100));
WpStr8 str = wpStr8Lit("hello world from me");
WpStr8 delim1 = wpStr8Lit(" ");
@@ -443,7 +443,7 @@ WpTestFuncResult test_str8_split(void) {
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
// MSVC Spectre mitigation warnings
while (running1) {
WpStr8 *node = wapp_dbl_list_get(WpStr8, list1, index1);
WpStr8 *node = wpDblListGet(WpStr8, list1, index1);
result = result && wpStr8Equal(node, &(splits1[index1]));
++index1;
@@ -453,21 +453,21 @@ WpTestFuncResult test_str8_split(void) {
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
// MSVC Spectre mitigation warnings
while (running2) {
WpStr8 *node = wapp_dbl_list_get(WpStr8, list2, index2);
WpStr8 *node = wpDblListGet(WpStr8, list2, index2);
result = result && wpStr8Equal(node, &(splits2[index2]));
++index2;
running2 = index2 < count2;
}
wapp_mem_arena_allocator_destroy(&arena);
wpMemArenaAllocatorDestroy(&arena);
return wpTesterResult(result);
}
WpTestFuncResult test_str8_split_with_max(void) {
b8 result;
WpAllocator arena = wapp_mem_arena_allocator_init(KiB(100));
WpAllocator arena = wpMemArenaAllocatorInit(KiB(100));
WpStr8 str = wpStr8Lit("hello world from me");
WpStr8 delim = wpStr8Lit(" ");
@@ -488,21 +488,21 @@ WpTestFuncResult test_str8_split_with_max(void) {
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
// MSVC Spectre mitigation warnings
while (running) {
WpStr8 *node = wapp_dbl_list_get(WpStr8, list, index);
WpStr8 *node = wpDblListGet(WpStr8, list, index);
result = result && wpStr8Equal(node, &(splits[index]));
++index;
running = index < count;
}
wapp_mem_arena_allocator_destroy(&arena);
wpMemArenaAllocatorDestroy(&arena);
return wpTesterResult(result);
}
WpTestFuncResult test_str8_rsplit(void) {
b8 result;
WpAllocator arena = wapp_mem_arena_allocator_init(KiB(100));
WpAllocator arena = wpMemArenaAllocatorInit(KiB(100));
WpStr8 str = wpStr8Lit("hello world from me");
WpStr8 delim1 = wpStr8Lit(" ");
@@ -535,7 +535,7 @@ WpTestFuncResult test_str8_rsplit(void) {
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
// MSVC Spectre mitigation warnings
while (running1) {
WpStr8 *node = wapp_dbl_list_get(WpStr8, list1, index1);
WpStr8 *node = wpDblListGet(WpStr8, list1, index1);
result = result && wpStr8Equal(node, &(splits1[index1]));
++index1;
@@ -545,21 +545,21 @@ WpTestFuncResult test_str8_rsplit(void) {
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
// MSVC Spectre mitigation warnings
while (running2) {
WpStr8 *node = wapp_dbl_list_get(WpStr8, list2, index2);
WpStr8 *node = wpDblListGet(WpStr8, list2, index2);
result = result && wpStr8Equal(node, &(splits2[index2]));
++index2;
running2 = index2 < count2;
}
wapp_mem_arena_allocator_destroy(&arena);
wpMemArenaAllocatorDestroy(&arena);
return wpTesterResult(result);
}
WpTestFuncResult test_str8_rsplit_with_max(void) {
b8 result;
WpAllocator arena = wapp_mem_arena_allocator_init(KiB(100));
WpAllocator arena = wpMemArenaAllocatorInit(KiB(100));
WpStr8 str = wpStr8Lit("hello world from me");
WpStr8 delim = wpStr8Lit(" ");
@@ -580,21 +580,21 @@ WpTestFuncResult test_str8_rsplit_with_max(void) {
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
// MSVC Spectre mitigation warnings
while (running) {
WpStr8 *node = wapp_dbl_list_get(WpStr8, list, index);
WpStr8 *node = wpDblListGet(WpStr8, list, index);
result = result && wpStr8Equal(node, &(splits[index]));
++index;
running = index < count;
}
wapp_mem_arena_allocator_destroy(&arena);
wpMemArenaAllocatorDestroy(&arena);
return wpTesterResult(result);
}
WpTestFuncResult test_str8_join(void) {
b8 result;
WpAllocator arena = wapp_mem_arena_allocator_init(KiB(100));
WpAllocator arena = wpMemArenaAllocatorInit(KiB(100));
WpStr8 str = wpStr8Lit("hello world from me");
WpStr8 delim1 = wpStr8Lit(" ");
@@ -607,7 +607,7 @@ WpTestFuncResult test_str8_join(void) {
result = join1->size == str.size && wpStr8Equal(join1, &str);
result = result && join2->size == str.size && wpStr8Equal(join2, &str);
wapp_mem_arena_allocator_destroy(&arena);
wpMemArenaAllocatorDestroy(&arena);
return wpTesterResult(result);
}
@@ -616,10 +616,10 @@ WpTestFuncResult test_str8_from_bytes(void) {
b8 result;
WpStr8 str = wpStr8Buf(1024);
U8Array bytes = wapp_array(u8, 'W', 'A', 'P', 'P');
WpU8Array bytes = wpArray(u8, 'W', 'A', 'P', 'P');
wpStr8FromBytes(&str, bytes);
result = str.size == wapp_array_count(bytes) * wapp_array_item_size(bytes);
result = str.size == wpArrayCount(bytes) * wpArrayItemSize(bytes);
result = result && wpStr8Equal(&str, &wpStr8LitRo("WAPP"));
return wpTesterResult(result);
+29 -29
View File
@@ -77,7 +77,7 @@ WpTestFuncResult test_str8_buf(void) {
WpTestFuncResult test_str8_alloc_buf(void) {
b8 result;
WpAllocator allocator = wapp_mem_arena_allocator_init(KiB(100));
WpAllocator allocator = wpMemArenaAllocatorInit(KiB(100));
if (wpMemAllocatorInvalid(&allocator)) {
return wpTesterResult(false);
}
@@ -87,7 +87,7 @@ WpTestFuncResult test_str8_alloc_buf(void) {
WpStr8 *s = wpStr8AllocBuf(&allocator, capacity);
if (!s) {
result = false;
wapp_mem_arena_allocator_destroy(&allocator);
wpMemArenaAllocatorDestroy(&allocator);
return wpTesterResult(result);
}
@@ -98,14 +98,14 @@ WpTestFuncResult test_str8_alloc_buf(void) {
result = result && s->capacity == capacity && s->size == strlen(cstr) && memcmp(s->buf, cstr, s->size) == 0;
wapp_mem_arena_allocator_destroy(&allocator);
wpMemArenaAllocatorDestroy(&allocator);
return wpTesterResult(result);
}
WpTestFuncResult test_str8_alloc_cstr(void) {
b8 result;
WpAllocator allocator = wapp_mem_arena_allocator_init(KiB(100));
WpAllocator allocator = wpMemArenaAllocatorInit(KiB(100));
if (wpMemAllocatorInvalid(&allocator)) {
return wpTesterResult(false);
}
@@ -119,14 +119,14 @@ WpTestFuncResult test_str8_alloc_cstr(void) {
result = s->size == length && memcmp(s->buf, str, length) == 0;
wapp_mem_arena_allocator_destroy(&allocator);
wpMemArenaAllocatorDestroy(&allocator);
return wpTesterResult(result);
}
WpTestFuncResult test_str8_alloc_str8(void) {
b8 result;
WpAllocator allocator = wapp_mem_arena_allocator_init(KiB(100));
WpAllocator allocator = wpMemArenaAllocatorInit(KiB(100));
if (wpMemAllocatorInvalid(&allocator)) {
return wpTesterResult(false);
}
@@ -139,14 +139,14 @@ WpTestFuncResult test_str8_alloc_str8(void) {
result = wpStr8Equal(s, &str);
wapp_mem_arena_allocator_destroy(&allocator);
wpMemArenaAllocatorDestroy(&allocator);
return wpTesterResult(result);
}
WpTestFuncResult test_str8_alloc_substr(void) {
b8 result;
WpAllocator allocator = wapp_mem_arena_allocator_init(KiB(100));
WpAllocator allocator = wpMemArenaAllocatorInit(KiB(100));
if (wpMemAllocatorInvalid(&allocator)) {
return wpTesterResult(false);
}
@@ -159,7 +159,7 @@ WpTestFuncResult test_str8_alloc_substr(void) {
result = s->size == 5 && memcmp(s->buf, "elrah", s->size) == 0;
wapp_mem_arena_allocator_destroy(&allocator);
wpMemArenaAllocatorDestroy(&allocator);
return wpTesterResult(result);
}
@@ -289,7 +289,7 @@ WpTestFuncResult test_str8_slice(void) {
WpTestFuncResult test_str8_alloc_concat(void) {
b8 result;
WpAllocator arena = wapp_mem_arena_allocator_init(KiB(100));
WpAllocator arena = wpMemArenaAllocatorInit(KiB(100));
WpStr8 str = wpStr8Lit("Hello world");
WpStr8 suffix1 = wpStr8Lit(" from me.");
@@ -305,7 +305,7 @@ WpTestFuncResult test_str8_alloc_concat(void) {
output = wpStr8AllocConcat(&arena, output, &suffix2);
result = result && output->size == concat2.size && wpStr8Equal(output, &concat2);
wapp_mem_arena_allocator_destroy(&arena);
wpMemArenaAllocatorDestroy(&arena);
return wpTesterResult(result);
}
@@ -410,7 +410,7 @@ WpTestFuncResult test_str8_rfind(void) {
WpTestFuncResult test_str8_split(void) {
b8 result;
WpAllocator arena = wapp_mem_arena_allocator_init(KiB(100));
WpAllocator arena = wpMemArenaAllocatorInit(KiB(100));
WpStr8 str = wpStr8Lit("hello world from me");
WpStr8 delim1 = wpStr8Lit(" ");
@@ -443,7 +443,7 @@ WpTestFuncResult test_str8_split(void) {
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
// MSVC Spectre mitigation warnings
while (running1) {
WpStr8 *node = wapp_dbl_list_get(WpStr8, list1, index1);
WpStr8 *node = wpDblListGet(WpStr8, list1, index1);
result = result && wpStr8Equal(node, &(splits1[index1]));
++index1;
@@ -453,21 +453,21 @@ WpTestFuncResult test_str8_split(void) {
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
// MSVC Spectre mitigation warnings
while (running2) {
WpStr8 *node = wapp_dbl_list_get(WpStr8, list2, index2);
WpStr8 *node = wpDblListGet(WpStr8, list2, index2);
result = result && wpStr8Equal(node, &(splits2[index2]));
++index2;
running2 = index2 < count2;
}
wapp_mem_arena_allocator_destroy(&arena);
wpMemArenaAllocatorDestroy(&arena);
return wpTesterResult(result);
}
WpTestFuncResult test_str8_split_with_max(void) {
b8 result;
WpAllocator arena = wapp_mem_arena_allocator_init(KiB(100));
WpAllocator arena = wpMemArenaAllocatorInit(KiB(100));
WpStr8 str = wpStr8Lit("hello world from me");
WpStr8 delim = wpStr8Lit(" ");
@@ -488,21 +488,21 @@ WpTestFuncResult test_str8_split_with_max(void) {
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
// MSVC Spectre mitigation warnings
while (running) {
WpStr8 *node = wapp_dbl_list_get(WpStr8, list, index);
WpStr8 *node = wpDblListGet(WpStr8, list, index);
result = result && wpStr8Equal(node, &(splits[index]));
++index;
running = index < count;
}
wapp_mem_arena_allocator_destroy(&arena);
wpMemArenaAllocatorDestroy(&arena);
return wpTesterResult(result);
}
WpTestFuncResult test_str8_rsplit(void) {
b8 result;
WpAllocator arena = wapp_mem_arena_allocator_init(KiB(100));
WpAllocator arena = wpMemArenaAllocatorInit(KiB(100));
WpStr8 str = wpStr8Lit("hello world from me");
WpStr8 delim1 = wpStr8Lit(" ");
@@ -535,7 +535,7 @@ WpTestFuncResult test_str8_rsplit(void) {
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
// MSVC Spectre mitigation warnings
while (running1) {
WpStr8 *node = wapp_dbl_list_get(WpStr8, list1, index1);
WpStr8 *node = wpDblListGet(WpStr8, list1, index1);
result = result && wpStr8Equal(node, &(splits1[index1]));
++index1;
@@ -545,21 +545,21 @@ WpTestFuncResult test_str8_rsplit(void) {
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
// MSVC Spectre mitigation warnings
while (running2) {
WpStr8 *node = wapp_dbl_list_get(WpStr8, list2, index2);
WpStr8 *node = wpDblListGet(WpStr8, list2, index2);
result = result && wpStr8Equal(node, &(splits2[index2]));
++index2;
running2 = index2 < count2;
}
wapp_mem_arena_allocator_destroy(&arena);
wpMemArenaAllocatorDestroy(&arena);
return wpTesterResult(result);
}
WpTestFuncResult test_str8_rsplit_with_max(void) {
b8 result;
WpAllocator arena = wapp_mem_arena_allocator_init(KiB(100));
WpAllocator arena = wpMemArenaAllocatorInit(KiB(100));
WpStr8 str = wpStr8Lit("hello world from me");
WpStr8 delim = wpStr8Lit(" ");
@@ -580,21 +580,21 @@ WpTestFuncResult test_str8_rsplit_with_max(void) {
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
// MSVC Spectre mitigation warnings
while (running) {
WpStr8 *node = wapp_dbl_list_get(WpStr8, list, index);
WpStr8 *node = wpDblListGet(WpStr8, list, index);
result = result && wpStr8Equal(node, &(splits[index]));
++index;
running = index < count;
}
wapp_mem_arena_allocator_destroy(&arena);
wpMemArenaAllocatorDestroy(&arena);
return wpTesterResult(result);
}
WpTestFuncResult test_str8_join(void) {
b8 result;
WpAllocator arena = wapp_mem_arena_allocator_init(KiB(100));
WpAllocator arena = wpMemArenaAllocatorInit(KiB(100));
WpStr8 str = wpStr8Lit("hello world from me");
WpStr8 delim1 = wpStr8Lit(" ");
@@ -607,7 +607,7 @@ WpTestFuncResult test_str8_join(void) {
result = join1->size == str.size && wpStr8Equal(join1, &str);
result = result && join2->size == str.size && wpStr8Equal(join2, &str);
wapp_mem_arena_allocator_destroy(&arena);
wpMemArenaAllocatorDestroy(&arena);
return wpTesterResult(result);
}
@@ -617,10 +617,10 @@ WpTestFuncResult test_str8_from_bytes(void) {
WpStr8 str = wpStr8Buf(1024);
WpStr8 expected = wpStr8LitRo("WAPP");
U8Array bytes = wapp_array(u8, 'W', 'A', 'P', 'P');
WpU8Array bytes = wpArray(u8, 'W', 'A', 'P', 'P');
wpStr8FromBytes(&str, bytes);
result = str.size == wapp_array_count(bytes) * wapp_array_item_size(bytes);
result = str.size == wpArrayCount(bytes) * wpArrayItemSize(bytes);
result = result && wpStr8Equal(&str, &expected);
return wpTesterResult(result);