From 28f95b1d411d1db40f9e06378048c446f0f4289c Mon Sep 17 00:00:00 2001 From: Abdelrahman Date: Fri, 26 Jun 2026 15:53:08 +0100 Subject: [PATCH] Rename Tester --- src/testing/tester/tester.c | 16 +-- src/testing/tester/tester.h | 14 +- tests/allocator/test_allocator.c | 16 +-- tests/allocator/test_allocator.cc | 16 +-- tests/allocator/test_allocator.h | 8 +- tests/arena/test_arena.c | 60 ++++----- tests/arena/test_arena.cc | 60 ++++----- tests/arena/test_arena.h | 26 ++-- tests/array/test_i32_array.c | 52 ++++---- tests/array/test_i32_array.cc | 52 ++++---- tests/array/test_i32_array.h | 26 ++-- tests/array/test_str8_array.c | 4 +- tests/array/test_str8_array.cc | 4 +- tests/array/test_str8_array.h | 2 +- tests/cpath/test_cpath.c | 16 +-- tests/cpath/test_cpath.cc | 16 +-- tests/cpath/test_cpath.h | 6 +- tests/file/test_file.c | 48 +++---- tests/file/test_file.cc | 48 +++---- tests/file/test_file.h | 24 ++-- tests/queue/test_queue.c | 12 +- tests/queue/test_queue.cc | 12 +- tests/queue/test_queue.h | 6 +- tests/shell_commander/test_shell_commander.c | 16 +-- tests/shell_commander/test_shell_commander.cc | 16 +-- tests/shell_commander/test_shell_commander.h | 8 +- tests/str8/test_str8.c | 118 ++++++++--------- tests/str8/test_str8.cc | 120 +++++++++--------- tests/str8/test_str8.h | 52 ++++---- tests/str8/test_str8_list.c | 32 ++--- tests/str8/test_str8_list.cc | 32 ++--- tests/str8/test_str8_list.h | 16 +-- tests/wapptest.c | 2 +- tests/wapptest.cc | 2 +- 34 files changed, 479 insertions(+), 479 deletions(-) diff --git a/src/testing/tester/tester.c b/src/testing/tester/tester.c index 21db3be..6f9f89d 100644 --- a/src/testing/tester/tester.c +++ b/src/testing/tester/tester.c @@ -8,23 +8,23 @@ #include #include -wp_intern void handle_test_result(TestFuncResult result); +wp_intern void handleTestResult(WpTestFuncResult result); -void run_tests(TestFunc *func1, ...) { +void _runTests(WpTestFunc *func1, ...) { printf("\n"); - handle_test_result(func1()); + handleTestResult(func1()); va_list args; va_start(args, func1); - TestFunc *func = va_arg(args, TestFunc *); + WpTestFunc *func = va_arg(args, WpTestFunc *); while (func) { - TestFuncResult result = func(); - handle_test_result(result); + WpTestFuncResult result = func(); + handleTestResult(result); - func = va_arg(args, TestFunc *); + func = va_arg(args, WpTestFunc *); } va_end(args); @@ -32,7 +32,7 @@ void run_tests(TestFunc *func1, ...) { printf("\n"); } -wp_intern void handle_test_result(TestFuncResult result) { +wp_intern void handleTestResult(WpTestFuncResult result) { TerminalColour colour; Str8 result_text = wapp_str8_buf(64); diff --git a/src/testing/tester/tester.h b/src/testing/tester/tester.h index 6703a45..878eb28 100644 --- a/src/testing/tester/tester.h +++ b/src/testing/tester/tester.h @@ -10,24 +10,24 @@ #ifdef WP_PLATFORM_CPP BEGIN_C_LINKAGE -#define wapp_tester_result(PASSED) (TestFuncResult{wapp_str8_lit_ro(__func__), PASSED, {}}) +#define wpTesterResult(PASSED) (WpTestFuncResult{wapp_str8_lit_ro(__func__), PASSED, {}}) #else -#define wapp_tester_result(PASSED) ((TestFuncResult){.name = wapp_str8_lit_ro(__func__), .passed = PASSED}) +#define wpTesterResult(PASSED) ((WpTestFuncResult){.name = wapp_str8_lit_ro(__func__), .passed = PASSED}) #endif // !WP_PLATFORM_CPP -#define wapp_tester_run_tests(...) run_tests(__VA_ARGS__, NULL) +#define wpTesterRun(...) _runTests(__VA_ARGS__, NULL) -typedef struct TestFuncResult TestFuncResult; -struct TestFuncResult { +typedef struct WpTestFuncResult WpTestFuncResult; +struct WpTestFuncResult { Str8 name; b8 passed; wpMiscUtilsReservePadding(sizeof(Str8) + sizeof(b8)); }; -typedef TestFuncResult(TestFunc)(void); +typedef WpTestFuncResult(WpTestFunc)(void); -void run_tests(TestFunc *func1, ...); +void _runTests(WpTestFunc *func1, ...); #ifdef WP_PLATFORM_CPP END_C_LINKAGE diff --git a/tests/allocator/test_allocator.c b/tests/allocator/test_allocator.c index 1538242..66c931e 100644 --- a/tests/allocator/test_allocator.c +++ b/tests/allocator/test_allocator.c @@ -9,7 +9,7 @@ wp_intern u8 temp_buf[TEMP_BUF_SIZE] = {0}; wp_intern Allocator temp_allocator = {0}; -TestFuncResult test_arena_allocator(void) { +WpTestFuncResult test_arena_allocator(void) { Allocator allocator = wapp_mem_arena_allocator_init(4096); b8 result = allocator.obj != NULL && allocator.alloc != NULL && allocator.alloc_aligned != NULL && @@ -20,10 +20,10 @@ TestFuncResult test_arena_allocator(void) { wapp_mem_arena_allocator_destroy(&allocator); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_arena_allocator_with_buffer(void) { +WpTestFuncResult test_arena_allocator_with_buffer(void) { u8 buffer[KiB(4)] = {0}; Allocator allocator = wapp_mem_arena_allocator_init_with_buffer(buffer, KiB(4)); @@ -36,10 +36,10 @@ TestFuncResult test_arena_allocator_with_buffer(void) { wapp_mem_arena_allocator_destroy(&allocator); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_arena_allocator_temp_begin(void) { +WpTestFuncResult test_arena_allocator_temp_begin(void) { temp_allocator = wapp_mem_arena_allocator_init_with_buffer(temp_buf, TEMP_BUF_SIZE); i32 *num1 = (i32 *)wapp_mem_allocator_alloc(&temp_allocator, sizeof(i32)); @@ -51,10 +51,10 @@ TestFuncResult test_arena_allocator_temp_begin(void) { i32 *num3 = (i32 *)wapp_mem_allocator_alloc(&temp_allocator, sizeof(i32)); result = result && num3 == NULL; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_arena_allocator_temp_end(void) { +WpTestFuncResult test_arena_allocator_temp_end(void) { wapp_mem_arena_allocator_temp_end(&temp_allocator); i32 *num1 = (i32 *)wapp_mem_allocator_alloc(&temp_allocator, sizeof(i32)); b8 result = num1 != NULL; @@ -63,5 +63,5 @@ TestFuncResult test_arena_allocator_temp_end(void) { wapp_mem_arena_allocator_destroy(&temp_allocator); - return wapp_tester_result(result); + return wpTesterResult(result); } diff --git a/tests/allocator/test_allocator.cc b/tests/allocator/test_allocator.cc index adb4825..26c5076 100644 --- a/tests/allocator/test_allocator.cc +++ b/tests/allocator/test_allocator.cc @@ -9,7 +9,7 @@ wp_intern u8 temp_buf[TEMP_BUF_SIZE] = {}; wp_intern Allocator temp_allocator = {}; -TestFuncResult test_arena_allocator(void) { +WpTestFuncResult test_arena_allocator(void) { Allocator allocator = wapp_mem_arena_allocator_init(4096); b8 result = allocator.obj != nullptr && allocator.alloc != nullptr && allocator.alloc_aligned != nullptr && @@ -20,10 +20,10 @@ TestFuncResult test_arena_allocator(void) { wapp_mem_arena_allocator_destroy(&allocator); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_arena_allocator_with_buffer(void) { +WpTestFuncResult test_arena_allocator_with_buffer(void) { u8 buffer[KiB(4)] = {0}; Allocator allocator = wapp_mem_arena_allocator_init_with_buffer(buffer, KiB(4)); @@ -36,10 +36,10 @@ TestFuncResult test_arena_allocator_with_buffer(void) { wapp_mem_arena_allocator_destroy(&allocator); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_arena_allocator_temp_begin(void) { +WpTestFuncResult test_arena_allocator_temp_begin(void) { temp_allocator = wapp_mem_arena_allocator_init_with_buffer(temp_buf, TEMP_BUF_SIZE); i32 *num1 = (i32 *)wapp_mem_allocator_alloc(&temp_allocator, sizeof(i32)); @@ -51,10 +51,10 @@ TestFuncResult test_arena_allocator_temp_begin(void) { i32 *num3 = (i32 *)wapp_mem_allocator_alloc(&temp_allocator, sizeof(i32)); result = result && num3 == NULL; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_arena_allocator_temp_end(void) { +WpTestFuncResult test_arena_allocator_temp_end(void) { wapp_mem_arena_allocator_temp_end(&temp_allocator); i32 *num1 = (i32 *)wapp_mem_allocator_alloc(&temp_allocator, sizeof(i32)); b8 result = num1 != NULL; @@ -63,5 +63,5 @@ TestFuncResult test_arena_allocator_temp_end(void) { wapp_mem_arena_allocator_destroy(&temp_allocator); - return wapp_tester_result(result); + return wpTesterResult(result); } diff --git a/tests/allocator/test_allocator.h b/tests/allocator/test_allocator.h index c223416..0fd518f 100644 --- a/tests/allocator/test_allocator.h +++ b/tests/allocator/test_allocator.h @@ -3,9 +3,9 @@ #include "wapp.h" -TestFuncResult test_arena_allocator(void); -TestFuncResult test_arena_allocator_with_buffer(void); -TestFuncResult test_arena_allocator_temp_begin(void); -TestFuncResult test_arena_allocator_temp_end(void); +WpTestFuncResult test_arena_allocator(void); +WpTestFuncResult test_arena_allocator_with_buffer(void); +WpTestFuncResult test_arena_allocator_temp_begin(void); +WpTestFuncResult test_arena_allocator_temp_end(void); #endif // !TEST_ALLOCATOR_H diff --git a/tests/arena/test_arena.c b/tests/arena/test_arena.c index 718534e..f4cf914 100644 --- a/tests/arena/test_arena.c +++ b/tests/arena/test_arena.c @@ -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); } diff --git a/tests/arena/test_arena.cc b/tests/arena/test_arena.cc index 8617007..d2def48 100644 --- a/tests/arena/test_arena.cc +++ b/tests/arena/test_arena.cc @@ -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); } diff --git a/tests/arena/test_arena.h b/tests/arena/test_arena.h index 06ea137..4b7ee87 100644 --- a/tests/arena/test_arena.h +++ b/tests/arena/test_arena.h @@ -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 diff --git a/tests/array/test_i32_array.c b/tests/array/test_i32_array.c index 8086f70..28a8780 100644 --- a/tests/array/test_i32_array.c +++ b/tests/array/test_i32_array.c @@ -1,7 +1,7 @@ #include "test_i32_array.h" #include "wapp.h" -TestFuncResult test_i32_array(void) { +WpTestFuncResult test_i32_array(void) { b8 result; I32Array array = wapp_array(i32, 1, 2, 3, 4, 5, 6, 7); @@ -19,10 +19,10 @@ TestFuncResult test_i32_array(void) { running = index < count; } - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_with_capacity(void) { +WpTestFuncResult test_i32_array_with_capacity(void) { b8 result; I32Array array1 = wapp_array_with_capacity(i32, 64, ARRAY_INIT_NONE); @@ -31,10 +31,10 @@ TestFuncResult test_i32_array_with_capacity(void) { I32Array array2 = wapp_array_with_capacity(i32, 64, ARRAY_INIT_FILLED); result = wapp_array_count(array2) == 64 && wapp_array_capacity(array2) == 64; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_get(void) { +WpTestFuncResult test_i32_array_get(void) { b8 result = true; I32Array array = wapp_array(i32, 0, 1, 2, 3, 4, 5, 6, 7, 8); @@ -51,10 +51,10 @@ TestFuncResult test_i32_array_get(void) { running = index < count; } - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_set(void) { +WpTestFuncResult test_i32_array_set(void) { b8 result = true; I32Array array = wapp_array(i32, 0, 1, 2, 3, 4, 5, 6, 7, 8); @@ -73,10 +73,10 @@ TestFuncResult test_i32_array_set(void) { running = index < count; } - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_append_capped(void) { +WpTestFuncResult test_i32_array_append_capped(void) { b8 result; I32Array array = wapp_array_with_capacity(i32, 64, ARRAY_INIT_NONE); @@ -91,10 +91,10 @@ TestFuncResult test_i32_array_append_capped(void) { result = result && wapp_array_count(array) == 2; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_extend_capped(void) { +WpTestFuncResult test_i32_array_extend_capped(void) { b8 result; I32Array array1 = wapp_array(i32, 1, 2, 3, 4); @@ -106,10 +106,10 @@ TestFuncResult test_i32_array_extend_capped(void) { result = result && wapp_array_count(array1) == 6; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_copy_capped(void) { +WpTestFuncResult test_i32_array_copy_capped(void) { b8 result; I32Array src = wapp_array(i32, 1, 2, 3, 4, 5); @@ -142,10 +142,10 @@ TestFuncResult test_i32_array_copy_capped(void) { running = index < expected_count; } - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_alloc_capacity(void) { +WpTestFuncResult test_i32_array_alloc_capacity(void) { b8 result; Allocator allocator = wapp_mem_arena_allocator_init(MiB(4)); @@ -156,10 +156,10 @@ TestFuncResult test_i32_array_alloc_capacity(void) { wapp_mem_arena_allocator_destroy(&allocator); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_append_alloc(void) { +WpTestFuncResult test_i32_array_append_alloc(void) { b8 result; Allocator allocator = wapp_mem_arena_allocator_init(MiB(4)); @@ -183,10 +183,10 @@ TestFuncResult test_i32_array_append_alloc(void) { wapp_mem_arena_allocator_destroy(&allocator); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_extend_alloc(void) { +WpTestFuncResult test_i32_array_extend_alloc(void) { b8 result; Allocator allocator = wapp_mem_arena_allocator_init(MiB(4)); @@ -202,10 +202,10 @@ TestFuncResult test_i32_array_extend_alloc(void) { wapp_mem_arena_allocator_destroy(&allocator); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_copy_alloc(void) { +WpTestFuncResult test_i32_array_copy_alloc(void) { b8 result; Allocator allocator = wapp_mem_arena_allocator_init(MiB(4)); @@ -242,10 +242,10 @@ TestFuncResult test_i32_array_copy_alloc(void) { wapp_mem_arena_allocator_destroy(&allocator); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_pop(void) { +WpTestFuncResult test_i32_array_pop(void) { b8 result; I32Array array1 = wapp_array(i32, 0, 1, 2, 3, 4, 5, 6, 7, 8); @@ -256,10 +256,10 @@ TestFuncResult test_i32_array_pop(void) { result = item1 == 8 && item2 == 0; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_clear(void) { +WpTestFuncResult test_i32_array_clear(void) { b8 result; I32Array array = wapp_array(i32, 0, 1, 2, 3, 4, 5, 6, 7, 8); @@ -269,5 +269,5 @@ TestFuncResult test_i32_array_clear(void) { result = result && wapp_array_count(array) == 0; - return wapp_tester_result(result); + return wpTesterResult(result); } diff --git a/tests/array/test_i32_array.cc b/tests/array/test_i32_array.cc index 38d6ee1..e90e87d 100644 --- a/tests/array/test_i32_array.cc +++ b/tests/array/test_i32_array.cc @@ -1,7 +1,7 @@ #include "test_i32_array.h" #include "wapp.h" -TestFuncResult test_i32_array(void) { +WpTestFuncResult test_i32_array(void) { b8 result; I32Array array = wapp_array(i32, 1, 2, 3, 4, 5, 6, 7); @@ -19,10 +19,10 @@ TestFuncResult test_i32_array(void) { running = index < count; } - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_with_capacity(void) { +WpTestFuncResult test_i32_array_with_capacity(void) { b8 result; I32Array array1 = wapp_array_with_capacity(i32, 64, ARRAY_INIT_NONE); @@ -31,10 +31,10 @@ TestFuncResult test_i32_array_with_capacity(void) { I32Array array2 = wapp_array_with_capacity(i32, 64, ARRAY_INIT_FILLED); result = wapp_array_count(array2) == 64 && wapp_array_capacity(array2) == 64; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_get(void) { +WpTestFuncResult test_i32_array_get(void) { b8 result = true; I32Array array = wapp_array(i32, 0, 1, 2, 3, 4, 5, 6, 7, 8); @@ -51,10 +51,10 @@ TestFuncResult test_i32_array_get(void) { running = index < count; } - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_set(void) { +WpTestFuncResult test_i32_array_set(void) { b8 result = true; I32Array array = wapp_array(i32, 0, 1, 2, 3, 4, 5, 6, 7, 8); @@ -73,10 +73,10 @@ TestFuncResult test_i32_array_set(void) { running = index < count; } - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_append_capped(void) { +WpTestFuncResult test_i32_array_append_capped(void) { b8 result; I32Array array = wapp_array_with_capacity(i32, 64, ARRAY_INIT_NONE); @@ -93,10 +93,10 @@ TestFuncResult test_i32_array_append_capped(void) { result = result && wapp_array_count(array) == 2; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_extend_capped(void) { +WpTestFuncResult test_i32_array_extend_capped(void) { b8 result; I32Array array1 = wapp_array(i32, 1, 2, 3, 4); @@ -108,10 +108,10 @@ TestFuncResult test_i32_array_extend_capped(void) { result = result && wapp_array_count(array1) == 6; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_copy_capped(void) { +WpTestFuncResult test_i32_array_copy_capped(void) { b8 result; I32Array src = wapp_array(i32, 1, 2, 3, 4, 5); @@ -144,10 +144,10 @@ TestFuncResult test_i32_array_copy_capped(void) { running = index < expected_count; } - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_alloc_capacity(void) { +WpTestFuncResult test_i32_array_alloc_capacity(void) { b8 result; Allocator allocator = wapp_mem_arena_allocator_init(MiB(4)); @@ -158,10 +158,10 @@ TestFuncResult test_i32_array_alloc_capacity(void) { wapp_mem_arena_allocator_destroy(&allocator); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_append_alloc(void) { +WpTestFuncResult test_i32_array_append_alloc(void) { b8 result; Allocator allocator = wapp_mem_arena_allocator_init(MiB(4)); @@ -186,10 +186,10 @@ TestFuncResult test_i32_array_append_alloc(void) { wapp_mem_arena_allocator_destroy(&allocator); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_extend_alloc(void) { +WpTestFuncResult test_i32_array_extend_alloc(void) { b8 result; Allocator allocator = wapp_mem_arena_allocator_init(MiB(4)); @@ -205,10 +205,10 @@ TestFuncResult test_i32_array_extend_alloc(void) { wapp_mem_arena_allocator_destroy(&allocator); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_copy_alloc(void) { +WpTestFuncResult test_i32_array_copy_alloc(void) { b8 result; Allocator allocator = wapp_mem_arena_allocator_init(MiB(4)); @@ -245,10 +245,10 @@ TestFuncResult test_i32_array_copy_alloc(void) { wapp_mem_arena_allocator_destroy(&allocator); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_clear(void) { +WpTestFuncResult test_i32_array_clear(void) { b8 result; I32Array array = wapp_array(i32, 0, 1, 2, 3, 4, 5, 6, 7, 8); @@ -258,10 +258,10 @@ TestFuncResult test_i32_array_clear(void) { result = result && wapp_array_count(array) == 0; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_i32_array_pop(void) { +WpTestFuncResult test_i32_array_pop(void) { b8 result; I32Array array1 = wapp_array(i32, 0, 1, 2, 3, 4, 5, 6, 7, 8); @@ -272,5 +272,5 @@ TestFuncResult test_i32_array_pop(void) { result = item1 == 8 && item2 == 0; - return wapp_tester_result(result); + return wpTesterResult(result); } diff --git a/tests/array/test_i32_array.h b/tests/array/test_i32_array.h index aa7b9f8..05a932a 100644 --- a/tests/array/test_i32_array.h +++ b/tests/array/test_i32_array.h @@ -3,18 +3,18 @@ #include "wapp.h" -TestFuncResult test_i32_array(void); -TestFuncResult test_i32_array_with_capacity(void); -TestFuncResult test_i32_array_get(void); -TestFuncResult test_i32_array_set(void); -TestFuncResult test_i32_array_append_capped(void); -TestFuncResult test_i32_array_extend_capped(void); -TestFuncResult test_i32_array_copy_capped(void); -TestFuncResult test_i32_array_alloc_capacity(void); -TestFuncResult test_i32_array_append_alloc(void); -TestFuncResult test_i32_array_extend_alloc(void); -TestFuncResult test_i32_array_copy_alloc(void); -TestFuncResult test_i32_array_pop(void); -TestFuncResult test_i32_array_clear(void); +WpTestFuncResult test_i32_array(void); +WpTestFuncResult test_i32_array_with_capacity(void); +WpTestFuncResult test_i32_array_get(void); +WpTestFuncResult test_i32_array_set(void); +WpTestFuncResult test_i32_array_append_capped(void); +WpTestFuncResult test_i32_array_extend_capped(void); +WpTestFuncResult test_i32_array_copy_capped(void); +WpTestFuncResult test_i32_array_alloc_capacity(void); +WpTestFuncResult test_i32_array_append_alloc(void); +WpTestFuncResult test_i32_array_extend_alloc(void); +WpTestFuncResult test_i32_array_copy_alloc(void); +WpTestFuncResult test_i32_array_pop(void); +WpTestFuncResult test_i32_array_clear(void); #endif // !TEST_INT_ARRAY_H diff --git a/tests/array/test_str8_array.c b/tests/array/test_str8_array.c index 392e622..c486a1d 100644 --- a/tests/array/test_str8_array.c +++ b/tests/array/test_str8_array.c @@ -2,7 +2,7 @@ #include "test_str8_array.h" -TestFuncResult test_str8_array(void) { +WpTestFuncResult test_str8_array(void) { b8 result; Str8 expected[] = {wapp_str8_lit("Hello"), wapp_str8_lit("Hi"), wapp_str8_lit("Bye")}; @@ -21,5 +21,5 @@ TestFuncResult test_str8_array(void) { running = index < count; } - return wapp_tester_result(result); + return wpTesterResult(result); } diff --git a/tests/array/test_str8_array.cc b/tests/array/test_str8_array.cc index 4338854..6e715f2 100644 --- a/tests/array/test_str8_array.cc +++ b/tests/array/test_str8_array.cc @@ -2,7 +2,7 @@ #include "test_str8_array.h" -TestFuncResult test_str8_array(void) { +WpTestFuncResult test_str8_array(void) { b8 result; Str8 expected[] = {wapp_str8_lit("Hello"), wapp_str8_lit("Hi"), wapp_str8_lit("Bye")}; @@ -26,5 +26,5 @@ TestFuncResult test_str8_array(void) { running = index < count; } - return wapp_tester_result(result); + return wpTesterResult(result); } diff --git a/tests/array/test_str8_array.h b/tests/array/test_str8_array.h index 945e5f3..7b71b56 100644 --- a/tests/array/test_str8_array.h +++ b/tests/array/test_str8_array.h @@ -5,6 +5,6 @@ #include "wapp.h" -TestFuncResult test_str8_array(void); +WpTestFuncResult test_str8_array(void); #endif // !TEST_STR8_ARRAY_H diff --git a/tests/cpath/test_cpath.c b/tests/cpath/test_cpath.c index a24253e..456251d 100644 --- a/tests/cpath/test_cpath.c +++ b/tests/cpath/test_cpath.c @@ -6,7 +6,7 @@ #define MAIN_BUF_SIZE 4096 #define TMP_BUF_SIZE 1024 -TestFuncResult test_cpath_join_path(void) { +WpTestFuncResult test_cpath_join_path(void) { b8 result; Str8 expected = wapp_str8_buf(MAIN_BUF_SIZE); @@ -77,13 +77,13 @@ TestFuncResult test_cpath_join_path(void) { wapp_cpath_join_path(&out, &parts); result = result && wapp_str8_equal(&out, &expected); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_cpath_dirname(void) { +WpTestFuncResult test_cpath_dirname(void) { Allocator arena = wapp_mem_arena_allocator_init(MiB(8)); if (wapp_mem_allocator_invalid(&arena)) { - return wapp_tester_result(false); + return wpTesterResult(false); } b8 result; @@ -125,13 +125,13 @@ TestFuncResult test_cpath_dirname(void) { wapp_mem_arena_allocator_destroy(&arena); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_cpath_dirup(void) { +WpTestFuncResult test_cpath_dirup(void) { Allocator arena = wapp_mem_arena_allocator_init(MiB(8)); if (wapp_mem_allocator_invalid(&arena)) { - return wapp_tester_result(false); + return wpTesterResult(false); } b8 result; @@ -177,5 +177,5 @@ TestFuncResult test_cpath_dirup(void) { wapp_mem_arena_allocator_destroy(&arena); - return wapp_tester_result(result); + return wpTesterResult(result); } diff --git a/tests/cpath/test_cpath.cc b/tests/cpath/test_cpath.cc index c012e29..abacfa9 100644 --- a/tests/cpath/test_cpath.cc +++ b/tests/cpath/test_cpath.cc @@ -6,7 +6,7 @@ #define MAIN_BUF_SIZE 4096 #define TMP_BUF_SIZE 1024 -TestFuncResult test_cpath_join_path(void) { +WpTestFuncResult test_cpath_join_path(void) { b8 result; Str8 expected = wapp_str8_buf(MAIN_BUF_SIZE); @@ -95,13 +95,13 @@ TestFuncResult test_cpath_join_path(void) { wapp_cpath_join_path(&out, &parts); result = result && wapp_str8_equal(&out, &expected); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_cpath_dirname(void) { +WpTestFuncResult test_cpath_dirname(void) { Allocator arena = wapp_mem_arena_allocator_init(MiB(8)); if (wapp_mem_allocator_invalid(&arena)) { - return wapp_tester_result(false); + return wpTesterResult(false); } b8 result; @@ -145,13 +145,13 @@ TestFuncResult test_cpath_dirname(void) { wapp_mem_arena_allocator_destroy(&arena); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_cpath_dirup(void) { +WpTestFuncResult test_cpath_dirup(void) { Allocator arena = wapp_mem_arena_allocator_init(MiB(8)); if (wapp_mem_allocator_invalid(&arena)) { - return wapp_tester_result(false); + return wpTesterResult(false); } b8 result; @@ -197,5 +197,5 @@ TestFuncResult test_cpath_dirup(void) { wapp_mem_arena_allocator_destroy(&arena); - return wapp_tester_result(result); + return wpTesterResult(result); } diff --git a/tests/cpath/test_cpath.h b/tests/cpath/test_cpath.h index 6613009..33efae0 100644 --- a/tests/cpath/test_cpath.h +++ b/tests/cpath/test_cpath.h @@ -3,8 +3,8 @@ #include "wapp.h" -TestFuncResult test_cpath_join_path(void); -TestFuncResult test_cpath_dirname(void); -TestFuncResult test_cpath_dirup(void); +WpTestFuncResult test_cpath_join_path(void); +WpTestFuncResult test_cpath_dirname(void); +WpTestFuncResult test_cpath_dirup(void); #endif // !TEST_CPATH_H diff --git a/tests/file/test_file.c b/tests/file/test_file.c index 2b81403..bec5ab6 100644 --- a/tests/file/test_file.c +++ b/tests/file/test_file.c @@ -13,18 +13,18 @@ wp_intern I32Array src_array3 = wapp_array(i32, 10, 11, 12, 13, 14); wp_intern I32Array dst_array = wapp_array_with_capacity(i32, DST_CAPACITY, false); wp_intern i32 dst_buf[DST_CAPACITY] = {0}; -TestFuncResult test_wapp_file_open(void) { +WpTestFuncResult test_wapp_file_open(void) { arena = wapp_mem_arena_allocator_init(KiB(16)); test_fp = wapp_file_open(&arena, &test_filename, WAPP_ACCESS_WRITE_EX); - return wapp_tester_result(test_fp != NULL); + return wpTesterResult(test_fp != NULL); } -TestFuncResult test_wapp_file_get_current_position(void) { +WpTestFuncResult test_wapp_file_get_current_position(void) { i64 pos = wapp_file_get_current_position(test_fp); - return wapp_tester_result(pos == 0); + return wpTesterResult(pos == 0); } -TestFuncResult test_wapp_file_seek(void) { +WpTestFuncResult test_wapp_file_seek(void) { wapp_file_write_array((GenericArray)src_array1, test_fp, wapp_array_count(src_array1)); i64 seek_result = wapp_file_seek(test_fp, 0, WAPP_SEEK_END); @@ -32,15 +32,15 @@ TestFuncResult test_wapp_file_seek(void) { wapp_file_seek(test_fp, 0, WAPP_SEEK_START); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_wapp_file_get_length(void) { +WpTestFuncResult test_wapp_file_get_length(void) { i64 length = wapp_file_get_length(test_fp); - return wapp_tester_result(length == (i64)(wapp_array_count(src_array1) * wapp_array_item_size(src_array1))); + return wpTesterResult(length == (i64)(wapp_array_count(src_array1) * wapp_array_item_size(src_array1))); } -TestFuncResult test_wapp_file_read(void) { +WpTestFuncResult test_wapp_file_read(void) { wapp_file_seek(test_fp, 0, WAPP_SEEK_START); u64 byte_count = DST_CAPACITY * sizeof(i32); @@ -57,19 +57,19 @@ TestFuncResult test_wapp_file_read(void) { running = index < DST_CAPACITY; } - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_wapp_file_write(void) { +WpTestFuncResult test_wapp_file_write(void) { wapp_file_seek(test_fp, 0, WAPP_SEEK_END); u64 expected_count = wapp_array_count(src_array2) * wapp_array_item_size(src_array2); i64 count = wapp_file_write((void *)src_array2, test_fp, expected_count); - return wapp_tester_result(count >= 0 && (u64)count == expected_count); + return wpTesterResult(count >= 0 && (u64)count == expected_count); } -TestFuncResult test_wapp_file_read_array(void) { +WpTestFuncResult test_wapp_file_read_array(void) { wapp_file_seek(test_fp, 0, WAPP_SEEK_START); u64 count = wapp_file_read_array((GenericArray)dst_array, test_fp, wapp_array_count(src_array1)); @@ -86,33 +86,33 @@ TestFuncResult test_wapp_file_read_array(void) { running = index < wapp_array_count(dst_array); } - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_wapp_file_write_array(void) { +WpTestFuncResult test_wapp_file_write_array(void) { wapp_file_seek(test_fp, 0, WAPP_SEEK_END); i64 count = wapp_file_write_array((GenericArray)src_array3, test_fp, wapp_array_count(src_array3)); - return wapp_tester_result(count >= 0 && (u64)count == wapp_array_count(src_array3)); + return wpTesterResult(count >= 0 && (u64)count == wapp_array_count(src_array3)); } -TestFuncResult test_wapp_file_flush(void) { +WpTestFuncResult test_wapp_file_flush(void) { i32 flush_result = wapp_file_flush(test_fp); - return wapp_tester_result(flush_result == 0); + return wpTesterResult(flush_result == 0); } -TestFuncResult test_wapp_file_close(void) { +WpTestFuncResult test_wapp_file_close(void) { i32 close_result = wapp_file_close(test_fp); - return wapp_tester_result(close_result == 0); + return wpTesterResult(close_result == 0); } -TestFuncResult test_wapp_file_rename(void) { +WpTestFuncResult test_wapp_file_rename(void) { i32 rename_result = wapp_file_rename(&test_filename, &new_filename); - return wapp_tester_result(rename_result == 0); + return wpTesterResult(rename_result == 0); } -TestFuncResult test_wapp_file_remove(void) { +WpTestFuncResult test_wapp_file_remove(void) { i32 remove_result = wapp_file_remove(&new_filename); - return wapp_tester_result(remove_result == 0); + return wpTesterResult(remove_result == 0); } diff --git a/tests/file/test_file.cc b/tests/file/test_file.cc index 790b36e..3596f5a 100644 --- a/tests/file/test_file.cc +++ b/tests/file/test_file.cc @@ -13,22 +13,22 @@ wp_intern I32Array src_array2; wp_intern I32Array src_array3; wp_intern I32Array dst_array ; -TestFuncResult test_wapp_file_open(void) { +WpTestFuncResult test_wapp_file_open(void) { arena = wapp_mem_arena_allocator_init(KiB(16)); src_array1 = wapp_array(i32, 0, 1, 2, 3, 4); src_array2 = wapp_array(i32, 5, 6, 7, 8, 9); src_array3 = wapp_array(i32, 10, 11, 12, 13, 14); dst_array = wapp_array_with_capacity(i32, DST_CAPACITY, false); test_fp = wapp_file_open(&arena, &test_filename, WAPP_ACCESS_WRITE_EX); - return wapp_tester_result(test_fp != NULL); + return wpTesterResult(test_fp != NULL); } -TestFuncResult test_wapp_file_get_current_position(void) { +WpTestFuncResult test_wapp_file_get_current_position(void) { i64 pos = wapp_file_get_current_position(test_fp); - return wapp_tester_result(pos == 0); + return wpTesterResult(pos == 0); } -TestFuncResult test_wapp_file_seek(void) { +WpTestFuncResult test_wapp_file_seek(void) { wapp_file_write_array((GenericArray)src_array1, test_fp, wapp_array_count(src_array1)); i64 seek_result = wapp_file_seek(test_fp, 0, WAPP_SEEK_END); @@ -36,15 +36,15 @@ TestFuncResult test_wapp_file_seek(void) { wapp_file_seek(test_fp, 0, WAPP_SEEK_START); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_wapp_file_get_length(void) { +WpTestFuncResult test_wapp_file_get_length(void) { i64 length = wapp_file_get_length(test_fp); - return wapp_tester_result(length == (i64)(wapp_array_count(src_array1) * wapp_array_item_size(src_array1))); + return wpTesterResult(length == (i64)(wapp_array_count(src_array1) * wapp_array_item_size(src_array1))); } -TestFuncResult test_wapp_file_read(void) { +WpTestFuncResult test_wapp_file_read(void) { wapp_file_seek(test_fp, 0, WAPP_SEEK_START); u64 byte_count = DST_CAPACITY * sizeof(i32); @@ -61,19 +61,19 @@ TestFuncResult test_wapp_file_read(void) { running = index < DST_CAPACITY; } - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_wapp_file_write(void) { +WpTestFuncResult test_wapp_file_write(void) { wapp_file_seek(test_fp, 0, WAPP_SEEK_END); u64 expected_count = wapp_array_count(src_array2) * wapp_array_item_size(src_array2); i64 count = wapp_file_write((void *)src_array2, test_fp, expected_count); - return wapp_tester_result(count >= 0 && (u64)count == expected_count); + return wpTesterResult(count >= 0 && (u64)count == expected_count); } -TestFuncResult test_wapp_file_read_array(void) { +WpTestFuncResult test_wapp_file_read_array(void) { wapp_file_seek(test_fp, 0, WAPP_SEEK_START); u64 count = wapp_file_read_array((GenericArray)dst_array, test_fp, wapp_array_count(src_array1)); @@ -90,33 +90,33 @@ TestFuncResult test_wapp_file_read_array(void) { running = index < wapp_array_count(dst_array); } - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_wapp_file_write_array(void) { +WpTestFuncResult test_wapp_file_write_array(void) { wapp_file_seek(test_fp, 0, WAPP_SEEK_END); i64 count = wapp_file_write_array((GenericArray)src_array3, test_fp, wapp_array_count(src_array3)); - return wapp_tester_result(count >= 0 && (u64)count == wapp_array_count(src_array3)); + return wpTesterResult(count >= 0 && (u64)count == wapp_array_count(src_array3)); } -TestFuncResult test_wapp_file_flush(void) { +WpTestFuncResult test_wapp_file_flush(void) { i32 flush_result = wapp_file_flush(test_fp); - return wapp_tester_result(flush_result == 0); + return wpTesterResult(flush_result == 0); } -TestFuncResult test_wapp_file_close(void) { +WpTestFuncResult test_wapp_file_close(void) { i32 close_result = wapp_file_close(test_fp); - return wapp_tester_result(close_result == 0); + return wpTesterResult(close_result == 0); } -TestFuncResult test_wapp_file_rename(void) { +WpTestFuncResult test_wapp_file_rename(void) { i32 rename_result = wapp_file_rename(&test_filename, &new_filename); - return wapp_tester_result(rename_result == 0); + return wpTesterResult(rename_result == 0); } -TestFuncResult test_wapp_file_remove(void) { +WpTestFuncResult test_wapp_file_remove(void) { i32 remove_result = wapp_file_remove(&new_filename); - return wapp_tester_result(remove_result == 0); + return wpTesterResult(remove_result == 0); } diff --git a/tests/file/test_file.h b/tests/file/test_file.h index 6797afe..163baca 100644 --- a/tests/file/test_file.h +++ b/tests/file/test_file.h @@ -5,17 +5,17 @@ #include "wapp.h" -TestFuncResult test_wapp_file_open(void); -TestFuncResult test_wapp_file_get_current_position(void); -TestFuncResult test_wapp_file_seek(void); -TestFuncResult test_wapp_file_get_length(void); -TestFuncResult test_wapp_file_read(void); -TestFuncResult test_wapp_file_write(void); -TestFuncResult test_wapp_file_read_array(void); -TestFuncResult test_wapp_file_write_array(void); -TestFuncResult test_wapp_file_flush(void); -TestFuncResult test_wapp_file_close(void); -TestFuncResult test_wapp_file_rename(void); -TestFuncResult test_wapp_file_remove(void); +WpTestFuncResult test_wapp_file_open(void); +WpTestFuncResult test_wapp_file_get_current_position(void); +WpTestFuncResult test_wapp_file_seek(void); +WpTestFuncResult test_wapp_file_get_length(void); +WpTestFuncResult test_wapp_file_read(void); +WpTestFuncResult test_wapp_file_write(void); +WpTestFuncResult test_wapp_file_read_array(void); +WpTestFuncResult test_wapp_file_write_array(void); +WpTestFuncResult test_wapp_file_flush(void); +WpTestFuncResult test_wapp_file_close(void); +WpTestFuncResult test_wapp_file_rename(void); +WpTestFuncResult test_wapp_file_remove(void); #endif // !TEST_FILE_H diff --git a/tests/queue/test_queue.c b/tests/queue/test_queue.c index 1370f2d..bd13729 100644 --- a/tests/queue/test_queue.c +++ b/tests/queue/test_queue.c @@ -5,7 +5,7 @@ #define CAPACITY 8 -TestFuncResult test_queue_push(void) { +WpTestFuncResult test_queue_push(void) { I32Queue queue = wapp_queue(i32, CAPACITY); for (u64 i = 0; i < CAPACITY; ++i) { @@ -19,10 +19,10 @@ TestFuncResult test_queue_push(void) { result = result && value != NULL && *value == (i32)i; } - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_queue_push_alloc(void) { +WpTestFuncResult test_queue_push_alloc(void) { Allocator arena = wapp_mem_arena_allocator_init(MiB(64)); I32Queue queue = wapp_queue(i32, CAPACITY); @@ -67,10 +67,10 @@ TestFuncResult test_queue_push_alloc(void) { wapp_mem_arena_allocator_destroy(&arena); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_queue_pop(void) { +WpTestFuncResult test_queue_pop(void) { I32Queue queue = wapp_queue(i32, CAPACITY); for (u64 i = 0; i < CAPACITY; ++i) { i32 item = (i32)i; @@ -94,5 +94,5 @@ TestFuncResult test_queue_pop(void) { result = result && value != NULL && *value == (i32)half_count + (i32)i; } - return wapp_tester_result(result); + return wpTesterResult(result); } diff --git a/tests/queue/test_queue.cc b/tests/queue/test_queue.cc index b6a2092..9e0e2f9 100644 --- a/tests/queue/test_queue.cc +++ b/tests/queue/test_queue.cc @@ -3,7 +3,7 @@ #define CAPACITY 8 -TestFuncResult test_queue_push(void) { +WpTestFuncResult test_queue_push(void) { I32Queue queue = wapp_queue(i32, CAPACITY); for (u64 i = 0; i < CAPACITY; ++i) { @@ -17,10 +17,10 @@ TestFuncResult test_queue_push(void) { result = result && value != NULL && *value == (i32)i; } - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_queue_push_alloc(void) { +WpTestFuncResult test_queue_push_alloc(void) { Allocator arena = wapp_mem_arena_allocator_init(MiB(64)); I32Queue queue = wapp_queue(i32, CAPACITY); @@ -65,10 +65,10 @@ TestFuncResult test_queue_push_alloc(void) { wapp_mem_arena_allocator_destroy(&arena); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_queue_pop(void) { +WpTestFuncResult test_queue_pop(void) { I32Queue queue = wapp_queue(i32, CAPACITY); for (u64 i = 0; i < CAPACITY; ++i) { i32 item = (i32)i; @@ -92,5 +92,5 @@ TestFuncResult test_queue_pop(void) { result = result && value != NULL && *value == (i32)half_count + (i32)i; } - return wapp_tester_result(result); + return wpTesterResult(result); } diff --git a/tests/queue/test_queue.h b/tests/queue/test_queue.h index 32382e2..c8a1fe9 100644 --- a/tests/queue/test_queue.h +++ b/tests/queue/test_queue.h @@ -5,8 +5,8 @@ #include "wapp.h" -TestFuncResult test_queue_push(void); -TestFuncResult test_queue_push_alloc(void); -TestFuncResult test_queue_pop(void); +WpTestFuncResult test_queue_push(void); +WpTestFuncResult test_queue_push_alloc(void); +WpTestFuncResult test_queue_pop(void); #endif // !TEST_QUEUE_H diff --git a/tests/shell_commander/test_shell_commander.c b/tests/shell_commander/test_shell_commander.c index c0126be..4571ef5 100644 --- a/tests/shell_commander/test_shell_commander.c +++ b/tests/shell_commander/test_shell_commander.c @@ -4,7 +4,7 @@ #include #include -TestFuncResult test_commander_cmd_success(void) { +WpTestFuncResult test_commander_cmd_success(void) { Str8List cmd = wapp_dbl_list(Str8); wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_lit("echo")); wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_lit("hello world")); @@ -13,10 +13,10 @@ TestFuncResult test_commander_cmd_success(void) { b8 succeeded = result.exited && result.exit_code == EXIT_SUCCESS && result.error == SHELL_ERR_NO_ERROR; - return wapp_tester_result(succeeded); + return wpTesterResult(succeeded); } -TestFuncResult test_commander_cmd_failure(void) { +WpTestFuncResult test_commander_cmd_failure(void) { Str8List cmd = wapp_dbl_list(Str8); wapp_dbl_list_push_back(Str8, &cmd, &wapp_str8_lit("grep")); @@ -24,10 +24,10 @@ TestFuncResult test_commander_cmd_failure(void) { b8 failed = result.exited && result.exit_code != EXIT_SUCCESS && result.error == SHELL_ERR_NO_ERROR; - return wapp_tester_result(failed); + return wpTesterResult(failed); } -TestFuncResult test_commander_cmd_out_buf_success(void) { +WpTestFuncResult test_commander_cmd_out_buf_success(void) { Str8 buf = wapp_str8_buf(64); Str8 expected = wapp_str8_buf(64); char msg[] = "hello world"; @@ -41,10 +41,10 @@ TestFuncResult test_commander_cmd_out_buf_success(void) { b8 succeeded = result.exited && result.exit_code == EXIT_SUCCESS && result.error == SHELL_ERR_NO_ERROR && wapp_str8_equal_to_count(&buf, &expected, strlen(msg)); - return wapp_tester_result(succeeded); + return wpTesterResult(succeeded); } -TestFuncResult test_commander_cmd_out_buf_failure(void) { +WpTestFuncResult test_commander_cmd_out_buf_failure(void) { Str8 buf = wapp_str8_buf(4); Str8 expected = wapp_str8_buf(64); char msg[] = "hello world"; @@ -58,5 +58,5 @@ TestFuncResult test_commander_cmd_out_buf_failure(void) { b8 failed = !result.exited && result.exit_code != EXIT_SUCCESS && result.error == SHELL_ERR_OUT_BUF_FULL && !wapp_str8_equal(&buf, &expected); - return wapp_tester_result(failed); + return wpTesterResult(failed); } diff --git a/tests/shell_commander/test_shell_commander.cc b/tests/shell_commander/test_shell_commander.cc index b48217c..65b92fd 100644 --- a/tests/shell_commander/test_shell_commander.cc +++ b/tests/shell_commander/test_shell_commander.cc @@ -4,7 +4,7 @@ #include #include -TestFuncResult test_commander_cmd_success(void) { +WpTestFuncResult test_commander_cmd_success(void) { Str8List cmd = wapp_dbl_list(Str8); Str8 echo = wapp_str8_lit("echo"); Str8 msg = wapp_str8_lit("hello world"); @@ -15,10 +15,10 @@ TestFuncResult test_commander_cmd_success(void) { b8 succeeded = result.exited && result.exit_code == EXIT_SUCCESS && result.error == SHELL_ERR_NO_ERROR; - return wapp_tester_result(succeeded); + return wpTesterResult(succeeded); } -TestFuncResult test_commander_cmd_failure(void) { +WpTestFuncResult test_commander_cmd_failure(void) { Str8List cmd = wapp_dbl_list(Str8); Str8 grep = wapp_str8_lit("grep"); wapp_dbl_list_push_back(Str8, &cmd, &grep); @@ -27,10 +27,10 @@ TestFuncResult test_commander_cmd_failure(void) { b8 failed = result.exited && result.exit_code != EXIT_SUCCESS && result.error == SHELL_ERR_NO_ERROR; - return wapp_tester_result(failed); + return wpTesterResult(failed); } -TestFuncResult test_commander_cmd_out_buf_success(void) { +WpTestFuncResult test_commander_cmd_out_buf_success(void) { Str8 buf = wapp_str8_buf(64); Str8 expected = wapp_str8_buf(64); char msg[] = "hello world"; @@ -46,10 +46,10 @@ TestFuncResult test_commander_cmd_out_buf_success(void) { b8 succeeded = result.exited && result.exit_code == EXIT_SUCCESS && result.error == SHELL_ERR_NO_ERROR && wapp_str8_equal_to_count(&buf, &expected, strlen(msg)); - return wapp_tester_result(succeeded); + return wpTesterResult(succeeded); } -TestFuncResult test_commander_cmd_out_buf_failure(void) { +WpTestFuncResult test_commander_cmd_out_buf_failure(void) { Str8 buf = wapp_str8_buf(4); Str8 expected = wapp_str8_buf(64); char msg[] = "hello world"; @@ -65,5 +65,5 @@ TestFuncResult test_commander_cmd_out_buf_failure(void) { b8 failed = !result.exited && result.exit_code != EXIT_SUCCESS && result.error == SHELL_ERR_OUT_BUF_FULL && !wapp_str8_equal(&buf, &expected); - return wapp_tester_result(failed); + return wpTesterResult(failed); } diff --git a/tests/shell_commander/test_shell_commander.h b/tests/shell_commander/test_shell_commander.h index ea547c7..8849395 100644 --- a/tests/shell_commander/test_shell_commander.h +++ b/tests/shell_commander/test_shell_commander.h @@ -3,9 +3,9 @@ #include "wapp.h" -TestFuncResult test_commander_cmd_success(void); -TestFuncResult test_commander_cmd_failure(void); -TestFuncResult test_commander_cmd_out_buf_success(void); -TestFuncResult test_commander_cmd_out_buf_failure(void); +WpTestFuncResult test_commander_cmd_success(void); +WpTestFuncResult test_commander_cmd_failure(void); +WpTestFuncResult test_commander_cmd_out_buf_success(void); +WpTestFuncResult test_commander_cmd_out_buf_failure(void); #endif // !TEST_SHELL_COMMANDER_H diff --git a/tests/str8/test_str8.c b/tests/str8/test_str8.c index 4ef2dca..bf97a2a 100644 --- a/tests/str8/test_str8.c +++ b/tests/str8/test_str8.c @@ -3,7 +3,7 @@ #define ARRLEN(ARR) (sizeof(ARR) / sizeof(ARR[0])) -TestFuncResult test_str8_lit(void) { +WpTestFuncResult test_str8_lit(void) { b8 result; Str8 s1 = wapp_str8_lit("Hello world"); @@ -27,10 +27,10 @@ TestFuncResult test_str8_lit(void) { Str8 s7 = wapp_str8_lit("Do unto others as you would have them do to you"); result = result && s7.capacity == 94 && s7.capacity != s7.size; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_lit_ro(void) { +WpTestFuncResult test_str8_lit_ro(void) { b8 result; Str8RO s1 = wapp_str8_lit_ro("Hello world"); @@ -54,10 +54,10 @@ TestFuncResult test_str8_lit_ro(void) { Str8RO s7 = wapp_str8_lit_ro("Do unto others as you would have them do to you"); result = result && s7.capacity == 47 && s7.capacity == s7.size; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_buf(void) { +WpTestFuncResult test_str8_buf(void) { b8 result; Str8 s1 = wapp_str8_buf(1024); @@ -72,14 +72,14 @@ TestFuncResult test_str8_buf(void) { Str8 s4 = wapp_str8_buf(8192); result = result && s4.capacity == 8192 && s4.size == 0; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_alloc_buf(void) { +WpTestFuncResult test_str8_alloc_buf(void) { b8 result; Allocator allocator = wapp_mem_arena_allocator_init(KiB(100)); if (wapp_mem_allocator_invalid(&allocator)) { - return wapp_tester_result(false); + return wpTesterResult(false); } u64 capacity = 4096; @@ -100,71 +100,71 @@ TestFuncResult test_str8_alloc_buf(void) { TEST_ALLOC_BUF_CLEANUP: wapp_mem_arena_allocator_destroy(&allocator); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_alloc_cstr(void) { +WpTestFuncResult test_str8_alloc_cstr(void) { b8 result; Allocator allocator = wapp_mem_arena_allocator_init(KiB(100)); if (wapp_mem_allocator_invalid(&allocator)) { - return wapp_tester_result(false); + return wpTesterResult(false); } char *str = "Abdelrahman"; u64 length = strlen(str); Str8 *s = wapp_str8_alloc_cstr(&allocator, str); if (!s) { - return wapp_tester_result(false); + return wpTesterResult(false); } result = s->size == length && memcmp(s->buf, str, length) == 0; wapp_mem_arena_allocator_destroy(&allocator); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_alloc_str8(void) { +WpTestFuncResult test_str8_alloc_str8(void) { b8 result; Allocator allocator = wapp_mem_arena_allocator_init(KiB(100)); if (wapp_mem_allocator_invalid(&allocator)) { - return wapp_tester_result(false); + return wpTesterResult(false); } Str8 str = wapp_str8_lit("Abdelrahman"); Str8 *s = wapp_str8_alloc_str8(&allocator, &str); if (!s) { - return wapp_tester_result(false); + return wpTesterResult(false); } result = wapp_str8_equal(s, &str); wapp_mem_arena_allocator_destroy(&allocator); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_alloc_substr(void) { +WpTestFuncResult test_str8_alloc_substr(void) { b8 result; Allocator allocator = wapp_mem_arena_allocator_init(KiB(100)); if (wapp_mem_allocator_invalid(&allocator)) { - return wapp_tester_result(false); + return wpTesterResult(false); } Str8 str = wapp_str8_lit("Abdelrahman"); Str8 *s = wapp_str8_alloc_substr(&allocator, &str, 3, 8); if (!s) { - return wapp_tester_result(false); + return wpTesterResult(false); } result = s->size == 5 && memcmp(s->buf, "elrah", s->size) == 0; wapp_mem_arena_allocator_destroy(&allocator); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_get_index_within_bounds(void) { +WpTestFuncResult test_str8_get_index_within_bounds(void) { b8 result; Str8RO s1 = wapp_str8_lit_ro("Hello world"); @@ -188,16 +188,16 @@ TestFuncResult test_str8_get_index_within_bounds(void) { Str8RO s7 = wapp_str8_lit_ro("Do unto others as you would have them do to you"); result = result && wapp_str8_get(&s7, 16) == 's'; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_get_index_out_of_bounds(void) { +WpTestFuncResult test_str8_get_index_out_of_bounds(void) { Str8 s1 = wapp_str8_lit("Hello world"); b8 result = wapp_str8_get(&s1, 20) == '\0'; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_set(void) { +WpTestFuncResult test_str8_set(void) { b8 result; Str8 s1 = wapp_str8_lit("Hello world"); @@ -228,10 +228,10 @@ TestFuncResult test_str8_set(void) { wapp_str8_set(&s7, 16, 'i'); result = result && wapp_str8_get(&s7, 16) == 'i'; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_push_back(void) { +WpTestFuncResult test_str8_push_back(void) { b8 result; Str8 expected = wapp_str8_lit("Abdelrahman"); @@ -250,10 +250,10 @@ TestFuncResult test_str8_push_back(void) { result = wapp_str8_equal(&buf, &expected); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_equal(void) { +WpTestFuncResult test_str8_equal(void) { b8 result; Str8RO s1 = wapp_str8_lit_ro("hello"); @@ -265,10 +265,10 @@ TestFuncResult test_str8_equal(void) { result = result && wapp_str8_equal(&s1, &s3) == true; result = result && wapp_str8_equal(&s1, &s4) == false; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_slice(void) { +WpTestFuncResult test_str8_slice(void) { b8 result; Str8 s = wapp_str8_lit("Different strokes for different folks"); @@ -284,10 +284,10 @@ TestFuncResult test_str8_slice(void) { Str8RO sub4 = wapp_str8_slice(&s, 70, 80); result = result && sub4.size == 0 && sub4.capacity == 0; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_alloc_concat(void) { +WpTestFuncResult test_str8_alloc_concat(void) { b8 result; Allocator arena = wapp_mem_arena_allocator_init(KiB(100)); @@ -307,10 +307,10 @@ TestFuncResult test_str8_alloc_concat(void) { wapp_mem_arena_allocator_destroy(&arena); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_concat_capped(void) { +WpTestFuncResult test_str8_concat_capped(void) { b8 result; Str8 str = wapp_str8_lit("Hello world"); @@ -325,10 +325,10 @@ TestFuncResult test_str8_concat_capped(void) { wapp_str8_concat_capped(&str, &suffix2); result = result && str.size == concat2.size && wapp_str8_equal(&str, &concat2); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_copy_cstr_capped(void) { +WpTestFuncResult test_str8_copy_cstr_capped(void) { b8 result; Str8 buf = wapp_str8_buf(32); @@ -343,10 +343,10 @@ TestFuncResult test_str8_copy_cstr_capped(void) { wapp_str8_copy_cstr_capped(&buf, src2); result = result && buf.size == src2_cp.size && buf.size == buf.capacity && wapp_str8_equal(&buf, &src2_cp); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_copy_str8_capped(void) { +WpTestFuncResult test_str8_copy_str8_capped(void) { b8 result; Str8 buf = wapp_str8_buf(32); @@ -360,10 +360,10 @@ TestFuncResult test_str8_copy_str8_capped(void) { wapp_str8_copy_str8_capped(&buf, &src2); result = result && buf.size < src2.size && buf.size == buf.capacity && wapp_str8_equal(&buf, &src2_cp); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_format(void) { +WpTestFuncResult test_str8_format(void) { b8 result; Str8 buf = wapp_str8_buf(128); @@ -373,10 +373,10 @@ TestFuncResult test_str8_format(void) { result = wapp_str8_equal(&buf, &expected); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_find(void) { +WpTestFuncResult test_str8_find(void) { b8 result; Str8RO s = wapp_str8_lit("Do as I say, not as I do"); @@ -389,10 +389,10 @@ TestFuncResult test_str8_find(void) { result = result && (wapp_str8_find(&s, wapp_str8_lit_ro("not sa I")) == -1); result = result && (wapp_str8_find(&s, wapp_str8_lit_ro("Do unto others as you would have them do to you")) == -1); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_rfind(void) { +WpTestFuncResult test_str8_rfind(void) { b8 result; Str8RO s = wapp_str8_lit("Do as I say, not as I do"); @@ -405,10 +405,10 @@ TestFuncResult test_str8_rfind(void) { result = result && (wapp_str8_rfind(&s, wapp_str8_lit_ro("not sa I")) == -1); result = result && (wapp_str8_rfind(&s, wapp_str8_lit_ro("Do unto others as you would have them do to you")) == -1); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_split(void) { +WpTestFuncResult test_str8_split(void) { b8 result; Allocator arena = wapp_mem_arena_allocator_init(KiB(100)); @@ -462,10 +462,10 @@ TestFuncResult test_str8_split(void) { wapp_mem_arena_allocator_destroy(&arena); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_split_with_max(void) { +WpTestFuncResult test_str8_split_with_max(void) { b8 result; Allocator arena = wapp_mem_arena_allocator_init(KiB(100)); @@ -497,10 +497,10 @@ TestFuncResult test_str8_split_with_max(void) { wapp_mem_arena_allocator_destroy(&arena); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_rsplit(void) { +WpTestFuncResult test_str8_rsplit(void) { b8 result; Allocator arena = wapp_mem_arena_allocator_init(KiB(100)); @@ -554,10 +554,10 @@ TestFuncResult test_str8_rsplit(void) { wapp_mem_arena_allocator_destroy(&arena); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_rsplit_with_max(void) { +WpTestFuncResult test_str8_rsplit_with_max(void) { b8 result; Allocator arena = wapp_mem_arena_allocator_init(KiB(100)); @@ -589,10 +589,10 @@ TestFuncResult test_str8_rsplit_with_max(void) { wapp_mem_arena_allocator_destroy(&arena); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_join(void) { +WpTestFuncResult test_str8_join(void) { b8 result; Allocator arena = wapp_mem_arena_allocator_init(KiB(100)); @@ -609,10 +609,10 @@ TestFuncResult test_str8_join(void) { wapp_mem_arena_allocator_destroy(&arena); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_from_bytes(void) { +WpTestFuncResult test_str8_from_bytes(void) { b8 result; Str8 str = wapp_str8_buf(1024); @@ -622,5 +622,5 @@ TestFuncResult test_str8_from_bytes(void) { result = str.size == wapp_array_count(bytes) * wapp_array_item_size(bytes); result = result && wapp_str8_equal(&str, &wapp_str8_lit_ro("WAPP")); - return wapp_tester_result(result); + return wpTesterResult(result); } diff --git a/tests/str8/test_str8.cc b/tests/str8/test_str8.cc index 251d31b..b29b80d 100644 --- a/tests/str8/test_str8.cc +++ b/tests/str8/test_str8.cc @@ -3,7 +3,7 @@ #define ARRLEN(ARR) (sizeof(ARR) / sizeof(ARR[0])) -TestFuncResult test_str8_lit(void) { +WpTestFuncResult test_str8_lit(void) { b8 result; Str8 s1 = wapp_str8_lit("Hello world"); @@ -27,10 +27,10 @@ TestFuncResult test_str8_lit(void) { Str8 s7 = wapp_str8_lit("Do unto others as you would have them do to you"); result = result && s7.capacity == 94 && s7.capacity != s7.size; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_lit_ro(void) { +WpTestFuncResult test_str8_lit_ro(void) { b8 result; Str8RO s1 = wapp_str8_lit_ro("Hello world"); @@ -54,10 +54,10 @@ TestFuncResult test_str8_lit_ro(void) { Str8RO s7 = wapp_str8_lit_ro("Do unto others as you would have them do to you"); result = result && s7.capacity == 47 && s7.capacity == s7.size; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_buf(void) { +WpTestFuncResult test_str8_buf(void) { b8 result; Str8 s1 = wapp_str8_buf(1024); @@ -72,14 +72,14 @@ TestFuncResult test_str8_buf(void) { Str8 s4 = wapp_str8_buf(8192); result = result && s4.capacity == 8192 && s4.size == 0; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_alloc_buf(void) { +WpTestFuncResult test_str8_alloc_buf(void) { b8 result; Allocator allocator = wapp_mem_arena_allocator_init(KiB(100)); if (wapp_mem_allocator_invalid(&allocator)) { - return wapp_tester_result(false); + return wpTesterResult(false); } u64 capacity = 4096; @@ -88,7 +88,7 @@ TestFuncResult test_str8_alloc_buf(void) { if (!s) { result = false; wapp_mem_arena_allocator_destroy(&allocator); - return wapp_tester_result(result); + return wpTesterResult(result); } result = s->capacity == capacity; @@ -100,71 +100,71 @@ TestFuncResult test_str8_alloc_buf(void) { wapp_mem_arena_allocator_destroy(&allocator); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_alloc_cstr(void) { +WpTestFuncResult test_str8_alloc_cstr(void) { b8 result; Allocator allocator = wapp_mem_arena_allocator_init(KiB(100)); if (wapp_mem_allocator_invalid(&allocator)) { - return wapp_tester_result(false); + return wpTesterResult(false); } const char *str = "Abdelrahman"; u64 length = strlen(str); Str8 *s = wapp_str8_alloc_cstr(&allocator, str); if (!s) { - return wapp_tester_result(false); + return wpTesterResult(false); } result = s->size == length && memcmp(s->buf, str, length) == 0; wapp_mem_arena_allocator_destroy(&allocator); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_alloc_str8(void) { +WpTestFuncResult test_str8_alloc_str8(void) { b8 result; Allocator allocator = wapp_mem_arena_allocator_init(KiB(100)); if (wapp_mem_allocator_invalid(&allocator)) { - return wapp_tester_result(false); + return wpTesterResult(false); } Str8 str = wapp_str8_lit("Abdelrahman"); Str8 *s = wapp_str8_alloc_str8(&allocator, &str); if (!s) { - return wapp_tester_result(false); + return wpTesterResult(false); } result = wapp_str8_equal(s, &str); wapp_mem_arena_allocator_destroy(&allocator); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_alloc_substr(void) { +WpTestFuncResult test_str8_alloc_substr(void) { b8 result; Allocator allocator = wapp_mem_arena_allocator_init(KiB(100)); if (wapp_mem_allocator_invalid(&allocator)) { - return wapp_tester_result(false); + return wpTesterResult(false); } Str8 str = wapp_str8_lit("Abdelrahman"); Str8 *s = wapp_str8_alloc_substr(&allocator, &str, 3, 8); if (!s) { - return wapp_tester_result(false); + return wpTesterResult(false); } result = s->size == 5 && memcmp(s->buf, "elrah", s->size) == 0; wapp_mem_arena_allocator_destroy(&allocator); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_get_index_within_bounds(void) { +WpTestFuncResult test_str8_get_index_within_bounds(void) { b8 result; Str8RO s1 = wapp_str8_lit_ro("Hello world"); @@ -188,16 +188,16 @@ TestFuncResult test_str8_get_index_within_bounds(void) { Str8RO s7 = wapp_str8_lit_ro("Do unto others as you would have them do to you"); result = result && wapp_str8_get(&s7, 16) == 's'; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_get_index_out_of_bounds(void) { +WpTestFuncResult test_str8_get_index_out_of_bounds(void) { Str8 s1 = wapp_str8_lit("Hello world"); b8 result = wapp_str8_get(&s1, 20) == '\0'; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_set(void) { +WpTestFuncResult test_str8_set(void) { b8 result; Str8 s1 = wapp_str8_lit("Hello world"); @@ -228,10 +228,10 @@ TestFuncResult test_str8_set(void) { wapp_str8_set(&s7, 16, 'i'); result = result && wapp_str8_get(&s7, 16) == 'i'; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_push_back(void) { +WpTestFuncResult test_str8_push_back(void) { b8 result; Str8 expected = wapp_str8_lit("Abdelrahman"); @@ -250,10 +250,10 @@ TestFuncResult test_str8_push_back(void) { result = wapp_str8_equal(&buf, &expected); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_equal(void) { +WpTestFuncResult test_str8_equal(void) { b8 result; Str8RO s1 = wapp_str8_lit_ro("hello"); @@ -265,10 +265,10 @@ TestFuncResult test_str8_equal(void) { result = result && wapp_str8_equal(&s1, &s3) == (b8)true; result = result && wapp_str8_equal(&s1, &s4) == (b8)false; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_slice(void) { +WpTestFuncResult test_str8_slice(void) { b8 result; Str8 s = wapp_str8_lit("Different strokes for different folks"); @@ -284,10 +284,10 @@ TestFuncResult test_str8_slice(void) { Str8RO sub4 = wapp_str8_slice(&s, 70, 80); result = result && sub4.size == 0 && sub4.capacity == 0; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_alloc_concat(void) { +WpTestFuncResult test_str8_alloc_concat(void) { b8 result; Allocator arena = wapp_mem_arena_allocator_init(KiB(100)); @@ -307,10 +307,10 @@ TestFuncResult test_str8_alloc_concat(void) { wapp_mem_arena_allocator_destroy(&arena); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_concat_capped(void) { +WpTestFuncResult test_str8_concat_capped(void) { b8 result; Str8 str = wapp_str8_lit("Hello world"); @@ -325,10 +325,10 @@ TestFuncResult test_str8_concat_capped(void) { wapp_str8_concat_capped(&str, &suffix2); result = result && str.size == concat2.size && wapp_str8_equal(&str, &concat2); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_copy_cstr_capped(void) { +WpTestFuncResult test_str8_copy_cstr_capped(void) { b8 result; Str8 buf = wapp_str8_buf(32); @@ -343,10 +343,10 @@ TestFuncResult test_str8_copy_cstr_capped(void) { wapp_str8_copy_cstr_capped(&buf, src2); result = result && buf.size == src2_cp.size && buf.size == buf.capacity && wapp_str8_equal(&buf, &src2_cp); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_copy_str8_capped(void) { +WpTestFuncResult test_str8_copy_str8_capped(void) { b8 result; Str8 buf = wapp_str8_buf(32); @@ -360,10 +360,10 @@ TestFuncResult test_str8_copy_str8_capped(void) { wapp_str8_copy_str8_capped(&buf, &src2); result = result && buf.size < src2.size && buf.size == buf.capacity && wapp_str8_equal(&buf, &src2_cp); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_format(void) { +WpTestFuncResult test_str8_format(void) { b8 result; Str8 buf = wapp_str8_buf(128); @@ -373,10 +373,10 @@ TestFuncResult test_str8_format(void) { result = wapp_str8_equal(&buf, &expected); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_find(void) { +WpTestFuncResult test_str8_find(void) { b8 result; Str8RO s = wapp_str8_lit("Do as I say, not as I do"); @@ -389,10 +389,10 @@ TestFuncResult test_str8_find(void) { result = result && (wapp_str8_find(&s, wapp_str8_lit_ro("not sa I")) == -1); result = result && (wapp_str8_find(&s, wapp_str8_lit_ro("Do unto others as you would have them do to you")) == -1); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_rfind(void) { +WpTestFuncResult test_str8_rfind(void) { b8 result; Str8RO s = wapp_str8_lit("Do as I say, not as I do"); @@ -405,10 +405,10 @@ TestFuncResult test_str8_rfind(void) { result = result && (wapp_str8_rfind(&s, wapp_str8_lit_ro("not sa I")) == -1); result = result && (wapp_str8_rfind(&s, wapp_str8_lit_ro("Do unto others as you would have them do to you")) == -1); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_split(void) { +WpTestFuncResult test_str8_split(void) { b8 result; Allocator arena = wapp_mem_arena_allocator_init(KiB(100)); @@ -462,10 +462,10 @@ TestFuncResult test_str8_split(void) { wapp_mem_arena_allocator_destroy(&arena); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_split_with_max(void) { +WpTestFuncResult test_str8_split_with_max(void) { b8 result; Allocator arena = wapp_mem_arena_allocator_init(KiB(100)); @@ -497,10 +497,10 @@ TestFuncResult test_str8_split_with_max(void) { wapp_mem_arena_allocator_destroy(&arena); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_rsplit(void) { +WpTestFuncResult test_str8_rsplit(void) { b8 result; Allocator arena = wapp_mem_arena_allocator_init(KiB(100)); @@ -554,10 +554,10 @@ TestFuncResult test_str8_rsplit(void) { wapp_mem_arena_allocator_destroy(&arena); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_rsplit_with_max(void) { +WpTestFuncResult test_str8_rsplit_with_max(void) { b8 result; Allocator arena = wapp_mem_arena_allocator_init(KiB(100)); @@ -589,10 +589,10 @@ TestFuncResult test_str8_rsplit_with_max(void) { wapp_mem_arena_allocator_destroy(&arena); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_join(void) { +WpTestFuncResult test_str8_join(void) { b8 result; Allocator arena = wapp_mem_arena_allocator_init(KiB(100)); @@ -609,10 +609,10 @@ TestFuncResult test_str8_join(void) { wapp_mem_arena_allocator_destroy(&arena); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_from_bytes(void) { +WpTestFuncResult test_str8_from_bytes(void) { b8 result; Str8 str = wapp_str8_buf(1024); @@ -623,5 +623,5 @@ TestFuncResult test_str8_from_bytes(void) { result = str.size == wapp_array_count(bytes) * wapp_array_item_size(bytes); result = result && wapp_str8_equal(&str, &expected); - return wapp_tester_result(result); + return wpTesterResult(result); } diff --git a/tests/str8/test_str8.h b/tests/str8/test_str8.h index f3a2221..35b6438 100644 --- a/tests/str8/test_str8.h +++ b/tests/str8/test_str8.h @@ -3,31 +3,31 @@ #include "wapp.h" -TestFuncResult test_str8_lit(void); -TestFuncResult test_str8_lit_ro(void); -TestFuncResult test_str8_buf(void); -TestFuncResult test_str8_alloc_buf(void); -TestFuncResult test_str8_alloc_cstr(void); -TestFuncResult test_str8_alloc_str8(void); -TestFuncResult test_str8_alloc_substr(void); -TestFuncResult test_str8_alloc_concat(void); -TestFuncResult test_str8_get_index_within_bounds(void); -TestFuncResult test_str8_get_index_out_of_bounds(void); -TestFuncResult test_str8_set(void); -TestFuncResult test_str8_push_back(void); -TestFuncResult test_str8_equal(void); -TestFuncResult test_str8_slice(void); -TestFuncResult test_str8_concat_capped(void); -TestFuncResult test_str8_copy_cstr_capped(void); -TestFuncResult test_str8_copy_str8_capped(void); -TestFuncResult test_str8_format(void); -TestFuncResult test_str8_find(void); -TestFuncResult test_str8_rfind(void); -TestFuncResult test_str8_split(void); -TestFuncResult test_str8_split_with_max(void); -TestFuncResult test_str8_rsplit(void); -TestFuncResult test_str8_rsplit_with_max(void); -TestFuncResult test_str8_join(void); -TestFuncResult test_str8_from_bytes(void); +WpTestFuncResult test_str8_lit(void); +WpTestFuncResult test_str8_lit_ro(void); +WpTestFuncResult test_str8_buf(void); +WpTestFuncResult test_str8_alloc_buf(void); +WpTestFuncResult test_str8_alloc_cstr(void); +WpTestFuncResult test_str8_alloc_str8(void); +WpTestFuncResult test_str8_alloc_substr(void); +WpTestFuncResult test_str8_alloc_concat(void); +WpTestFuncResult test_str8_get_index_within_bounds(void); +WpTestFuncResult test_str8_get_index_out_of_bounds(void); +WpTestFuncResult test_str8_set(void); +WpTestFuncResult test_str8_push_back(void); +WpTestFuncResult test_str8_equal(void); +WpTestFuncResult test_str8_slice(void); +WpTestFuncResult test_str8_concat_capped(void); +WpTestFuncResult test_str8_copy_cstr_capped(void); +WpTestFuncResult test_str8_copy_str8_capped(void); +WpTestFuncResult test_str8_format(void); +WpTestFuncResult test_str8_find(void); +WpTestFuncResult test_str8_rfind(void); +WpTestFuncResult test_str8_split(void); +WpTestFuncResult test_str8_split_with_max(void); +WpTestFuncResult test_str8_rsplit(void); +WpTestFuncResult test_str8_rsplit_with_max(void); +WpTestFuncResult test_str8_join(void); +WpTestFuncResult test_str8_from_bytes(void); #endif // !TEST_STR8_H diff --git a/tests/str8/test_str8_list.c b/tests/str8/test_str8_list.c index 525d682..a385e1b 100644 --- a/tests/str8/test_str8_list.c +++ b/tests/str8/test_str8_list.c @@ -1,7 +1,7 @@ #include "test_str8_list.h" #include "wapp.h" -TestFuncResult test_str8_list_get(void) { +WpTestFuncResult test_str8_list_get(void) { b8 result; Str8 s1 = wapp_str8_lit("1"); @@ -33,10 +33,10 @@ TestFuncResult test_str8_list_get(void) { node = wapp_dbl_list_get(Str8, &list, 4); result = result && node == &s5 && wapp_str8_equal(node, &s5); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_list_push_front(void) { +WpTestFuncResult test_str8_list_push_front(void) { b8 result; Str8 s1 = wapp_str8_lit("1"); @@ -54,10 +54,10 @@ TestFuncResult test_str8_list_push_front(void) { wapp_dbl_list_push_front(Str8, &list, &s3); result = result && list.first->item == &s3 && wapp_str8_list_total_size(&list) == 3 && list.node_count == 3; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_list_push_back(void) { +WpTestFuncResult test_str8_list_push_back(void) { b8 result; Str8 s1 = wapp_str8_lit("1"); @@ -75,10 +75,10 @@ TestFuncResult test_str8_list_push_back(void) { wapp_dbl_list_push_back(Str8, &list, &s3); result = result && list.last->item == &s3 && wapp_str8_list_total_size(&list) == 3 && list.node_count == 3; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_list_insert(void) { +WpTestFuncResult test_str8_list_insert(void) { b8 result; Str8 s1 = wapp_str8_lit("1"); @@ -105,10 +105,10 @@ TestFuncResult test_str8_list_insert(void) { node = wapp_dbl_list_get(Str8, &list, 5); result = result && node != NULL && node == &s7 && wapp_str8_list_total_size(&list) == 7 && list.node_count == 7; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_list_pop_front(void) { +WpTestFuncResult test_str8_list_pop_front(void) { b8 result; Str8 s1 = wapp_str8_lit("1"); @@ -140,10 +140,10 @@ TestFuncResult test_str8_list_pop_front(void) { node = wapp_dbl_list_pop_front(Str8, &list); result = result && node == &s5 && wapp_str8_equal(node, &s5) && wapp_str8_list_total_size(&list) == 0 && list.node_count == 0; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_list_pop_back(void) { +WpTestFuncResult test_str8_list_pop_back(void) { b8 result; Str8 s1 = wapp_str8_lit("1"); @@ -175,10 +175,10 @@ TestFuncResult test_str8_list_pop_back(void) { node = wapp_dbl_list_pop_back(Str8, &list); result = result && node == &s5 && wapp_str8_equal(node, &s5) && wapp_str8_list_total_size(&list) == 0 && list.node_count == 0; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_list_remove(void) { +WpTestFuncResult test_str8_list_remove(void) { b8 result; Str8 s1 = wapp_str8_lit("1"); @@ -210,10 +210,10 @@ TestFuncResult test_str8_list_remove(void) { node = wapp_dbl_list_remove(Str8, &list, 0); result = result && node == &s5 && wapp_str8_equal(node, &s5) && wapp_str8_list_total_size(&list) == 0 && list.node_count == 0; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_list_empty(void) { +WpTestFuncResult test_str8_list_empty(void) { b8 result; Str8List list = wapp_dbl_list(Str8); @@ -226,5 +226,5 @@ TestFuncResult test_str8_list_empty(void) { result = list.first == NULL && list.last == NULL && list.node_count == 0 && wapp_str8_list_total_size(&list) == 0; - return wapp_tester_result(result); + return wpTesterResult(result); } diff --git a/tests/str8/test_str8_list.cc b/tests/str8/test_str8_list.cc index 48d233e..92d12e5 100644 --- a/tests/str8/test_str8_list.cc +++ b/tests/str8/test_str8_list.cc @@ -1,7 +1,7 @@ #include "test_str8_list.h" #include "wapp.h" -TestFuncResult test_str8_list_get(void) { +WpTestFuncResult test_str8_list_get(void) { b8 result; Str8 s1 = wapp_str8_lit("1"); @@ -33,10 +33,10 @@ TestFuncResult test_str8_list_get(void) { node = wapp_dbl_list_get(Str8, &list, 4); result = result && node == &s5 && wapp_str8_equal(node, &s5); - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_list_push_front(void) { +WpTestFuncResult test_str8_list_push_front(void) { b8 result; Str8 s1 = wapp_str8_lit("1"); @@ -54,10 +54,10 @@ TestFuncResult test_str8_list_push_front(void) { wapp_dbl_list_push_front(Str8, &list, &s3); result = result && list.first->item == &s3 && wapp_str8_list_total_size(&list) == 3 && list.node_count == 3; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_list_push_back(void) { +WpTestFuncResult test_str8_list_push_back(void) { b8 result; Str8 s1 = wapp_str8_lit("1"); @@ -75,10 +75,10 @@ TestFuncResult test_str8_list_push_back(void) { wapp_dbl_list_push_back(Str8, &list, &s3); result = result && list.last->item == &s3 && wapp_str8_list_total_size(&list) == 3 && list.node_count == 3; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_list_insert(void) { +WpTestFuncResult test_str8_list_insert(void) { b8 result; Str8 s1 = wapp_str8_lit("1"); @@ -105,10 +105,10 @@ TestFuncResult test_str8_list_insert(void) { node = wapp_dbl_list_get(Str8, &list, 5); result = result && node != NULL && node == &s7 && wapp_str8_list_total_size(&list) == 7 && list.node_count == 7; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_list_pop_front(void) { +WpTestFuncResult test_str8_list_pop_front(void) { b8 result; Str8 s1 = wapp_str8_lit("1"); @@ -140,10 +140,10 @@ TestFuncResult test_str8_list_pop_front(void) { node = wapp_dbl_list_pop_front(Str8, &list); result = result && node == &s5 && wapp_str8_equal(node, &s5) && wapp_str8_list_total_size(&list) == 0 && list.node_count == 0; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_list_pop_back(void) { +WpTestFuncResult test_str8_list_pop_back(void) { b8 result; Str8 s1 = wapp_str8_lit("1"); @@ -175,10 +175,10 @@ TestFuncResult test_str8_list_pop_back(void) { node = wapp_dbl_list_pop_back(Str8, &list); result = result && node == &s5 && wapp_str8_equal(node, &s5) && wapp_str8_list_total_size(&list) == 0 && list.node_count == 0; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_list_remove(void) { +WpTestFuncResult test_str8_list_remove(void) { b8 result; Str8 s1 = wapp_str8_lit("1"); @@ -210,10 +210,10 @@ TestFuncResult test_str8_list_remove(void) { node = wapp_dbl_list_remove(Str8, &list, 0); result = result && node == &s5 && wapp_str8_equal(node, &s5) && wapp_str8_list_total_size(&list) == 0 && list.node_count == 0; - return wapp_tester_result(result); + return wpTesterResult(result); } -TestFuncResult test_str8_list_empty(void) { +WpTestFuncResult test_str8_list_empty(void) { b8 result; Str8List list = wapp_dbl_list(Str8); @@ -234,5 +234,5 @@ TestFuncResult test_str8_list_empty(void) { result = list.first == NULL && list.last == NULL && list.node_count == 0 && wapp_str8_list_total_size(&list) == 0; - return wapp_tester_result(result); + return wpTesterResult(result); } diff --git a/tests/str8/test_str8_list.h b/tests/str8/test_str8_list.h index 963227e..0a5e2ec 100644 --- a/tests/str8/test_str8_list.h +++ b/tests/str8/test_str8_list.h @@ -3,13 +3,13 @@ #include "wapp.h" -TestFuncResult test_str8_list_get(void); -TestFuncResult test_str8_list_push_front(void); -TestFuncResult test_str8_list_push_back(void); -TestFuncResult test_str8_list_insert(void); -TestFuncResult test_str8_list_pop_front(void); -TestFuncResult test_str8_list_pop_back(void); -TestFuncResult test_str8_list_remove(void); -TestFuncResult test_str8_list_empty(void); +WpTestFuncResult test_str8_list_get(void); +WpTestFuncResult test_str8_list_push_front(void); +WpTestFuncResult test_str8_list_push_back(void); +WpTestFuncResult test_str8_list_insert(void); +WpTestFuncResult test_str8_list_pop_front(void); +WpTestFuncResult test_str8_list_pop_back(void); +WpTestFuncResult test_str8_list_remove(void); +WpTestFuncResult test_str8_list_empty(void); #endif // !TEST_STR8_LIST_H diff --git a/tests/wapptest.c b/tests/wapptest.c index 0846b98..d355bf1 100644 --- a/tests/wapptest.c +++ b/tests/wapptest.c @@ -12,7 +12,7 @@ #include int main(void) { - wapp_tester_run_tests( + wpTesterRun( test_arena_allocator, test_arena_allocator_with_buffer, test_arena_allocator_temp_begin, diff --git a/tests/wapptest.cc b/tests/wapptest.cc index 0846b98..d355bf1 100644 --- a/tests/wapptest.cc +++ b/tests/wapptest.cc @@ -12,7 +12,7 @@ #include int main(void) { - wapp_tester_run_tests( + wpTesterRun( test_arena_allocator, test_arena_allocator_with_buffer, test_arena_allocator_temp_begin,