Rename Tester
This commit is contained in:
+30
-30
@@ -16,18 +16,18 @@ wp_intern u8 buf[ARENA_BUF_SIZE] = {0};
|
||||
wp_intern Arena *temp_arena = NULL;
|
||||
wp_intern u8 temp_buf[TEMP_BUF_SIZE] = {0};
|
||||
|
||||
TestFuncResult test_arena_init_buffer(void) {
|
||||
WpTestFuncResult test_arena_init_buffer(void) {
|
||||
b8 result = wapp_mem_arena_init_buffer(&buf_arena, buf, ARENA_BUF_SIZE);
|
||||
return wapp_tester_result(result);
|
||||
return wpTesterResult(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_init_allocated(void) {
|
||||
WpTestFuncResult test_arena_init_allocated(void) {
|
||||
b8 result = wapp_mem_arena_init_allocated(&arena, ARENA_CAPACITY);
|
||||
|
||||
return wapp_tester_result(result);
|
||||
return wpTesterResult(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_init_succeeds_when_reserving_very_large_size(void) {
|
||||
WpTestFuncResult test_arena_init_succeeds_when_reserving_very_large_size(void) {
|
||||
Arena *large_arena = NULL;
|
||||
u64 capacity = GiB(512);
|
||||
b8 result = wapp_mem_arena_init_allocated(&large_arena, capacity);
|
||||
@@ -35,10 +35,10 @@ TestFuncResult test_arena_init_succeeds_when_reserving_very_large_size(void) {
|
||||
wapp_mem_arena_destroy(&large_arena);
|
||||
}
|
||||
|
||||
return wapp_tester_result(result);
|
||||
return wpTesterResult(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_alloc_with_buffer(void) {
|
||||
WpTestFuncResult test_arena_alloc_with_buffer(void) {
|
||||
i32 *arr = (i32 *)wapp_mem_arena_alloc(arena, count * sizeof(i32));
|
||||
b8 result = arr != NULL;
|
||||
|
||||
@@ -46,10 +46,10 @@ TestFuncResult test_arena_alloc_with_buffer(void) {
|
||||
arr[i] = i * 10;
|
||||
}
|
||||
|
||||
return wapp_tester_result(result);
|
||||
return wpTesterResult(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_alloc_succeeds_when_within_capacity(void) {
|
||||
WpTestFuncResult test_arena_alloc_succeeds_when_within_capacity(void) {
|
||||
array = wapp_mem_arena_alloc(arena, count * sizeof(i32));
|
||||
b8 result = array != NULL;
|
||||
|
||||
@@ -57,17 +57,17 @@ TestFuncResult test_arena_alloc_succeeds_when_within_capacity(void) {
|
||||
array[i] = i * 10;
|
||||
}
|
||||
|
||||
return wapp_tester_result(result);
|
||||
return wpTesterResult(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_alloc_fails_when_over_capacity(void) {
|
||||
WpTestFuncResult test_arena_alloc_fails_when_over_capacity(void) {
|
||||
u8 *bytes = wapp_mem_arena_alloc(arena, ARENA_CAPACITY * 2);
|
||||
b8 result = bytes == NULL;
|
||||
|
||||
return wapp_tester_result(result);
|
||||
return wpTesterResult(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_realloc_bigger_size(void) {
|
||||
WpTestFuncResult test_arena_realloc_bigger_size(void) {
|
||||
u64 old_count = 10;
|
||||
u64 new_count = 20;
|
||||
i32 *bytes = wapp_mem_arena_alloc(arena, old_count * sizeof(i32));
|
||||
@@ -78,19 +78,19 @@ TestFuncResult test_arena_realloc_bigger_size(void) {
|
||||
|
||||
i32 *new_bytes = wapp_mem_arena_realloc(arena, bytes, old_count * sizeof(i32), new_count * sizeof(i32));
|
||||
if (!new_bytes) {
|
||||
return wapp_tester_result(false);
|
||||
return wpTesterResult(false);
|
||||
}
|
||||
|
||||
for (u64 i = 0; i < new_count; ++i) {
|
||||
if (i < old_count && new_bytes[i] != bytes[i]) {
|
||||
return wapp_tester_result(false);
|
||||
return wpTesterResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
return wapp_tester_result(true);
|
||||
return wpTesterResult(true);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_realloc_smaller_size(void) {
|
||||
WpTestFuncResult test_arena_realloc_smaller_size(void) {
|
||||
u64 old_count = 10;
|
||||
u64 new_count = 5;
|
||||
i32 *bytes = wapp_mem_arena_alloc(arena, old_count * sizeof(i32));
|
||||
@@ -101,19 +101,19 @@ TestFuncResult test_arena_realloc_smaller_size(void) {
|
||||
|
||||
i32 *new_bytes = wapp_mem_arena_realloc(arena, bytes, old_count * sizeof(i32), new_count * sizeof(i32));
|
||||
if (!new_bytes) {
|
||||
return wapp_tester_result(false);
|
||||
return wpTesterResult(false);
|
||||
}
|
||||
|
||||
for (u64 i = 0; i < new_count; ++i) {
|
||||
if (i < new_count && new_bytes[i] != bytes[i]) {
|
||||
return wapp_tester_result(false);
|
||||
return wpTesterResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
return wapp_tester_result(true);
|
||||
return wpTesterResult(true);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_temp_begin(void) {
|
||||
WpTestFuncResult test_arena_temp_begin(void) {
|
||||
b8 result = wapp_mem_arena_init_buffer(&temp_arena, temp_buf, TEMP_BUF_SIZE);
|
||||
i32 *num1 = (i32 *)wapp_mem_arena_alloc(temp_arena, sizeof(i32));
|
||||
result = result && num1 != NULL;
|
||||
@@ -124,10 +124,10 @@ TestFuncResult test_arena_temp_begin(void) {
|
||||
i32 *num3 = (i32 *)wapp_mem_arena_alloc(temp_arena, sizeof(i32));
|
||||
result = result && num3 == NULL;
|
||||
|
||||
return wapp_tester_result(result);
|
||||
return wpTesterResult(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_temp_end(void) {
|
||||
WpTestFuncResult test_arena_temp_end(void) {
|
||||
wapp_mem_arena_temp_end(temp_arena);
|
||||
i32 *num1 = (i32 *)wapp_mem_arena_alloc(temp_arena, sizeof(i32));
|
||||
b8 result = num1 != NULL;
|
||||
@@ -136,10 +136,10 @@ TestFuncResult test_arena_temp_end(void) {
|
||||
|
||||
wapp_mem_arena_destroy(&temp_arena);
|
||||
|
||||
return wapp_tester_result(result);
|
||||
return wpTesterResult(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_clear(void) {
|
||||
WpTestFuncResult test_arena_clear(void) {
|
||||
wapp_mem_arena_clear(arena);
|
||||
b8 result = true;
|
||||
|
||||
@@ -150,19 +150,19 @@ TestFuncResult test_arena_clear(void) {
|
||||
}
|
||||
}
|
||||
|
||||
return wapp_tester_result(result);
|
||||
return wpTesterResult(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_destroy_buffer(void) {
|
||||
WpTestFuncResult test_arena_destroy_buffer(void) {
|
||||
wapp_mem_arena_destroy(&buf_arena);
|
||||
b8 result = buf_arena == NULL;
|
||||
|
||||
return wapp_tester_result(result);
|
||||
return wpTesterResult(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_destroy_allocated(void) {
|
||||
WpTestFuncResult test_arena_destroy_allocated(void) {
|
||||
wapp_mem_arena_destroy(&arena);
|
||||
b8 result = arena == NULL;
|
||||
|
||||
return wapp_tester_result(result);
|
||||
return wpTesterResult(result);
|
||||
}
|
||||
|
||||
+30
-30
@@ -16,18 +16,18 @@ wp_intern u8 buf[ARENA_BUF_SIZE] = {};
|
||||
wp_intern Arena *temp_arena = NULL;
|
||||
wp_intern u8 temp_buf[TEMP_BUF_SIZE] = {};
|
||||
|
||||
TestFuncResult test_arena_init_buffer(void) {
|
||||
WpTestFuncResult test_arena_init_buffer(void) {
|
||||
b8 result = wapp_mem_arena_init_buffer(&buf_arena, buf, ARENA_BUF_SIZE);
|
||||
return wapp_tester_result(result);
|
||||
return wpTesterResult(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_init_allocated(void) {
|
||||
WpTestFuncResult test_arena_init_allocated(void) {
|
||||
b8 result = wapp_mem_arena_init_allocated(&arena, ARENA_CAPACITY);
|
||||
|
||||
return wapp_tester_result(result);
|
||||
return wpTesterResult(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_init_succeeds_when_reserving_very_large_size(void) {
|
||||
WpTestFuncResult test_arena_init_succeeds_when_reserving_very_large_size(void) {
|
||||
Arena *large_arena = nullptr;
|
||||
u64 capacity = GiB(512);
|
||||
b8 result = wapp_mem_arena_init_allocated(&large_arena, capacity);
|
||||
@@ -35,10 +35,10 @@ TestFuncResult test_arena_init_succeeds_when_reserving_very_large_size(void) {
|
||||
wapp_mem_arena_destroy(&large_arena);
|
||||
}
|
||||
|
||||
return wapp_tester_result(result);
|
||||
return wpTesterResult(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_alloc_with_buffer(void) {
|
||||
WpTestFuncResult test_arena_alloc_with_buffer(void) {
|
||||
i32 *arr = (i32 *)wapp_mem_arena_alloc(arena, count * sizeof(i32));
|
||||
b8 result = arr != NULL;
|
||||
|
||||
@@ -46,10 +46,10 @@ TestFuncResult test_arena_alloc_with_buffer(void) {
|
||||
arr[i] = i * 10;
|
||||
}
|
||||
|
||||
return wapp_tester_result(result);
|
||||
return wpTesterResult(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_alloc_succeeds_when_within_capacity(void) {
|
||||
WpTestFuncResult test_arena_alloc_succeeds_when_within_capacity(void) {
|
||||
array = (i32 *)wapp_mem_arena_alloc(arena, count * sizeof(i32));
|
||||
b8 result = array != nullptr;
|
||||
|
||||
@@ -57,17 +57,17 @@ TestFuncResult test_arena_alloc_succeeds_when_within_capacity(void) {
|
||||
array[i] = i * 10;
|
||||
}
|
||||
|
||||
return wapp_tester_result(result);
|
||||
return wpTesterResult(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_alloc_fails_when_over_capacity(void) {
|
||||
WpTestFuncResult test_arena_alloc_fails_when_over_capacity(void) {
|
||||
u8 *bytes = (u8 *)wapp_mem_arena_alloc(arena, ARENA_CAPACITY * 2);
|
||||
b8 result = bytes == nullptr;
|
||||
|
||||
return wapp_tester_result(result);
|
||||
return wpTesterResult(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_realloc_bigger_size(void) {
|
||||
WpTestFuncResult test_arena_realloc_bigger_size(void) {
|
||||
u64 old_count = 10;
|
||||
u64 new_count = 20;
|
||||
i32 *bytes = (i32 *)wapp_mem_arena_alloc(arena, old_count * sizeof(i32));
|
||||
@@ -78,19 +78,19 @@ TestFuncResult test_arena_realloc_bigger_size(void) {
|
||||
|
||||
i32 *new_bytes = (i32 *)wapp_mem_arena_realloc(arena, bytes, old_count * sizeof(i32), new_count * sizeof(i32));
|
||||
if (!new_bytes) {
|
||||
return wapp_tester_result(false);
|
||||
return wpTesterResult(false);
|
||||
}
|
||||
|
||||
for (u64 i = 0; i < new_count; ++i) {
|
||||
if (i < old_count && new_bytes[i] != bytes[i]) {
|
||||
return wapp_tester_result(false);
|
||||
return wpTesterResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
return wapp_tester_result(true);
|
||||
return wpTesterResult(true);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_realloc_smaller_size(void) {
|
||||
WpTestFuncResult test_arena_realloc_smaller_size(void) {
|
||||
u64 old_count = 10;
|
||||
u64 new_count = 5;
|
||||
i32 *bytes = (i32 *)wapp_mem_arena_alloc(arena, old_count * sizeof(i32));
|
||||
@@ -101,19 +101,19 @@ TestFuncResult test_arena_realloc_smaller_size(void) {
|
||||
|
||||
i32 *new_bytes = (i32 *)wapp_mem_arena_realloc(arena, bytes, old_count * sizeof(i32), new_count * sizeof(i32));
|
||||
if (!new_bytes) {
|
||||
return wapp_tester_result(false);
|
||||
return wpTesterResult(false);
|
||||
}
|
||||
|
||||
for (u64 i = 0; i < new_count; ++i) {
|
||||
if (i < new_count && new_bytes[i] != bytes[i]) {
|
||||
return wapp_tester_result(false);
|
||||
return wpTesterResult(false);
|
||||
}
|
||||
}
|
||||
|
||||
return wapp_tester_result(true);
|
||||
return wpTesterResult(true);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_temp_begin(void) {
|
||||
WpTestFuncResult test_arena_temp_begin(void) {
|
||||
b8 result = wapp_mem_arena_init_buffer(&temp_arena, temp_buf, TEMP_BUF_SIZE);
|
||||
i32 *num1 = (i32 *)wapp_mem_arena_alloc(temp_arena, sizeof(i32));
|
||||
result = result && num1 != NULL;
|
||||
@@ -124,10 +124,10 @@ TestFuncResult test_arena_temp_begin(void) {
|
||||
i32 *num3 = (i32 *)wapp_mem_arena_alloc(temp_arena, sizeof(i32));
|
||||
result = result && num3 == NULL;
|
||||
|
||||
return wapp_tester_result(result);
|
||||
return wpTesterResult(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_temp_end(void) {
|
||||
WpTestFuncResult test_arena_temp_end(void) {
|
||||
wapp_mem_arena_temp_end(temp_arena);
|
||||
i32 *num1 = (i32 *)wapp_mem_arena_alloc(temp_arena, sizeof(i32));
|
||||
b8 result = num1 != NULL;
|
||||
@@ -136,10 +136,10 @@ TestFuncResult test_arena_temp_end(void) {
|
||||
|
||||
wapp_mem_arena_destroy(&temp_arena);
|
||||
|
||||
return wapp_tester_result(result);
|
||||
return wpTesterResult(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_clear(void) {
|
||||
WpTestFuncResult test_arena_clear(void) {
|
||||
wapp_mem_arena_clear(arena);
|
||||
b8 result = true;
|
||||
|
||||
@@ -150,19 +150,19 @@ TestFuncResult test_arena_clear(void) {
|
||||
}
|
||||
}
|
||||
|
||||
return wapp_tester_result(result);
|
||||
return wpTesterResult(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_destroy_buffer(void) {
|
||||
WpTestFuncResult test_arena_destroy_buffer(void) {
|
||||
wapp_mem_arena_destroy(&buf_arena);
|
||||
b8 result = buf_arena == NULL;
|
||||
|
||||
return wapp_tester_result(result);
|
||||
return wpTesterResult(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_arena_destroy_allocated(void) {
|
||||
WpTestFuncResult test_arena_destroy_allocated(void) {
|
||||
wapp_mem_arena_destroy(&arena);
|
||||
b8 result = arena == nullptr;
|
||||
|
||||
return wapp_tester_result(result);
|
||||
return wpTesterResult(result);
|
||||
}
|
||||
|
||||
+13
-13
@@ -3,18 +3,18 @@
|
||||
|
||||
#include "wapp.h"
|
||||
|
||||
TestFuncResult test_arena_init_buffer(void);
|
||||
TestFuncResult test_arena_init_allocated(void);
|
||||
TestFuncResult test_arena_init_succeeds_when_reserving_very_large_size(void);
|
||||
TestFuncResult test_arena_alloc_with_buffer(void);
|
||||
TestFuncResult test_arena_alloc_succeeds_when_within_capacity(void);
|
||||
TestFuncResult test_arena_alloc_fails_when_over_capacity(void);
|
||||
TestFuncResult test_arena_realloc_bigger_size(void);
|
||||
TestFuncResult test_arena_realloc_smaller_size(void);
|
||||
TestFuncResult test_arena_clear(void);
|
||||
TestFuncResult test_arena_temp_begin(void);
|
||||
TestFuncResult test_arena_temp_end(void);
|
||||
TestFuncResult test_arena_destroy_buffer(void);
|
||||
TestFuncResult test_arena_destroy_allocated(void);
|
||||
WpTestFuncResult test_arena_init_buffer(void);
|
||||
WpTestFuncResult test_arena_init_allocated(void);
|
||||
WpTestFuncResult test_arena_init_succeeds_when_reserving_very_large_size(void);
|
||||
WpTestFuncResult test_arena_alloc_with_buffer(void);
|
||||
WpTestFuncResult test_arena_alloc_succeeds_when_within_capacity(void);
|
||||
WpTestFuncResult test_arena_alloc_fails_when_over_capacity(void);
|
||||
WpTestFuncResult test_arena_realloc_bigger_size(void);
|
||||
WpTestFuncResult test_arena_realloc_smaller_size(void);
|
||||
WpTestFuncResult test_arena_clear(void);
|
||||
WpTestFuncResult test_arena_temp_begin(void);
|
||||
WpTestFuncResult test_arena_temp_end(void);
|
||||
WpTestFuncResult test_arena_destroy_buffer(void);
|
||||
WpTestFuncResult test_arena_destroy_allocated(void);
|
||||
|
||||
#endif // !TEST_ARENA_H
|
||||
|
||||
Reference in New Issue
Block a user