File utilities and datatype implementation for a C-based code generator #5
@@ -7,7 +7,7 @@
|
||||
|
||||
typedef enum {
|
||||
CTYPE_VOID,
|
||||
CTYPE_BOOL,
|
||||
CTYPE_B32,
|
||||
CTYPE_CHAR,
|
||||
CTYPE_C8,
|
||||
CTYPE_C16,
|
||||
@@ -30,7 +30,7 @@ typedef enum {
|
||||
} CType;
|
||||
internal Str8RO ctypes[COUNT_CTYPE] = {
|
||||
[CTYPE_VOID] = wapp_str8_lit_ro("void"),
|
||||
[CTYPE_BOOL] = wapp_str8_lit_ro("b32"),
|
||||
[CTYPE_B32] = wapp_str8_lit_ro("b32"),
|
||||
[CTYPE_CHAR] = wapp_str8_lit_ro("char"),
|
||||
[CTYPE_C8] = wapp_str8_lit_ro("c8"),
|
||||
[CTYPE_C16] = wapp_str8_lit_ro("c16"),
|
||||
|
@@ -6,7 +6,6 @@
|
||||
#include "../../../common/assert/assert.h"
|
||||
#include "../../../common/misc/misc_utils.h"
|
||||
#include "../../os/mem/mem_os.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -22,14 +21,14 @@ struct arena {
|
||||
u8 *buf;
|
||||
u8 *offset;
|
||||
u64 capacity;
|
||||
bool committed;
|
||||
b32 committed;
|
||||
|
||||
#ifdef WAPP_PLATFORM_WINDOWS
|
||||
wapp_misc_utils_padding_size(sizeof(u8 *) * 2 + sizeof(u64) + sizeof(bool));
|
||||
wapp_misc_utils_padding_size(sizeof(u8 *) * 2 + sizeof(u64) + sizeof(b32));
|
||||
#endif // ifdef WAPP_PLATFORM_WINDOWS
|
||||
};
|
||||
|
||||
bool wapp_mem_arena_init_custom(Arena **arena, u64 base_capacity, MemAllocFlags flags, bool zero_buffer) {
|
||||
b32 wapp_mem_arena_init_custom(Arena **arena, u64 base_capacity, MemAllocFlags flags, b32 zero_buffer) {
|
||||
if (!arena || *arena || base_capacity == 0) {
|
||||
return false;
|
||||
}
|
||||
|
@@ -6,7 +6,6 @@
|
||||
#include "../../../common/aliases/aliases.h"
|
||||
#include "../../../common/platform/platform.h"
|
||||
#include "../../os/mem/mem_os.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
BEGIN_C_LINKAGE
|
||||
@@ -28,7 +27,7 @@ typedef struct arena Arena;
|
||||
* control over how the Arena is initialised. Wrapper macros are provided for
|
||||
* easier use.
|
||||
*/
|
||||
bool wapp_mem_arena_init_custom(Arena **arena, u64 base_capacity, MemAllocFlags flags, bool zero_buffer);
|
||||
b32 wapp_mem_arena_init_custom(Arena **arena, u64 base_capacity, MemAllocFlags flags, b32 zero_buffer);
|
||||
void *wapp_mem_arena_alloc(Arena *arena, u64 size);
|
||||
void *wapp_mem_arena_alloc_aligned(Arena *arena, u64 size, u64 alignment);
|
||||
void *wapp_mem_arena_realloc(Arena *arena, void *ptr, u64 old_size, u64 new_size);
|
||||
|
@@ -12,9 +12,9 @@ internal inline void *mem_arena_realloc_aligned(void *ptr, u64 old_size, u64 new
|
||||
void *alloc_obj);
|
||||
|
||||
|
||||
Allocator wapp_mem_arena_allocator_init_custom(u64 base_capacity, MemAllocFlags flags, bool zero_buffer) {
|
||||
Allocator wapp_mem_arena_allocator_init_custom(u64 base_capacity, MemAllocFlags flags, b32 zero_buffer) {
|
||||
Allocator allocator = {0};
|
||||
bool initialised = wapp_mem_arena_init_custom((Arena **)(&allocator.obj), base_capacity, flags, zero_buffer);
|
||||
b32 initialised = wapp_mem_arena_init_custom((Arena **)(&allocator.obj), base_capacity, flags, zero_buffer);
|
||||
if (!initialised) {
|
||||
return allocator;
|
||||
}
|
||||
|
@@ -7,7 +7,6 @@
|
||||
#include "../../../common/platform/platform.h"
|
||||
#include "../../../primitives/mem_allocator/mem_allocator.h"
|
||||
#include "../../os/mem/mem_os.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
BEGIN_C_LINKAGE
|
||||
@@ -33,7 +32,7 @@ BEGIN_C_LINKAGE
|
||||
* The `wapp_mem_arena_allocator_init_custom` provides the most control over how
|
||||
* the Arena is initialised. Wrapper macros are provided for easier use.
|
||||
*/
|
||||
Allocator wapp_mem_arena_allocator_init_custom(u64 base_capacity, MemAllocFlags flags, bool zero_buffer);
|
||||
Allocator wapp_mem_arena_allocator_init_custom(u64 base_capacity, MemAllocFlags flags, b32 zero_buffer);
|
||||
void wapp_mem_arena_allocator_clear(Allocator *allocator);
|
||||
void wapp_mem_arena_allocator_destroy(Allocator *allocator);
|
||||
|
||||
|
@@ -3,10 +3,9 @@
|
||||
#include "mem_utils.h"
|
||||
#include "../../../common/aliases/aliases.h"
|
||||
#include "../../../common/assert/assert.h"
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
internal bool is_power_of_two(u64 num) { return (num & (num - 1)) == 0; }
|
||||
internal b32 is_power_of_two(u64 num) { return (num & (num - 1)) == 0; }
|
||||
|
||||
void *wapp_mem_util_align_forward(void *ptr, u64 alignment) {
|
||||
wapp_debug_assert(ptr != NULL, "`ptr` should not be NULL");
|
||||
|
@@ -8,7 +8,6 @@
|
||||
#include "../../../primitives/mem_allocator/mem_allocator.h"
|
||||
#include "../../../primitives/strings/str8/str8.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -22,7 +21,7 @@ u32 wapp_cpath_join_path(Str8 *dst, const Str8List *parts) {
|
||||
}
|
||||
|
||||
Str8 separator = wapp_str8_buf(4);
|
||||
wapp_str8_push_back(&separator, PATH_SEP);
|
||||
wapp_str8_push_back(&separator, WAPP_PATH_SEP);
|
||||
|
||||
u64 required_capacity = parts->node_count * separator.size + wapp_str8_list_total_size(parts);
|
||||
if (dst->capacity < required_capacity) {
|
||||
@@ -37,7 +36,7 @@ u32 wapp_cpath_join_path(Str8 *dst, const Str8List *parts) {
|
||||
// MSVC Spectre mitigation warnings
|
||||
const Str8Node *node = first_node;
|
||||
u64 node_index = 1;
|
||||
bool running = node_index < parts->node_count;
|
||||
b32 running = node_index < parts->node_count;
|
||||
while (running && node->next) {
|
||||
node = node->next;
|
||||
if (node->item->size == 0) {
|
||||
@@ -45,9 +44,9 @@ u32 wapp_cpath_join_path(Str8 *dst, const Str8List *parts) {
|
||||
}
|
||||
|
||||
if (dst->size > 0) {
|
||||
char dst_last = wapp_str8_get(dst, dst->size - 1);
|
||||
char node_start = wapp_str8_get(node->item, 0);
|
||||
bool add_path_sep = dst_last != PATH_SEP && node_start != PATH_SEP;
|
||||
char dst_last = wapp_str8_get(dst, dst->size - 1);
|
||||
char node_start = wapp_str8_get(node->item, 0);
|
||||
b32 add_path_sep = dst_last != WAPP_PATH_SEP && node_start != WAPP_PATH_SEP;
|
||||
|
||||
if (add_path_sep) {
|
||||
wapp_str8_concat_capped(dst, &separator);
|
||||
@@ -69,9 +68,9 @@ Str8 *dirup(const Allocator *allocator, Str8RO *path, u64 levels) {
|
||||
goto RETURN_DIRUP;
|
||||
}
|
||||
|
||||
bool absolute = wapp_str8_get(path, 0) == PATH_SEP;
|
||||
b32 absolute = wapp_str8_get(path, 0) == WAPP_PATH_SEP;
|
||||
Str8 separator = wapp_str8_buf(4);
|
||||
wapp_str8_push_back(&separator, PATH_SEP);
|
||||
wapp_str8_push_back(&separator, WAPP_PATH_SEP);
|
||||
|
||||
if (path->size == 0) {
|
||||
output = wapp_str8_alloc_buf(allocator, 16);
|
||||
@@ -79,7 +78,7 @@ Str8 *dirup(const Allocator *allocator, Str8RO *path, u64 levels) {
|
||||
goto RETURN_DIRUP;
|
||||
}
|
||||
|
||||
wapp_str8_push_back(output, absolute ? PATH_SEP : '.');
|
||||
wapp_str8_push_back(output, absolute ? WAPP_PATH_SEP : '.');
|
||||
goto RETURN_DIRUP;
|
||||
}
|
||||
|
||||
@@ -104,7 +103,7 @@ Str8 *dirup(const Allocator *allocator, Str8RO *path, u64 levels) {
|
||||
goto LIST_CLEANUP_DIRUP;
|
||||
}
|
||||
|
||||
wapp_str8_push_back(output, absolute ? PATH_SEP : '.');
|
||||
wapp_str8_push_back(output, absolute ? WAPP_PATH_SEP : '.');
|
||||
} else {
|
||||
for (u64 i = 0; i < levels; ++i) {
|
||||
wapp_str8_list_pop_back(parts);
|
||||
@@ -118,7 +117,7 @@ Str8 *dirup(const Allocator *allocator, Str8RO *path, u64 levels) {
|
||||
output = wapp_str8_alloc_buf(allocator, alloc_size);
|
||||
if (output) {
|
||||
if (absolute) {
|
||||
wapp_str8_push_back(output, PATH_SEP);
|
||||
wapp_str8_push_back(output, WAPP_PATH_SEP);
|
||||
}
|
||||
|
||||
Str8 *joined = wapp_str8_join(&tmp_arena, parts, &separator);
|
||||
|
@@ -13,9 +13,13 @@ BEGIN_C_LINKAGE
|
||||
#endif // !WAPP_PLATFORM_CPP
|
||||
|
||||
#ifdef WAPP_PLATFORM_POSIX
|
||||
#define PATH_SEP '/'
|
||||
#include <limits.h>
|
||||
#define WAPP_PATH_SEP '/'
|
||||
#define WAPP_PATH_MAX PATH_MAX
|
||||
#elif defined(WAPP_PLATFORM_WINDOWS)
|
||||
#define PATH_SEP '\\'
|
||||
#include <windows.h>
|
||||
#define WAPP_PATH_SEP '\\'
|
||||
#define WAPP_PATH_MAX MAX_PATH
|
||||
#else
|
||||
#error "Unrecognised platform"
|
||||
#endif
|
||||
|
@@ -5,7 +5,6 @@
|
||||
#include "../../../common/aliases/aliases.h"
|
||||
#include "../../../common/platform/platform.h"
|
||||
#include <assert.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(WAPP_PLATFORM_WINDOWS)
|
||||
|
@@ -10,7 +10,6 @@
|
||||
#include "../../../../primitives/mem_allocator/mem_allocator.h"
|
||||
#include "../../../../primitives/strings/str8/str8.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@@ -7,7 +7,6 @@
|
||||
#include "../../../../common/aliases/aliases.h"
|
||||
#include "../../../../common/platform/platform.h"
|
||||
#include "../../../../primitives/strings/str8/str8.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@@ -5,7 +5,6 @@
|
||||
|
||||
#include "../../../../common/aliases/aliases.h"
|
||||
#include "../../../../common/platform/platform.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
BEGIN_C_LINKAGE
|
||||
@@ -30,11 +29,11 @@ typedef struct commander_result CMDResult;
|
||||
struct commander_result {
|
||||
i32 exit_code;
|
||||
CMDError error;
|
||||
bool exited;
|
||||
b32 exited;
|
||||
|
||||
#ifdef WAPP_PLATFORM_WINDOWS
|
||||
#include "../../../../common/misc/misc_utils.h"
|
||||
wapp_misc_utils_padding_size(sizeof(bool) + sizeof(i32) + sizeof(CMDError));
|
||||
wapp_misc_utils_padding_size(sizeof(b32) + sizeof(i32) + sizeof(CMDError));
|
||||
#endif // !WAPP_PLATFORM_WINDOWS
|
||||
};
|
||||
|
||||
|
@@ -9,7 +9,6 @@
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define STR8_BUF_ALLOC_SIZE(CAPACITY) (sizeof(Str8) + sizeof(c8) * CAPACITY)
|
||||
|
||||
@@ -279,7 +278,7 @@ i64 wapp_str8_find(Str8RO *str, Str8RO substr) {
|
||||
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||
// MSVC Spectre mitigation warnings
|
||||
u64 char_index = 0;
|
||||
bool running = char_index < str->size;
|
||||
b32 running = char_index < str->size;
|
||||
while (running) {
|
||||
const c8 *sub = str->buf + char_index;
|
||||
if (memcmp(sub, substr.buf, substr.size) == 0) {
|
||||
@@ -301,7 +300,7 @@ i64 wapp_str8_rfind(Str8RO *str, Str8RO substr) {
|
||||
// NOTE (Abdelrahman): Uses a while loop instead of a for loop to get rid of
|
||||
// MSVC Spectre mitigation warnings
|
||||
i64 char_index = str->size - substr.size;
|
||||
bool running = char_index >= 0;
|
||||
b32 running = char_index >= 0;
|
||||
while (running) {
|
||||
const c8 *sub = str->buf + char_index;
|
||||
if (memcmp(sub, substr.buf, substr.size) == 0) {
|
||||
@@ -428,7 +427,7 @@ Str8 *wapp_str8_join(const Allocator *allocator, const Str8List *list, Str8RO *d
|
||||
// MSVC Spectre mitigation warnings
|
||||
Str8Node *node;
|
||||
u64 node_index = 0;
|
||||
bool running = node_index < list->node_count;
|
||||
b32 running = node_index < list->node_count;
|
||||
while (running) {
|
||||
node = wapp_str8_list_get(list, node_index);
|
||||
if (!node) {
|
||||
@@ -439,7 +438,7 @@ Str8 *wapp_str8_join(const Allocator *allocator, const Str8List *list, Str8RO *d
|
||||
|
||||
// NOTE (Abdelrahman): Comparison extracted to variable to silence
|
||||
// MSVC Spectre mitigation warnings
|
||||
bool not_last = node_index + 1 < list->node_count;
|
||||
b32 not_last = node_index + 1 < list->node_count;
|
||||
if (not_last) {
|
||||
wapp_str8_concat_capped(output, delimiter);
|
||||
}
|
||||
@@ -461,7 +460,7 @@ u64 wapp_str8_list_total_size(const Str8List *list) {
|
||||
Str8Node* node;
|
||||
u64 node_index = 0;
|
||||
u64 output = 0;
|
||||
bool running = node_index < list->node_count;
|
||||
b32 running = node_index < list->node_count;
|
||||
while (running) {
|
||||
node = wapp_str8_list_get(list, node_index);
|
||||
if (!node) {
|
||||
|
@@ -10,7 +10,6 @@
|
||||
#include "../../../primitives/dbl_list/dbl_list.h"
|
||||
#include "../../mem_allocator/mem_allocator.h"
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
BEGIN_C_LINKAGE
|
||||
|
@@ -4,7 +4,6 @@
|
||||
#include "../../common/aliases/aliases.h"
|
||||
#include "../../common/assert/assert.h"
|
||||
#include "../../common/platform/platform.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
||||
@@ -19,7 +18,7 @@ internal void seed_os_generator(void);
|
||||
internal u64 generate_random_number(void);
|
||||
|
||||
XOR256State wapp_prng_xorshift_init_state(void) {
|
||||
persistent bool seeded = false;
|
||||
persistent b32 seeded = false;
|
||||
if (!seeded) {
|
||||
seeded = true;
|
||||
seed_os_generator();
|
||||
|
@@ -6,7 +6,6 @@
|
||||
#include "../../common/misc/misc_utils.h"
|
||||
#include "../../common/platform/platform.h"
|
||||
#include "../../primitives/strings/str8/str8.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef WAPP_PLATFORM_CPP
|
||||
BEGIN_C_LINKAGE
|
||||
@@ -23,10 +22,10 @@ BEGIN_C_LINKAGE
|
||||
typedef struct test_func_result TestFuncResult;
|
||||
struct test_func_result {
|
||||
Str8RO name;
|
||||
bool passed;
|
||||
b32 passed;
|
||||
|
||||
#ifdef WAPP_PLATFORM_WINDOWS
|
||||
wapp_misc_utils_padding_size(sizeof(Str8RO) + sizeof(bool));
|
||||
wapp_misc_utils_padding_size(sizeof(Str8RO) + sizeof(b32));
|
||||
#endif // WAPP_PLATFORM_WINDOWS
|
||||
};
|
||||
|
||||
|
@@ -5,7 +5,6 @@
|
||||
#include "../common/assert/assert.h"
|
||||
#include "../primitives/strings/str8/str8.h"
|
||||
#include "../prng/xorshift/xorshift.h"
|
||||
#include <stdbool.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#define UUID_STR_FORMAT ("%.8" PRIx64 "-%.4" PRIx64 "-%.4" PRIx64 "-%.4" PRIx64 "-%.12" PRIx64)
|
||||
@@ -30,7 +29,7 @@ UUID *wapp_uuid_init_uuid4(UUID *uuid) {
|
||||
|
||||
internal UUID4 generate_uuid4(void) {
|
||||
persistent XOR256State state = {0};
|
||||
persistent bool initialised = false;
|
||||
persistent b32 initialised = false;
|
||||
|
||||
if (!initialised) {
|
||||
initialised = true;
|
||||
|
@@ -1,11 +1,10 @@
|
||||
#include "test_allocator.h"
|
||||
#include "wapp.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
TestFuncResult test_arena_allocator(void) {
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(4096);
|
||||
bool result = allocator.obj != NULL && allocator.alloc != NULL &&
|
||||
b32 result = allocator.obj != NULL && allocator.alloc != NULL &&
|
||||
allocator.alloc_aligned != NULL &&
|
||||
allocator.realloc != NULL && allocator.realloc_aligned != NULL &&
|
||||
allocator.free == NULL;
|
||||
|
@@ -1,11 +1,10 @@
|
||||
#include "test_allocator.h"
|
||||
#include "wapp.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
TestFuncResult test_arena_allocator(void) {
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(4096);
|
||||
bool result = allocator.obj != nullptr && allocator.alloc != nullptr &&
|
||||
b32 result = allocator.obj != nullptr && allocator.alloc != nullptr &&
|
||||
allocator.alloc_aligned != nullptr &&
|
||||
allocator.realloc != nullptr && allocator.realloc_aligned != nullptr &&
|
||||
allocator.free == nullptr;
|
||||
|
@@ -1,6 +1,5 @@
|
||||
#include "test_arena.h"
|
||||
#include "wapp.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define ARENA_CAPACITY KB(16)
|
||||
@@ -10,7 +9,7 @@ internal i32 count = 20;
|
||||
internal i32 *array = NULL;
|
||||
|
||||
TestFuncResult test_arena_init(void) {
|
||||
bool result = wapp_mem_arena_init(&arena, ARENA_CAPACITY);
|
||||
b32 result = wapp_mem_arena_init(&arena, ARENA_CAPACITY);
|
||||
|
||||
return wapp_tester_result(result);
|
||||
}
|
||||
@@ -18,7 +17,7 @@ TestFuncResult test_arena_init(void) {
|
||||
TestFuncResult test_arena_init_succeeds_when_reserving_very_large_size(void) {
|
||||
Arena *large_arena = NULL;
|
||||
u64 capacity = GB(512);
|
||||
bool result = wapp_mem_arena_init(&large_arena, capacity);
|
||||
b32 result = wapp_mem_arena_init(&large_arena, capacity);
|
||||
if (result) {
|
||||
wapp_mem_arena_destroy(&large_arena);
|
||||
}
|
||||
@@ -28,7 +27,7 @@ TestFuncResult test_arena_init_succeeds_when_reserving_very_large_size(void) {
|
||||
|
||||
TestFuncResult test_arena_alloc_succeeds_when_within_capacity(void) {
|
||||
array = wapp_mem_arena_alloc(arena, count * sizeof(i32));
|
||||
bool result = array != NULL;
|
||||
b32 result = array != NULL;
|
||||
|
||||
for (i32 i = 0; i < count; ++i) {
|
||||
array[i] = i * 10;
|
||||
@@ -39,7 +38,7 @@ TestFuncResult test_arena_alloc_succeeds_when_within_capacity(void) {
|
||||
|
||||
TestFuncResult test_arena_alloc_fails_when_over_capacity(void) {
|
||||
u8 *bytes = wapp_mem_arena_alloc(arena, ARENA_CAPACITY * 2);
|
||||
bool result = bytes == NULL;
|
||||
b32 result = bytes == NULL;
|
||||
|
||||
return wapp_tester_result(result);
|
||||
}
|
||||
@@ -92,7 +91,7 @@ TestFuncResult test_arena_realloc_smaller_size(void) {
|
||||
|
||||
TestFuncResult test_arena_clear(void) {
|
||||
wapp_mem_arena_clear(arena);
|
||||
bool result = true;
|
||||
b32 result = true;
|
||||
|
||||
for (i32 i = 0; i < count; ++i) {
|
||||
if (array[i] != 0) {
|
||||
@@ -106,7 +105,7 @@ TestFuncResult test_arena_clear(void) {
|
||||
|
||||
TestFuncResult test_arena_destroy(void) {
|
||||
wapp_mem_arena_destroy(&arena);
|
||||
bool result = arena == NULL;
|
||||
b32 result = arena == NULL;
|
||||
|
||||
return wapp_tester_result(result);
|
||||
}
|
||||
|
@@ -1,6 +1,5 @@
|
||||
#include "test_arena.h"
|
||||
#include "wapp.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define ARENA_CAPACITY KB(16)
|
||||
@@ -10,7 +9,7 @@ internal i32 count = 20;
|
||||
internal i32 *array = nullptr;
|
||||
|
||||
TestFuncResult test_arena_init(void) {
|
||||
bool result = wapp_mem_arena_init(&arena, ARENA_CAPACITY);
|
||||
b32 result = wapp_mem_arena_init(&arena, ARENA_CAPACITY);
|
||||
|
||||
return wapp_tester_result(result);
|
||||
}
|
||||
@@ -18,7 +17,7 @@ TestFuncResult test_arena_init(void) {
|
||||
TestFuncResult test_arena_init_succeeds_when_reserving_very_large_size(void) {
|
||||
Arena *large_arena = nullptr;
|
||||
u64 capacity = GB(512);
|
||||
bool result = wapp_mem_arena_init(&large_arena, capacity);
|
||||
b32 result = wapp_mem_arena_init(&large_arena, capacity);
|
||||
if (result) {
|
||||
wapp_mem_arena_destroy(&large_arena);
|
||||
}
|
||||
@@ -28,7 +27,7 @@ TestFuncResult test_arena_init_succeeds_when_reserving_very_large_size(void) {
|
||||
|
||||
TestFuncResult test_arena_alloc_succeeds_when_within_capacity(void) {
|
||||
array = (i32 *)wapp_mem_arena_alloc(arena, count * sizeof(i32));
|
||||
bool result = array != nullptr;
|
||||
b32 result = array != nullptr;
|
||||
|
||||
for (i32 i = 0; i < count; ++i) {
|
||||
array[i] = i * 10;
|
||||
@@ -39,7 +38,7 @@ TestFuncResult test_arena_alloc_succeeds_when_within_capacity(void) {
|
||||
|
||||
TestFuncResult test_arena_alloc_fails_when_over_capacity(void) {
|
||||
u8 *bytes = (u8 *)wapp_mem_arena_alloc(arena, ARENA_CAPACITY * 2);
|
||||
bool result = bytes == nullptr;
|
||||
b32 result = bytes == nullptr;
|
||||
|
||||
return wapp_tester_result(result);
|
||||
}
|
||||
@@ -92,7 +91,7 @@ TestFuncResult test_arena_realloc_smaller_size(void) {
|
||||
|
||||
TestFuncResult test_arena_clear(void) {
|
||||
wapp_mem_arena_clear(arena);
|
||||
bool result = true;
|
||||
b32 result = true;
|
||||
|
||||
for (i32 i = 0; i < count; ++i) {
|
||||
if (array[i] != 0) {
|
||||
@@ -106,7 +105,7 @@ TestFuncResult test_arena_clear(void) {
|
||||
|
||||
TestFuncResult test_arena_destroy(void) {
|
||||
wapp_mem_arena_destroy(&arena);
|
||||
bool result = arena == nullptr;
|
||||
b32 result = arena == nullptr;
|
||||
|
||||
return wapp_tester_result(result);
|
||||
}
|
||||
|
@@ -1,9 +1,8 @@
|
||||
#include "test_i32_array.h"
|
||||
#include "wapp.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
TestFuncResult test_i32_array(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
I32Array array = wapp_i32_array(1, 2, 3, 4, 5, 6, 7);
|
||||
result = array.count == 7 && array.capacity == 16;
|
||||
@@ -11,7 +10,7 @@ TestFuncResult test_i32_array(void) {
|
||||
i32 *item;
|
||||
u64 count = array.count;
|
||||
u64 index = 0;
|
||||
bool running = true;
|
||||
b32 running = true;
|
||||
while (running) {
|
||||
item = wapp_i32_array_get(&array, index);
|
||||
result = result && item && (*item == (i32)(index + 1));
|
||||
@@ -24,7 +23,7 @@ TestFuncResult test_i32_array(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_with_capacity(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
I32Array array = wapp_i32_array_with_capacity(64);
|
||||
result = array.count == 0 && array.capacity == 64;
|
||||
@@ -33,14 +32,14 @@ TestFuncResult test_i32_array_with_capacity(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_get(void) {
|
||||
bool result = true;
|
||||
b32 result = true;
|
||||
|
||||
I32Array array = wapp_i32_array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
|
||||
i32 *item;
|
||||
u64 count = array.count;
|
||||
u64 index = 0;
|
||||
bool running = true;
|
||||
b32 running = true;
|
||||
while (running) {
|
||||
item = wapp_i32_array_get(&array, index);
|
||||
result = result && item && (*item == (i32)index);
|
||||
@@ -53,14 +52,14 @@ TestFuncResult test_i32_array_get(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_set(void) {
|
||||
bool result = true;
|
||||
b32 result = true;
|
||||
|
||||
I32Array array = wapp_i32_array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
|
||||
i32 *item;
|
||||
u64 count = array.count;
|
||||
u64 index = 0;
|
||||
bool running = true;
|
||||
b32 running = true;
|
||||
while (running) {
|
||||
i32 num = (i32)(index * 2);
|
||||
wapp_i32_array_set(&array, index, &num);
|
||||
@@ -75,7 +74,7 @@ TestFuncResult test_i32_array_set(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_append_capped(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
I32Array array = wapp_i32_array_with_capacity(64);
|
||||
wapp_i32_array_append_capped(&array, &((i32){10}));
|
||||
@@ -93,7 +92,7 @@ TestFuncResult test_i32_array_append_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_extend_capped(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
I32Array array1 = wapp_i32_array(1, 2, 3, 4);
|
||||
I32Array array2 = wapp_i32_array(10, 20);
|
||||
@@ -108,7 +107,7 @@ TestFuncResult test_i32_array_extend_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_clear(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
I32Array array = wapp_i32_array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
result = array.count == 9;
|
||||
@@ -121,7 +120,7 @@ TestFuncResult test_i32_array_clear(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_pop(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
I32Array array1 = wapp_i32_array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
I32Array array2 = wapp_i32_array_with_capacity(32);
|
||||
@@ -135,7 +134,7 @@ TestFuncResult test_i32_array_pop(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_copy_capped(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
I32Array src = wapp_i32_array(1, 2, 3, 4, 5);
|
||||
I32Array dst1 = wapp_i32_array(1, 2, 3, 4, 5, 6);
|
||||
@@ -146,7 +145,7 @@ TestFuncResult test_i32_array_copy_capped(void) {
|
||||
result = dst1.count == expected_count;
|
||||
|
||||
u64 index = 0;
|
||||
bool running = true;
|
||||
b32 running = true;
|
||||
while (running) {
|
||||
result = result && (*wapp_i32_array_get(&src, index) == *wapp_i32_array_get(&dst1, index));
|
||||
|
||||
@@ -171,7 +170,7 @@ TestFuncResult test_i32_array_copy_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_alloc_capacity(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(MB(4));
|
||||
u64 capacity = 32;
|
||||
@@ -185,7 +184,7 @@ TestFuncResult test_i32_array_alloc_capacity(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_append_alloc(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(MB(4));
|
||||
I32Array array1 = wapp_i32_array(1, 2, 3, 4, 5, 6, 7, 8);
|
||||
@@ -196,7 +195,7 @@ TestFuncResult test_i32_array_append_alloc(void) {
|
||||
|
||||
u64 count = 4;
|
||||
u64 index = 0;
|
||||
bool running = true;
|
||||
b32 running = true;
|
||||
while (running) {
|
||||
i32 num = (i32)index;
|
||||
arr_ptr = wapp_i32_array_append_alloc(&allocator, &array2, &num);
|
||||
@@ -212,7 +211,7 @@ TestFuncResult test_i32_array_append_alloc(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_extend_alloc(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(MB(4));
|
||||
I32Array array1 = wapp_i32_array(1, 2, 3, 4, 5, 6, 7, 8);
|
||||
@@ -231,7 +230,7 @@ TestFuncResult test_i32_array_extend_alloc(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_copy_alloc(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(MB(4));
|
||||
I32Array src = wapp_i32_array(1, 2, 3, 4, 5);
|
||||
@@ -244,7 +243,7 @@ TestFuncResult test_i32_array_copy_alloc(void) {
|
||||
result = array_ptr->count == expected_count && array_ptr == &dst1;
|
||||
|
||||
u64 index = 0;
|
||||
bool running = true;
|
||||
b32 running = true;
|
||||
while (running) {
|
||||
result = result && (*wapp_i32_array_get(&src, index) == *wapp_i32_array_get(array_ptr, index));
|
||||
|
||||
|
@@ -1,9 +1,8 @@
|
||||
#include "test_i32_array.h"
|
||||
#include "wapp.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
TestFuncResult test_i32_array(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
I32Array array = wapp_i32_array(1, 2, 3, 4, 5, 6, 7);
|
||||
result = array.count == 7 && array.capacity == 16;
|
||||
@@ -11,7 +10,7 @@ TestFuncResult test_i32_array(void) {
|
||||
i32 *item;
|
||||
u64 count = array.count;
|
||||
u64 index = 0;
|
||||
bool running = true;
|
||||
b32 running = true;
|
||||
while (running) {
|
||||
item = wapp_i32_array_get(&array, index);
|
||||
result = result && item && (*item == (i32)(index + 1));
|
||||
@@ -24,7 +23,7 @@ TestFuncResult test_i32_array(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_with_capacity(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
I32Array array = wapp_i32_array_with_capacity(64);
|
||||
result = array.count == 0 && array.capacity == 64;
|
||||
@@ -33,14 +32,14 @@ TestFuncResult test_i32_array_with_capacity(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_get(void) {
|
||||
bool result = true;
|
||||
b32 result = true;
|
||||
|
||||
I32Array array = wapp_i32_array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
|
||||
i32 *item;
|
||||
u64 count = array.count;
|
||||
u64 index = 0;
|
||||
bool running = true;
|
||||
b32 running = true;
|
||||
while (running) {
|
||||
item = wapp_i32_array_get(&array, index);
|
||||
result = result && item && (*item == (i32)index);
|
||||
@@ -53,14 +52,14 @@ TestFuncResult test_i32_array_get(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_set(void) {
|
||||
bool result = true;
|
||||
b32 result = true;
|
||||
|
||||
I32Array array = wapp_i32_array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
|
||||
i32 *item;
|
||||
u64 count = array.count;
|
||||
u64 index = 0;
|
||||
bool running = true;
|
||||
b32 running = true;
|
||||
while (running) {
|
||||
i32 num = (i32)(index * 2);
|
||||
wapp_i32_array_set(&array, index, &num);
|
||||
@@ -75,7 +74,7 @@ TestFuncResult test_i32_array_set(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_append_capped(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
I32Array array = wapp_i32_array_with_capacity(64);
|
||||
i32 item1 = 10;
|
||||
@@ -95,7 +94,7 @@ TestFuncResult test_i32_array_append_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_extend_capped(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
I32Array array1 = wapp_i32_array(1, 2, 3, 4);
|
||||
I32Array array2 = wapp_i32_array(10, 20);
|
||||
@@ -110,7 +109,7 @@ TestFuncResult test_i32_array_extend_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_clear(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
I32Array array = wapp_i32_array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
result = array.count == 9;
|
||||
@@ -123,7 +122,7 @@ TestFuncResult test_i32_array_clear(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_pop(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
I32Array array1 = wapp_i32_array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
I32Array array2 = wapp_i32_array_with_capacity(32);
|
||||
@@ -137,7 +136,7 @@ TestFuncResult test_i32_array_pop(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_copy_capped(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
I32Array src = wapp_i32_array(1, 2, 3, 4, 5);
|
||||
I32Array dst1 = wapp_i32_array(1, 2, 3, 4, 5, 6);
|
||||
@@ -148,7 +147,7 @@ TestFuncResult test_i32_array_copy_capped(void) {
|
||||
result = dst1.count == expected_count;
|
||||
|
||||
u64 index = 0;
|
||||
bool running = true;
|
||||
b32 running = true;
|
||||
while (running) {
|
||||
result = result && (*wapp_i32_array_get(&src, index) == *wapp_i32_array_get(&dst1, index));
|
||||
|
||||
@@ -173,7 +172,7 @@ TestFuncResult test_i32_array_copy_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_alloc_capacity(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(MB(4));
|
||||
u64 capacity = 32;
|
||||
@@ -187,7 +186,7 @@ TestFuncResult test_i32_array_alloc_capacity(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_append_alloc(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(MB(4));
|
||||
I32Array array1 = wapp_i32_array(1, 2, 3, 4, 5, 6, 7, 8);
|
||||
@@ -199,7 +198,7 @@ TestFuncResult test_i32_array_append_alloc(void) {
|
||||
|
||||
u64 count = 4;
|
||||
u64 index = 0;
|
||||
bool running = true;
|
||||
b32 running = true;
|
||||
while (running) {
|
||||
i32 num = (i32)index;
|
||||
arr_ptr = wapp_i32_array_append_alloc(&allocator, &array2, &num);
|
||||
@@ -215,7 +214,7 @@ TestFuncResult test_i32_array_append_alloc(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_extend_alloc(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(MB(4));
|
||||
I32Array array1 = wapp_i32_array(1, 2, 3, 4, 5, 6, 7, 8);
|
||||
@@ -234,7 +233,7 @@ TestFuncResult test_i32_array_extend_alloc(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_copy_alloc(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(MB(4));
|
||||
I32Array src = wapp_i32_array(1, 2, 3, 4, 5);
|
||||
@@ -247,7 +246,7 @@ TestFuncResult test_i32_array_copy_alloc(void) {
|
||||
result = array_ptr->count == expected_count && array_ptr == &dst1;
|
||||
|
||||
u64 index = 0;
|
||||
bool running = true;
|
||||
b32 running = true;
|
||||
while (running) {
|
||||
result = result && (*wapp_i32_array_get(&src, index) == *wapp_i32_array_get(array_ptr, index));
|
||||
|
||||
|
@@ -2,20 +2,19 @@
|
||||
#include "wapp.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define MAIN_BUF_SIZE 4096
|
||||
#define TMP_BUF_SIZE 1024
|
||||
|
||||
TestFuncResult test_cpath_join_path(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 expected = wapp_str8_buf(MAIN_BUF_SIZE);
|
||||
Str8 out = wapp_str8_buf(MAIN_BUF_SIZE);
|
||||
Str8 tmp = wapp_str8_buf(TMP_BUF_SIZE);
|
||||
|
||||
wapp_str8_format(&expected, "%chome%cabdelrahman%cDocuments", PATH_SEP, PATH_SEP, PATH_SEP);
|
||||
wapp_str8_format(&tmp, "%c", PATH_SEP);
|
||||
wapp_str8_format(&expected, "%chome%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wapp_str8_format(&tmp, "%c", WAPP_PATH_SEP);
|
||||
|
||||
Str8List parts = {0};
|
||||
wapp_str8_list_push_back(&parts, &wapp_str8_node_from_str8(tmp));
|
||||
@@ -28,7 +27,7 @@ TestFuncResult test_cpath_join_path(void) {
|
||||
|
||||
wapp_str8_list_pop_front(&parts);
|
||||
|
||||
wapp_str8_format(&expected, "home%cabdelrahman%cDocuments", PATH_SEP, PATH_SEP);
|
||||
wapp_str8_format(&expected, "home%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
|
||||
wapp_cpath_join_path(&out, &parts);
|
||||
result = result && wapp_str8_equal(&out, &expected);
|
||||
@@ -37,27 +36,27 @@ TestFuncResult test_cpath_join_path(void) {
|
||||
wapp_str8_list_pop_front(&parts);
|
||||
wapp_str8_list_push_front(&parts, &wapp_str8_node_from_str8(tmp));
|
||||
|
||||
wapp_str8_format(&expected, "%chome%cabdelrahman%cDocuments", PATH_SEP, PATH_SEP, PATH_SEP);
|
||||
wapp_str8_format(&expected, "%chome%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
|
||||
wapp_cpath_join_path(&out, &parts);
|
||||
result = result && wapp_str8_equal(&out, &expected);
|
||||
|
||||
wapp_str8_format(&tmp, "home%c", PATH_SEP);
|
||||
wapp_str8_format(&tmp, "home%c", WAPP_PATH_SEP);
|
||||
wapp_str8_list_pop_front(&parts);
|
||||
wapp_str8_list_push_front(&parts, &wapp_str8_node_from_cstr("home"));
|
||||
|
||||
wapp_str8_format(&expected, "home%cabdelrahman%cDocuments", PATH_SEP, PATH_SEP);
|
||||
wapp_str8_format(&expected, "home%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
|
||||
wapp_cpath_join_path(&out, &parts);
|
||||
result = result && wapp_str8_equal(&out, &expected);
|
||||
|
||||
wapp_str8_list_empty(&parts);
|
||||
|
||||
wapp_str8_format(&tmp, "%chome", PATH_SEP);
|
||||
wapp_str8_format(&tmp, "%chome", WAPP_PATH_SEP);
|
||||
wapp_str8_list_push_back(&parts, &wapp_str8_node_from_str8(tmp));
|
||||
wapp_str8_list_push_back(&parts, &wapp_str8_node_from_cstr(""));
|
||||
|
||||
wapp_str8_format(&expected, "%chome", PATH_SEP);
|
||||
wapp_str8_format(&expected, "%chome", WAPP_PATH_SEP);
|
||||
|
||||
wapp_cpath_join_path(&out, &parts);
|
||||
result = result && wapp_str8_equal(&out, &expected);
|
||||
@@ -87,15 +86,15 @@ TestFuncResult test_cpath_dirname(void) {
|
||||
return wapp_tester_result(false);
|
||||
}
|
||||
|
||||
bool result;
|
||||
b32 result;
|
||||
Str8 *output = NULL;
|
||||
|
||||
Str8 expected = wapp_str8_buf(MAIN_BUF_SIZE);
|
||||
Str8 tmp = wapp_str8_buf(TMP_BUF_SIZE);
|
||||
|
||||
// CASE 1
|
||||
wapp_str8_format(&tmp, "%c", PATH_SEP);
|
||||
wapp_str8_format(&expected, "%c", PATH_SEP);
|
||||
wapp_str8_format(&tmp, "%c", WAPP_PATH_SEP);
|
||||
wapp_str8_format(&expected, "%c", WAPP_PATH_SEP);
|
||||
|
||||
output = wapp_cpath_dirname(&arena, &tmp);
|
||||
result = output != NULL && wapp_str8_equal(output, &expected);
|
||||
@@ -111,15 +110,15 @@ TestFuncResult test_cpath_dirname(void) {
|
||||
result = result && output != NULL && wapp_str8_equal(output, &expected);
|
||||
|
||||
// CASE 4
|
||||
wapp_str8_format(&tmp, "%chome%ctest", PATH_SEP, PATH_SEP);
|
||||
wapp_str8_format(&expected, "%chome", PATH_SEP);
|
||||
wapp_str8_format(&tmp, "%chome%ctest", WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wapp_str8_format(&expected, "%chome", WAPP_PATH_SEP);
|
||||
|
||||
output = wapp_cpath_dirname(&arena, &tmp);
|
||||
result = result && output != NULL && wapp_str8_equal(output, &expected);
|
||||
|
||||
// CASE 5
|
||||
wapp_str8_format(&tmp, "%chome%ctest%c", PATH_SEP, PATH_SEP, PATH_SEP);
|
||||
wapp_str8_format(&expected, "%chome", PATH_SEP);
|
||||
wapp_str8_format(&tmp, "%chome%ctest%c", WAPP_PATH_SEP, WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wapp_str8_format(&expected, "%chome", WAPP_PATH_SEP);
|
||||
|
||||
output = wapp_cpath_dirname(&arena, &tmp);
|
||||
result = result && output != NULL && wapp_str8_equal(output, &expected);
|
||||
@@ -135,42 +134,42 @@ TestFuncResult test_cpath_dirup(void) {
|
||||
return wapp_tester_result(false);
|
||||
}
|
||||
|
||||
bool result;
|
||||
b32 result;
|
||||
Str8 *output = NULL;
|
||||
|
||||
Str8 expected = wapp_str8_buf(MAIN_BUF_SIZE);
|
||||
Str8 tmp = wapp_str8_buf(TMP_BUF_SIZE);
|
||||
|
||||
// CASE 1
|
||||
wapp_str8_format(&tmp, "%c", PATH_SEP);
|
||||
wapp_str8_format(&expected, "%c", PATH_SEP);
|
||||
wapp_str8_format(&tmp, "%c", WAPP_PATH_SEP);
|
||||
wapp_str8_format(&expected, "%c", WAPP_PATH_SEP);
|
||||
|
||||
output = wapp_cpath_dirup(&arena, &tmp, 3);
|
||||
result = output != NULL && wapp_str8_equal(output, &expected);
|
||||
|
||||
// CASE 2
|
||||
wapp_str8_format(&tmp, "%chome%cabdelrahman%cDocuments", PATH_SEP, PATH_SEP, PATH_SEP);
|
||||
wapp_str8_format(&expected, "%c", PATH_SEP);
|
||||
wapp_str8_format(&tmp, "%chome%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wapp_str8_format(&expected, "%c", WAPP_PATH_SEP);
|
||||
|
||||
output = wapp_cpath_dirup(&arena, &tmp, 3);
|
||||
result = result && output != NULL && wapp_str8_equal(output, &expected);
|
||||
|
||||
// CASE 3
|
||||
wapp_str8_format(&tmp, "home%cabdelrahman%cDocuments", PATH_SEP, PATH_SEP);
|
||||
wapp_str8_format(&tmp, "home%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wapp_str8_copy_cstr_capped(&expected, ".");
|
||||
|
||||
output = wapp_cpath_dirup(&arena, &tmp, 3);
|
||||
result = result && output != NULL && wapp_str8_equal(output, &expected);
|
||||
|
||||
// CASE 4
|
||||
wapp_str8_format(&tmp, "%chome%cabdelrahman%cDocuments", PATH_SEP, PATH_SEP, PATH_SEP);
|
||||
wapp_str8_format(&expected, "%chome", PATH_SEP);
|
||||
wapp_str8_format(&tmp, "%chome%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wapp_str8_format(&expected, "%chome", WAPP_PATH_SEP);
|
||||
|
||||
output = wapp_cpath_dirup(&arena, &tmp, 2);
|
||||
result = result && output != NULL && wapp_str8_equal(output, &expected);
|
||||
|
||||
// CASE 5
|
||||
wapp_str8_format(&tmp, "home%cabdelrahman%cDocuments", PATH_SEP, PATH_SEP);
|
||||
wapp_str8_format(&tmp, "home%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wapp_str8_copy_cstr_capped(&expected, "home");
|
||||
|
||||
output = wapp_cpath_dirup(&arena, &tmp, 2);
|
||||
|
@@ -2,20 +2,19 @@
|
||||
#include "wapp.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define MAIN_BUF_SIZE 4096
|
||||
#define TMP_BUF_SIZE 1024
|
||||
|
||||
TestFuncResult test_cpath_join_path(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 expected = wapp_str8_buf(MAIN_BUF_SIZE);
|
||||
Str8 out = wapp_str8_buf(MAIN_BUF_SIZE);
|
||||
Str8 tmp = wapp_str8_buf(TMP_BUF_SIZE);
|
||||
|
||||
wapp_str8_format(&expected, "%chome%cabdelrahman%cDocuments", PATH_SEP, PATH_SEP, PATH_SEP);
|
||||
wapp_str8_format(&tmp, "%c", PATH_SEP);
|
||||
wapp_str8_format(&expected, "%chome%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wapp_str8_format(&tmp, "%c", WAPP_PATH_SEP);
|
||||
|
||||
Str8List parts = {};
|
||||
|
||||
@@ -36,7 +35,7 @@ TestFuncResult test_cpath_join_path(void) {
|
||||
|
||||
wapp_str8_list_pop_front(&parts);
|
||||
|
||||
wapp_str8_format(&expected, "home%cabdelrahman%cDocuments", PATH_SEP, PATH_SEP);
|
||||
wapp_str8_format(&expected, "home%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
|
||||
wapp_cpath_join_path(&out, &parts);
|
||||
result = result && wapp_str8_equal(&out, &expected);
|
||||
@@ -48,25 +47,25 @@ TestFuncResult test_cpath_join_path(void) {
|
||||
Str8Node tmp_node_2 = wapp_str8_node_from_str8(tmp);
|
||||
wapp_str8_list_push_front(&parts, &tmp_node_2);
|
||||
|
||||
wapp_str8_format(&expected, "%chome%cabdelrahman%cDocuments", PATH_SEP, PATH_SEP, PATH_SEP);
|
||||
wapp_str8_format(&expected, "%chome%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
|
||||
wapp_cpath_join_path(&out, &parts);
|
||||
result = result && wapp_str8_equal(&out, &expected);
|
||||
|
||||
wapp_str8_format(&tmp, "home%c", PATH_SEP);
|
||||
wapp_str8_format(&tmp, "home%c", WAPP_PATH_SEP);
|
||||
wapp_str8_list_pop_front(&parts);
|
||||
|
||||
Str8Node home_node_2 = wapp_str8_node_from_cstr("home");
|
||||
wapp_str8_list_push_front(&parts, &home_node_2);
|
||||
|
||||
wapp_str8_format(&expected, "home%cabdelrahman%cDocuments", PATH_SEP, PATH_SEP);
|
||||
wapp_str8_format(&expected, "home%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
|
||||
wapp_cpath_join_path(&out, &parts);
|
||||
result = result && wapp_str8_equal(&out, &expected);
|
||||
|
||||
wapp_str8_list_empty(&parts);
|
||||
|
||||
wapp_str8_format(&tmp, "%chome", PATH_SEP);
|
||||
wapp_str8_format(&tmp, "%chome", WAPP_PATH_SEP);
|
||||
|
||||
Str8Node tmp_node_3 = wapp_str8_node_from_str8(tmp);
|
||||
wapp_str8_list_push_back(&parts, &tmp_node_3);
|
||||
@@ -74,7 +73,7 @@ TestFuncResult test_cpath_join_path(void) {
|
||||
Str8Node empty_node = wapp_str8_node_from_cstr("");
|
||||
wapp_str8_list_push_back(&parts, &empty_node);
|
||||
|
||||
wapp_str8_format(&expected, "%chome", PATH_SEP);
|
||||
wapp_str8_format(&expected, "%chome", WAPP_PATH_SEP);
|
||||
|
||||
wapp_cpath_join_path(&out, &parts);
|
||||
result = result && wapp_str8_equal(&out, &expected);
|
||||
@@ -108,15 +107,15 @@ TestFuncResult test_cpath_dirname(void) {
|
||||
return wapp_tester_result(false);
|
||||
}
|
||||
|
||||
bool result;
|
||||
b32 result;
|
||||
Str8 *output = nullptr;
|
||||
|
||||
Str8 expected = wapp_str8_buf(MAIN_BUF_SIZE);
|
||||
Str8 tmp = wapp_str8_buf(TMP_BUF_SIZE);
|
||||
|
||||
// CASE 1
|
||||
wapp_str8_format(&tmp, "%c", PATH_SEP);
|
||||
wapp_str8_format(&expected, "%c", PATH_SEP);
|
||||
wapp_str8_format(&tmp, "%c", WAPP_PATH_SEP);
|
||||
wapp_str8_format(&expected, "%c", WAPP_PATH_SEP);
|
||||
|
||||
output = wapp_cpath_dirname(&arena, &tmp);
|
||||
result = output != nullptr && wapp_str8_equal(output, &expected);
|
||||
@@ -134,15 +133,15 @@ TestFuncResult test_cpath_dirname(void) {
|
||||
result = result && output != nullptr && wapp_str8_equal(output, &expected);
|
||||
|
||||
// CASE 4
|
||||
wapp_str8_format(&tmp, "%chome%ctest", PATH_SEP, PATH_SEP);
|
||||
wapp_str8_format(&expected, "%chome", PATH_SEP);
|
||||
wapp_str8_format(&tmp, "%chome%ctest", WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wapp_str8_format(&expected, "%chome", WAPP_PATH_SEP);
|
||||
|
||||
output = wapp_cpath_dirname(&arena, &tmp);
|
||||
result = result && output != nullptr && wapp_str8_equal(output, &expected);
|
||||
|
||||
// CASE 5
|
||||
wapp_str8_format(&tmp, "%chome%ctest%c", PATH_SEP, PATH_SEP, PATH_SEP);
|
||||
wapp_str8_format(&expected, "%chome", PATH_SEP);
|
||||
wapp_str8_format(&tmp, "%chome%ctest%c", WAPP_PATH_SEP, WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wapp_str8_format(&expected, "%chome", WAPP_PATH_SEP);
|
||||
|
||||
output = wapp_cpath_dirname(&arena, &tmp);
|
||||
result = result && output != nullptr && wapp_str8_equal(output, &expected);
|
||||
@@ -158,42 +157,42 @@ TestFuncResult test_cpath_dirup(void) {
|
||||
return wapp_tester_result(false);
|
||||
}
|
||||
|
||||
bool result;
|
||||
b32 result;
|
||||
Str8 *output = nullptr;
|
||||
|
||||
Str8 expected = wapp_str8_buf(MAIN_BUF_SIZE);
|
||||
Str8 tmp = wapp_str8_buf(TMP_BUF_SIZE);
|
||||
|
||||
// CASE 1
|
||||
wapp_str8_format(&tmp, "%c", PATH_SEP);
|
||||
wapp_str8_format(&expected, "%c", PATH_SEP);
|
||||
wapp_str8_format(&tmp, "%c", WAPP_PATH_SEP);
|
||||
wapp_str8_format(&expected, "%c", WAPP_PATH_SEP);
|
||||
|
||||
output = wapp_cpath_dirup(&arena, &tmp, 3);
|
||||
result = output != nullptr && wapp_str8_equal(output, &expected);
|
||||
|
||||
// CASE 2
|
||||
wapp_str8_format(&tmp, "%chome%cabdelrahman%cDocuments", PATH_SEP, PATH_SEP, PATH_SEP);
|
||||
wapp_str8_format(&expected, "%c", PATH_SEP);
|
||||
wapp_str8_format(&tmp, "%chome%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wapp_str8_format(&expected, "%c", WAPP_PATH_SEP);
|
||||
|
||||
output = wapp_cpath_dirup(&arena, &tmp, 3);
|
||||
result = result && output != nullptr && wapp_str8_equal(output, &expected);
|
||||
|
||||
// CASE 3
|
||||
wapp_str8_format(&tmp, "home%cabdelrahman%cDocuments", PATH_SEP, PATH_SEP);
|
||||
wapp_str8_format(&tmp, "home%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wapp_str8_copy_cstr_capped(&expected, ".");
|
||||
|
||||
output = wapp_cpath_dirup(&arena, &tmp, 3);
|
||||
result = result && output != nullptr && wapp_str8_equal(output, &expected);
|
||||
|
||||
// CASE 4
|
||||
wapp_str8_format(&tmp, "%chome%cabdelrahman%cDocuments", PATH_SEP, PATH_SEP, PATH_SEP);
|
||||
wapp_str8_format(&expected, "%chome", PATH_SEP);
|
||||
wapp_str8_format(&tmp, "%chome%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wapp_str8_format(&expected, "%chome", WAPP_PATH_SEP);
|
||||
|
||||
output = wapp_cpath_dirup(&arena, &tmp, 2);
|
||||
result = result && output != nullptr && wapp_str8_equal(output, &expected);
|
||||
|
||||
// CASE 5
|
||||
wapp_str8_format(&tmp, "home%cabdelrahman%cDocuments", PATH_SEP, PATH_SEP);
|
||||
wapp_str8_format(&tmp, "home%cabdelrahman%cDocuments", WAPP_PATH_SEP, WAPP_PATH_SEP);
|
||||
wapp_str8_copy_cstr_capped(&expected, "home");
|
||||
|
||||
output = wapp_cpath_dirup(&arena, &tmp, 2);
|
||||
|
@@ -1,6 +1,5 @@
|
||||
#include "test_shell_commander.h"
|
||||
#include "wapp.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -11,7 +10,7 @@ TestFuncResult test_commander_cmd_success(void) {
|
||||
wapp_str8_list_push_back(&cmd, &wapp_str8_node_from_cstr("hello world"));
|
||||
|
||||
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, NULL, &cmd);
|
||||
bool succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
|
||||
b32 succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
|
||||
result.error == SHELL_ERR_NO_ERROR;
|
||||
|
||||
return wapp_tester_result(succeeded);
|
||||
@@ -22,7 +21,7 @@ TestFuncResult test_commander_cmd_failure(void) {
|
||||
wapp_str8_list_push_back(&cmd, &wapp_str8_node_from_cstr("grep"));
|
||||
|
||||
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, NULL, &cmd);
|
||||
bool failed = result.exited && result.exit_code != EXIT_SUCCESS &&
|
||||
b32 failed = result.exited && result.exit_code != EXIT_SUCCESS &&
|
||||
result.error == SHELL_ERR_NO_ERROR;
|
||||
|
||||
return wapp_tester_result(failed);
|
||||
@@ -39,7 +38,7 @@ TestFuncResult test_commander_cmd_out_buf_success(void) {
|
||||
wapp_str8_list_push_back(&cmd, &wapp_str8_node_from_cstr(msg));
|
||||
|
||||
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, &buf, &cmd);
|
||||
bool succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
|
||||
b32 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);
|
||||
@@ -56,7 +55,7 @@ TestFuncResult test_commander_cmd_out_buf_failure(void) {
|
||||
wapp_str8_list_push_back(&cmd, &wapp_str8_node_from_cstr(msg));
|
||||
|
||||
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, &buf, &cmd);
|
||||
bool failed = !result.exited && result.exit_code != EXIT_SUCCESS &&
|
||||
b32 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);
|
||||
|
@@ -1,6 +1,5 @@
|
||||
#include "test_shell_commander.h"
|
||||
#include "wapp.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -13,7 +12,7 @@ TestFuncResult test_commander_cmd_success(void) {
|
||||
wapp_str8_list_push_back(&cmd, &msg);
|
||||
|
||||
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, nullptr, &cmd);
|
||||
bool succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
|
||||
b32 succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
|
||||
result.error == SHELL_ERR_NO_ERROR;
|
||||
|
||||
return wapp_tester_result(succeeded);
|
||||
@@ -25,7 +24,7 @@ TestFuncResult test_commander_cmd_failure(void) {
|
||||
wapp_str8_list_push_back(&cmd, &grep);
|
||||
|
||||
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_DISCARD, nullptr, &cmd);
|
||||
bool failed = result.exited && result.exit_code != EXIT_SUCCESS &&
|
||||
b32 failed = result.exited && result.exit_code != EXIT_SUCCESS &&
|
||||
result.error == SHELL_ERR_NO_ERROR;
|
||||
|
||||
return wapp_tester_result(failed);
|
||||
@@ -44,7 +43,7 @@ TestFuncResult test_commander_cmd_out_buf_success(void) {
|
||||
wapp_str8_list_push_back(&cmd, &arg);
|
||||
|
||||
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, &buf, &cmd);
|
||||
bool succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
|
||||
b32 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);
|
||||
@@ -63,7 +62,7 @@ TestFuncResult test_commander_cmd_out_buf_failure(void) {
|
||||
wapp_str8_list_push_back(&cmd, &arg);
|
||||
|
||||
CMDResult result = wapp_shell_commander_execute(SHELL_OUTPUT_CAPTURE, &buf, &cmd);
|
||||
bool failed = !result.exited && result.exit_code != EXIT_SUCCESS &&
|
||||
b32 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);
|
||||
|
@@ -1,11 +1,10 @@
|
||||
#include "test_str8.h"
|
||||
#include "wapp.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#define ARRLEN(ARR) (sizeof(ARR) / sizeof(ARR[0]))
|
||||
|
||||
TestFuncResult test_str8_lit(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 s1 = wapp_str8_lit("Hello world");
|
||||
result = s1.capacity == 22 && s1.capacity != s1.size;
|
||||
@@ -32,7 +31,7 @@ TestFuncResult test_str8_lit(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_lit_ro(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8RO s1 = wapp_str8_lit_ro("Hello world");
|
||||
result = s1.capacity == 11 && s1.capacity == s1.size;
|
||||
@@ -59,7 +58,7 @@ TestFuncResult test_str8_lit_ro(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_buf(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 s1 = wapp_str8_buf(1024);
|
||||
result = s1.capacity == 1024 && s1.size == 0;
|
||||
@@ -77,7 +76,7 @@ TestFuncResult test_str8_buf(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_alloc_buf(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(KB(100));
|
||||
if (wapp_mem_allocator_invalid(&allocator)) {
|
||||
return wapp_tester_result(false);
|
||||
@@ -105,7 +104,7 @@ TEST_ALLOC_BUF_CLEANUP:
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_alloc_cstr(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(KB(100));
|
||||
if (wapp_mem_allocator_invalid(&allocator)) {
|
||||
return wapp_tester_result(false);
|
||||
@@ -126,7 +125,7 @@ TestFuncResult test_str8_alloc_cstr(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_alloc_str8(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(KB(100));
|
||||
if (wapp_mem_allocator_invalid(&allocator)) {
|
||||
return wapp_tester_result(false);
|
||||
@@ -146,7 +145,7 @@ TestFuncResult test_str8_alloc_str8(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_alloc_substr(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(KB(100));
|
||||
if (wapp_mem_allocator_invalid(&allocator)) {
|
||||
return wapp_tester_result(false);
|
||||
@@ -166,7 +165,7 @@ TestFuncResult test_str8_alloc_substr(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_get_index_within_bounds(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8RO s1 = wapp_str8_lit_ro("Hello world");
|
||||
result = wapp_str8_get(&s1, 4) == 'o';
|
||||
@@ -194,12 +193,12 @@ TestFuncResult test_str8_get_index_within_bounds(void) {
|
||||
|
||||
TestFuncResult test_str8_get_index_out_of_bounds(void) {
|
||||
Str8 s1 = wapp_str8_lit("Hello world");
|
||||
bool result = wapp_str8_get(&s1, 20) == '\0';
|
||||
b32 result = wapp_str8_get(&s1, 20) == '\0';
|
||||
return wapp_tester_result(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_set(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 s1 = wapp_str8_lit("Hello world");
|
||||
wapp_str8_set(&s1, 4, 'f');
|
||||
@@ -233,7 +232,7 @@ TestFuncResult test_str8_set(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_push_back(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 expected = wapp_str8_lit("Abdelrahman");
|
||||
Str8 buf = wapp_str8_buf(64);
|
||||
@@ -255,7 +254,7 @@ TestFuncResult test_str8_push_back(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_equal(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8RO s1 = wapp_str8_lit_ro("hello");
|
||||
Str8RO s2 = wapp_str8_lit_ro("hell");
|
||||
@@ -270,7 +269,7 @@ TestFuncResult test_str8_equal(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_slice(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Str8 s = wapp_str8_lit("Different strokes for different folks");
|
||||
|
||||
Str8RO sub1 = wapp_str8_slice(&s, 3, 9);
|
||||
@@ -289,7 +288,7 @@ TestFuncResult test_str8_slice(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_alloc_concat(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("Hello world");
|
||||
@@ -312,7 +311,7 @@ TestFuncResult test_str8_alloc_concat(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_concat_capped(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 str = wapp_str8_lit("Hello world");
|
||||
Str8 suffix1 = wapp_str8_lit(" from me.");
|
||||
@@ -330,7 +329,7 @@ TestFuncResult test_str8_concat_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_copy_cstr_capped(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 buf = wapp_str8_buf(32);
|
||||
const char *src1 = "Hello world";
|
||||
@@ -348,7 +347,7 @@ TestFuncResult test_str8_copy_cstr_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_copy_str8_capped(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 buf = wapp_str8_buf(32);
|
||||
Str8RO src1 = wapp_str8_lit_ro("Hello world");
|
||||
@@ -365,7 +364,7 @@ TestFuncResult test_str8_copy_str8_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_format(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 buf = wapp_str8_buf(128);
|
||||
Str8 expected = wapp_str8_lit("My name is Abdelrahman and I am 35 years old");
|
||||
@@ -378,7 +377,7 @@ TestFuncResult test_str8_format(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_find(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Str8RO s = wapp_str8_lit("Do as I say, not as I do");
|
||||
|
||||
result = wapp_str8_find(&s, wapp_str8_lit_ro("d")) != -1;
|
||||
@@ -394,7 +393,7 @@ TestFuncResult test_str8_find(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_rfind(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Str8RO s = wapp_str8_lit("Do as I say, not as I do");
|
||||
|
||||
result = wapp_str8_rfind(&s, wapp_str8_lit_ro("d")) != -1;
|
||||
@@ -410,7 +409,7 @@ TestFuncResult test_str8_rfind(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_split(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("hello world from me");
|
||||
@@ -432,11 +431,11 @@ TestFuncResult test_str8_split(void) {
|
||||
|
||||
u64 index1 = 0;
|
||||
u64 count1 = ARRLEN(splits1);
|
||||
bool running1 = true;
|
||||
b32 running1 = true;
|
||||
|
||||
u64 index2 = 0;
|
||||
u64 count2 = ARRLEN(splits2);
|
||||
bool running2 = true;
|
||||
b32 running2 = true;
|
||||
|
||||
result = list1->node_count == count1 && wapp_str8_list_total_size(list1) == str.size - 3;
|
||||
result = result && list2->node_count == count2 && wapp_str8_list_total_size(list2) == str.size - 4;
|
||||
@@ -467,7 +466,7 @@ TestFuncResult test_str8_split(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_split_with_max(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("hello world from me");
|
||||
@@ -482,7 +481,7 @@ TestFuncResult test_str8_split_with_max(void) {
|
||||
|
||||
u64 index = 0;
|
||||
u64 count = ARRLEN(splits);
|
||||
bool running = true;
|
||||
b32 running = true;
|
||||
|
||||
result = list->node_count == count && wapp_str8_list_total_size(list) == str.size - 2;
|
||||
|
||||
@@ -502,7 +501,7 @@ TestFuncResult test_str8_split_with_max(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_rsplit(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("hello world from me");
|
||||
@@ -524,11 +523,11 @@ TestFuncResult test_str8_rsplit(void) {
|
||||
|
||||
u64 index1 = 0;
|
||||
u64 count1 = ARRLEN(splits1);
|
||||
bool running1 = true;
|
||||
b32 running1 = true;
|
||||
|
||||
u64 index2 = 0;
|
||||
u64 count2 = ARRLEN(splits2);
|
||||
bool running2 = true;
|
||||
b32 running2 = true;
|
||||
|
||||
result = list1->node_count == count1 && wapp_str8_list_total_size(list1) == str.size - 3;
|
||||
result = result && list2->node_count == count2 && wapp_str8_list_total_size(list2) == str.size - 4;
|
||||
@@ -559,7 +558,7 @@ TestFuncResult test_str8_rsplit(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_rsplit_with_max(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("hello world from me");
|
||||
@@ -574,7 +573,7 @@ TestFuncResult test_str8_rsplit_with_max(void) {
|
||||
|
||||
u64 index = 0;
|
||||
u64 count = ARRLEN(splits);
|
||||
bool running = true;
|
||||
b32 running = true;
|
||||
|
||||
result = list->node_count == count && wapp_str8_list_total_size(list) == str.size - 2;
|
||||
|
||||
@@ -594,7 +593,7 @@ TestFuncResult test_str8_rsplit_with_max(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_join(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("hello world from me");
|
||||
@@ -614,7 +613,7 @@ TestFuncResult test_str8_join(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_from_bytes(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 str = wapp_str8_buf(1024);
|
||||
U8Array bytes = wapp_u8_array('W', 'A', 'P', 'P');
|
||||
|
@@ -1,11 +1,10 @@
|
||||
#include "test_str8.h"
|
||||
#include "wapp.h"
|
||||
#include <stdbool.h>
|
||||
|
||||
#define ARRLEN(ARR) (sizeof(ARR) / sizeof(ARR[0]))
|
||||
|
||||
TestFuncResult test_str8_lit(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 s1 = wapp_str8_lit("Hello world");
|
||||
result = s1.capacity == 22 && s1.capacity != s1.size;
|
||||
@@ -32,7 +31,7 @@ TestFuncResult test_str8_lit(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_lit_ro(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8RO s1 = wapp_str8_lit_ro("Hello world");
|
||||
result = s1.capacity == 11 && s1.capacity == s1.size;
|
||||
@@ -59,7 +58,7 @@ TestFuncResult test_str8_lit_ro(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_buf(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 s1 = wapp_str8_buf(1024);
|
||||
result = s1.capacity == 1024 && s1.size == 0;
|
||||
@@ -77,7 +76,7 @@ TestFuncResult test_str8_buf(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_alloc_buf(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(KB(100));
|
||||
if (wapp_mem_allocator_invalid(&allocator)) {
|
||||
return wapp_tester_result(false);
|
||||
@@ -105,7 +104,7 @@ TestFuncResult test_str8_alloc_buf(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_alloc_cstr(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(KB(100));
|
||||
if (wapp_mem_allocator_invalid(&allocator)) {
|
||||
return wapp_tester_result(false);
|
||||
@@ -126,7 +125,7 @@ TestFuncResult test_str8_alloc_cstr(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_alloc_str8(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(KB(100));
|
||||
if (wapp_mem_allocator_invalid(&allocator)) {
|
||||
return wapp_tester_result(false);
|
||||
@@ -146,7 +145,7 @@ TestFuncResult test_str8_alloc_str8(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_alloc_substr(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(KB(100));
|
||||
if (wapp_mem_allocator_invalid(&allocator)) {
|
||||
return wapp_tester_result(false);
|
||||
@@ -166,7 +165,7 @@ TestFuncResult test_str8_alloc_substr(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_get_index_within_bounds(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8RO s1 = wapp_str8_lit_ro("Hello world");
|
||||
result = wapp_str8_get(&s1, 4) == 'o';
|
||||
@@ -194,12 +193,12 @@ TestFuncResult test_str8_get_index_within_bounds(void) {
|
||||
|
||||
TestFuncResult test_str8_get_index_out_of_bounds(void) {
|
||||
Str8 s1 = wapp_str8_lit("Hello world");
|
||||
bool result = wapp_str8_get(&s1, 20) == '\0';
|
||||
b32 result = wapp_str8_get(&s1, 20) == '\0';
|
||||
return wapp_tester_result(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_set(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 s1 = wapp_str8_lit("Hello world");
|
||||
wapp_str8_set(&s1, 4, 'f');
|
||||
@@ -233,7 +232,7 @@ TestFuncResult test_str8_set(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_push_back(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 expected = wapp_str8_lit("Abdelrahman");
|
||||
Str8 buf = wapp_str8_buf(64);
|
||||
@@ -255,7 +254,7 @@ TestFuncResult test_str8_push_back(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_equal(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8RO s1 = wapp_str8_lit_ro("hello");
|
||||
Str8RO s2 = wapp_str8_lit_ro("hell");
|
||||
@@ -270,7 +269,7 @@ TestFuncResult test_str8_equal(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_slice(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Str8 s = wapp_str8_lit("Different strokes for different folks");
|
||||
|
||||
Str8RO sub1 = wapp_str8_slice(&s, 3, 9);
|
||||
@@ -289,7 +288,7 @@ TestFuncResult test_str8_slice(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_alloc_concat(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("Hello world");
|
||||
@@ -312,7 +311,7 @@ TestFuncResult test_str8_alloc_concat(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_concat_capped(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 str = wapp_str8_lit("Hello world");
|
||||
Str8 suffix1 = wapp_str8_lit(" from me.");
|
||||
@@ -330,7 +329,7 @@ TestFuncResult test_str8_concat_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_copy_cstr_capped(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 buf = wapp_str8_buf(32);
|
||||
const char *src1 = "Hello world";
|
||||
@@ -348,7 +347,7 @@ TestFuncResult test_str8_copy_cstr_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_copy_str8_capped(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 buf = wapp_str8_buf(32);
|
||||
Str8RO src1 = wapp_str8_lit_ro("Hello world");
|
||||
@@ -365,7 +364,7 @@ TestFuncResult test_str8_copy_str8_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_format(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 buf = wapp_str8_buf(128);
|
||||
Str8 expected = wapp_str8_lit("My name is Abdelrahman and I am 35 years old");
|
||||
@@ -378,7 +377,7 @@ TestFuncResult test_str8_format(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_find(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Str8RO s = wapp_str8_lit("Do as I say, not as I do");
|
||||
|
||||
result = wapp_str8_find(&s, wapp_str8_lit_ro("d")) != -1;
|
||||
@@ -394,7 +393,7 @@ TestFuncResult test_str8_find(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_rfind(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Str8RO s = wapp_str8_lit("Do as I say, not as I do");
|
||||
|
||||
result = wapp_str8_rfind(&s, wapp_str8_lit_ro("d")) != -1;
|
||||
@@ -410,7 +409,7 @@ TestFuncResult test_str8_rfind(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_split(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("hello world from me");
|
||||
@@ -432,11 +431,11 @@ TestFuncResult test_str8_split(void) {
|
||||
|
||||
u64 index1 = 0;
|
||||
u64 count1 = ARRLEN(splits1);
|
||||
bool running1 = true;
|
||||
b32 running1 = true;
|
||||
|
||||
u64 index2 = 0;
|
||||
u64 count2 = ARRLEN(splits2);
|
||||
bool running2 = true;
|
||||
b32 running2 = true;
|
||||
|
||||
result = list1->node_count == count1 && wapp_str8_list_total_size(list1) == str.size - 3;
|
||||
result = result && list2->node_count == count2 && wapp_str8_list_total_size(list2) == str.size - 4;
|
||||
@@ -467,7 +466,7 @@ TestFuncResult test_str8_split(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_split_with_max(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("hello world from me");
|
||||
@@ -482,7 +481,7 @@ TestFuncResult test_str8_split_with_max(void) {
|
||||
|
||||
u64 index = 0;
|
||||
u64 count = ARRLEN(splits);
|
||||
bool running = true;
|
||||
b32 running = true;
|
||||
|
||||
result = list->node_count == count && wapp_str8_list_total_size(list) == str.size - 2;
|
||||
|
||||
@@ -502,7 +501,7 @@ TestFuncResult test_str8_split_with_max(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_rsplit(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("hello world from me");
|
||||
@@ -524,11 +523,11 @@ TestFuncResult test_str8_rsplit(void) {
|
||||
|
||||
u64 index1 = 0;
|
||||
u64 count1 = ARRLEN(splits1);
|
||||
bool running1 = true;
|
||||
b32 running1 = true;
|
||||
|
||||
u64 index2 = 0;
|
||||
u64 count2 = ARRLEN(splits2);
|
||||
bool running2 = true;
|
||||
b32 running2 = true;
|
||||
|
||||
result = list1->node_count == count1 && wapp_str8_list_total_size(list1) == str.size - 3;
|
||||
result = result && list2->node_count == count2 && wapp_str8_list_total_size(list2) == str.size - 4;
|
||||
@@ -559,7 +558,7 @@ TestFuncResult test_str8_rsplit(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_rsplit_with_max(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("hello world from me");
|
||||
@@ -574,7 +573,7 @@ TestFuncResult test_str8_rsplit_with_max(void) {
|
||||
|
||||
u64 index = 0;
|
||||
u64 count = ARRLEN(splits);
|
||||
bool running = true;
|
||||
b32 running = true;
|
||||
|
||||
result = list->node_count == count && wapp_str8_list_total_size(list) == str.size - 2;
|
||||
|
||||
@@ -594,7 +593,7 @@ TestFuncResult test_str8_rsplit_with_max(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_join(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("hello world from me");
|
||||
@@ -614,7 +613,7 @@ TestFuncResult test_str8_join(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_from_bytes(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 str = wapp_str8_buf(1024);
|
||||
Str8 expected = wapp_str8_lit_ro("WAPP");
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#include "wapp.h"
|
||||
|
||||
TestFuncResult test_str8_list_get(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 s1 = wapp_str8_lit("1");
|
||||
Str8 s2 = wapp_str8_lit("2");
|
||||
@@ -42,7 +42,7 @@ TestFuncResult test_str8_list_get(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_list_push_front(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 s1 = wapp_str8_lit("1");
|
||||
Str8 s2 = wapp_str8_lit("2");
|
||||
@@ -66,7 +66,7 @@ TestFuncResult test_str8_list_push_front(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_list_push_back(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 s1 = wapp_str8_lit("1");
|
||||
Str8 s2 = wapp_str8_lit("2");
|
||||
@@ -90,7 +90,7 @@ TestFuncResult test_str8_list_push_back(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_list_insert(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 s1 = wapp_str8_lit("1");
|
||||
Str8 s2 = wapp_str8_lit("2");
|
||||
@@ -127,7 +127,7 @@ TestFuncResult test_str8_list_insert(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_list_pop_front(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 s1 = wapp_str8_lit("1");
|
||||
Str8 s2 = wapp_str8_lit("2");
|
||||
@@ -167,7 +167,7 @@ TestFuncResult test_str8_list_pop_front(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_list_pop_back(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 s1 = wapp_str8_lit("1");
|
||||
Str8 s2 = wapp_str8_lit("2");
|
||||
@@ -207,7 +207,7 @@ TestFuncResult test_str8_list_pop_back(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_list_remove(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 s1 = wapp_str8_lit("1");
|
||||
Str8 s2 = wapp_str8_lit("2");
|
||||
@@ -247,7 +247,7 @@ TestFuncResult test_str8_list_remove(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_list_empty(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8List list = {0};
|
||||
wapp_str8_list_push_back(&list, &wapp_str8_node_from_cstr("Hello"));
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#include "wapp.h"
|
||||
|
||||
TestFuncResult test_str8_list_get(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 s1 = wapp_str8_lit("1");
|
||||
Str8 s2 = wapp_str8_lit("2");
|
||||
@@ -42,7 +42,7 @@ TestFuncResult test_str8_list_get(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_list_push_front(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 s1 = wapp_str8_lit("1");
|
||||
Str8 s2 = wapp_str8_lit("2");
|
||||
@@ -66,7 +66,7 @@ TestFuncResult test_str8_list_push_front(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_list_push_back(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 s1 = wapp_str8_lit("1");
|
||||
Str8 s2 = wapp_str8_lit("2");
|
||||
@@ -90,7 +90,7 @@ TestFuncResult test_str8_list_push_back(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_list_insert(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 s1 = wapp_str8_lit("1");
|
||||
Str8 s2 = wapp_str8_lit("2");
|
||||
@@ -127,7 +127,7 @@ TestFuncResult test_str8_list_insert(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_list_pop_front(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 s1 = wapp_str8_lit("1");
|
||||
Str8 s2 = wapp_str8_lit("2");
|
||||
@@ -167,7 +167,7 @@ TestFuncResult test_str8_list_pop_front(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_list_pop_back(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 s1 = wapp_str8_lit("1");
|
||||
Str8 s2 = wapp_str8_lit("2");
|
||||
@@ -207,7 +207,7 @@ TestFuncResult test_str8_list_pop_back(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_list_remove(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8 s1 = wapp_str8_lit("1");
|
||||
Str8 s2 = wapp_str8_lit("2");
|
||||
@@ -247,7 +247,7 @@ TestFuncResult test_str8_list_remove(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_list_empty(void) {
|
||||
bool result;
|
||||
b32 result;
|
||||
|
||||
Str8List list = {};
|
||||
|
||||
|
Reference in New Issue
Block a user