Change boolean size to 1 byte
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
TestFuncResult test_arena_allocator(void) {
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(4096);
|
||||
b32 result = allocator.obj != NULL && allocator.alloc != NULL &&
|
||||
b8 result = allocator.obj != NULL && allocator.alloc != NULL &&
|
||||
allocator.alloc_aligned != NULL &&
|
||||
allocator.realloc != NULL && allocator.realloc_aligned != NULL &&
|
||||
allocator.free == NULL;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
TestFuncResult test_arena_allocator(void) {
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(4096);
|
||||
b32 result = allocator.obj != nullptr && allocator.alloc != nullptr &&
|
||||
b8 result = allocator.obj != nullptr && allocator.alloc != nullptr &&
|
||||
allocator.alloc_aligned != nullptr &&
|
||||
allocator.realloc != nullptr && allocator.realloc_aligned != nullptr &&
|
||||
allocator.free == nullptr;
|
||||
|
||||
@@ -9,7 +9,7 @@ wapp_intern i32 count = 20;
|
||||
wapp_intern i32 *array = NULL;
|
||||
|
||||
TestFuncResult test_arena_init(void) {
|
||||
b32 result = wapp_mem_arena_init(&arena, ARENA_CAPACITY);
|
||||
b8 result = wapp_mem_arena_init(&arena, ARENA_CAPACITY);
|
||||
|
||||
return wapp_tester_result(result);
|
||||
}
|
||||
@@ -17,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);
|
||||
b32 result = wapp_mem_arena_init(&large_arena, capacity);
|
||||
b8 result = wapp_mem_arena_init(&large_arena, capacity);
|
||||
if (result) {
|
||||
wapp_mem_arena_destroy(&large_arena);
|
||||
}
|
||||
@@ -27,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));
|
||||
b32 result = array != NULL;
|
||||
b8 result = array != NULL;
|
||||
|
||||
for (i32 i = 0; i < count; ++i) {
|
||||
array[i] = i * 10;
|
||||
@@ -38,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);
|
||||
b32 result = bytes == NULL;
|
||||
b8 result = bytes == NULL;
|
||||
|
||||
return wapp_tester_result(result);
|
||||
}
|
||||
@@ -91,7 +91,7 @@ TestFuncResult test_arena_realloc_smaller_size(void) {
|
||||
|
||||
TestFuncResult test_arena_clear(void) {
|
||||
wapp_mem_arena_clear(arena);
|
||||
b32 result = true;
|
||||
b8 result = true;
|
||||
|
||||
for (i32 i = 0; i < count; ++i) {
|
||||
if (array[i] != 0) {
|
||||
@@ -105,7 +105,7 @@ TestFuncResult test_arena_clear(void) {
|
||||
|
||||
TestFuncResult test_arena_destroy(void) {
|
||||
wapp_mem_arena_destroy(&arena);
|
||||
b32 result = arena == NULL;
|
||||
b8 result = arena == NULL;
|
||||
|
||||
return wapp_tester_result(result);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ wapp_intern i32 count = 20;
|
||||
wapp_intern i32 *array = nullptr;
|
||||
|
||||
TestFuncResult test_arena_init(void) {
|
||||
b32 result = wapp_mem_arena_init(&arena, ARENA_CAPACITY);
|
||||
b8 result = wapp_mem_arena_init(&arena, ARENA_CAPACITY);
|
||||
|
||||
return wapp_tester_result(result);
|
||||
}
|
||||
@@ -17,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);
|
||||
b32 result = wapp_mem_arena_init(&large_arena, capacity);
|
||||
b8 result = wapp_mem_arena_init(&large_arena, capacity);
|
||||
if (result) {
|
||||
wapp_mem_arena_destroy(&large_arena);
|
||||
}
|
||||
@@ -27,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));
|
||||
b32 result = array != nullptr;
|
||||
b8 result = array != nullptr;
|
||||
|
||||
for (i32 i = 0; i < count; ++i) {
|
||||
array[i] = i * 10;
|
||||
@@ -38,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);
|
||||
b32 result = bytes == nullptr;
|
||||
b8 result = bytes == nullptr;
|
||||
|
||||
return wapp_tester_result(result);
|
||||
}
|
||||
@@ -91,7 +91,7 @@ TestFuncResult test_arena_realloc_smaller_size(void) {
|
||||
|
||||
TestFuncResult test_arena_clear(void) {
|
||||
wapp_mem_arena_clear(arena);
|
||||
b32 result = true;
|
||||
b8 result = true;
|
||||
|
||||
for (i32 i = 0; i < count; ++i) {
|
||||
if (array[i] != 0) {
|
||||
@@ -105,7 +105,7 @@ TestFuncResult test_arena_clear(void) {
|
||||
|
||||
TestFuncResult test_arena_destroy(void) {
|
||||
wapp_mem_arena_destroy(&arena);
|
||||
b32 result = arena == nullptr;
|
||||
b8 result = arena == nullptr;
|
||||
|
||||
return wapp_tester_result(result);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "wapp.h"
|
||||
|
||||
TestFuncResult test_i32_array(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
I32Array array = wapp_i32_array(1, 2, 3, 4, 5, 6, 7);
|
||||
result = array.count == 7 && array.capacity == 16;
|
||||
@@ -10,7 +10,7 @@ TestFuncResult test_i32_array(void) {
|
||||
i32 *item;
|
||||
u64 count = array.count;
|
||||
u64 index = 0;
|
||||
b32 running = true;
|
||||
b8 running = true;
|
||||
while (running) {
|
||||
item = wapp_i32_array_get(&array, index);
|
||||
result = result && item && (*item == (i32)(index + 1));
|
||||
@@ -23,7 +23,7 @@ TestFuncResult test_i32_array(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_with_capacity(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
I32Array array = wapp_i32_array_with_capacity(64);
|
||||
result = array.count == 0 && array.capacity == 64;
|
||||
@@ -32,14 +32,14 @@ TestFuncResult test_i32_array_with_capacity(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_get(void) {
|
||||
b32 result = true;
|
||||
b8 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;
|
||||
b32 running = true;
|
||||
b8 running = true;
|
||||
while (running) {
|
||||
item = wapp_i32_array_get(&array, index);
|
||||
result = result && item && (*item == (i32)index);
|
||||
@@ -52,14 +52,14 @@ TestFuncResult test_i32_array_get(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_set(void) {
|
||||
b32 result = true;
|
||||
b8 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;
|
||||
b32 running = true;
|
||||
b8 running = true;
|
||||
while (running) {
|
||||
i32 num = (i32)(index * 2);
|
||||
wapp_i32_array_set(&array, index, &num);
|
||||
@@ -74,7 +74,7 @@ TestFuncResult test_i32_array_set(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_append_capped(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
I32Array array = wapp_i32_array_with_capacity(64);
|
||||
wapp_i32_array_append_capped(&array, &((i32){10}));
|
||||
@@ -92,7 +92,7 @@ TestFuncResult test_i32_array_append_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_extend_capped(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
I32Array array1 = wapp_i32_array(1, 2, 3, 4);
|
||||
I32Array array2 = wapp_i32_array(10, 20);
|
||||
@@ -107,7 +107,7 @@ TestFuncResult test_i32_array_extend_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_clear(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
I32Array array = wapp_i32_array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
result = array.count == 9;
|
||||
@@ -120,7 +120,7 @@ TestFuncResult test_i32_array_clear(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_pop(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
I32Array array1 = wapp_i32_array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
I32Array array2 = wapp_i32_array_with_capacity(32);
|
||||
@@ -134,7 +134,7 @@ TestFuncResult test_i32_array_pop(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_copy_capped(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
I32Array src = wapp_i32_array(1, 2, 3, 4, 5);
|
||||
I32Array dst1 = wapp_i32_array(1, 2, 3, 4, 5, 6);
|
||||
@@ -145,7 +145,7 @@ TestFuncResult test_i32_array_copy_capped(void) {
|
||||
result = dst1.count == expected_count;
|
||||
|
||||
u64 index = 0;
|
||||
b32 running = true;
|
||||
b8 running = true;
|
||||
while (running) {
|
||||
result = result && (*wapp_i32_array_get(&src, index) == *wapp_i32_array_get(&dst1, index));
|
||||
|
||||
@@ -170,7 +170,7 @@ TestFuncResult test_i32_array_copy_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_alloc_capacity(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(MB(4));
|
||||
u64 capacity = 32;
|
||||
@@ -184,7 +184,7 @@ TestFuncResult test_i32_array_alloc_capacity(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_append_alloc(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(MB(4));
|
||||
I32Array array1 = wapp_i32_array(1, 2, 3, 4, 5, 6, 7, 8);
|
||||
@@ -195,7 +195,7 @@ TestFuncResult test_i32_array_append_alloc(void) {
|
||||
|
||||
u64 count = 4;
|
||||
u64 index = 0;
|
||||
b32 running = true;
|
||||
b8 running = true;
|
||||
while (running) {
|
||||
i32 num = (i32)index;
|
||||
arr_ptr = wapp_i32_array_append_alloc(&allocator, &array2, &num);
|
||||
@@ -211,7 +211,7 @@ TestFuncResult test_i32_array_append_alloc(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_extend_alloc(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(MB(4));
|
||||
I32Array array1 = wapp_i32_array(1, 2, 3, 4, 5, 6, 7, 8);
|
||||
@@ -230,7 +230,7 @@ TestFuncResult test_i32_array_extend_alloc(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_copy_alloc(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(MB(4));
|
||||
I32Array src = wapp_i32_array(1, 2, 3, 4, 5);
|
||||
@@ -243,7 +243,7 @@ TestFuncResult test_i32_array_copy_alloc(void) {
|
||||
result = array_ptr->count == expected_count && array_ptr == &dst1;
|
||||
|
||||
u64 index = 0;
|
||||
b32 running = true;
|
||||
b8 running = true;
|
||||
while (running) {
|
||||
result = result && (*wapp_i32_array_get(&src, index) == *wapp_i32_array_get(array_ptr, index));
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "wapp.h"
|
||||
|
||||
TestFuncResult test_i32_array(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
I32Array array = wapp_i32_array(1, 2, 3, 4, 5, 6, 7);
|
||||
result = array.count == 7 && array.capacity == 16;
|
||||
@@ -10,7 +10,7 @@ TestFuncResult test_i32_array(void) {
|
||||
i32 *item;
|
||||
u64 count = array.count;
|
||||
u64 index = 0;
|
||||
b32 running = true;
|
||||
b8 running = true;
|
||||
while (running) {
|
||||
item = wapp_i32_array_get(&array, index);
|
||||
result = result && item && (*item == (i32)(index + 1));
|
||||
@@ -23,7 +23,7 @@ TestFuncResult test_i32_array(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_with_capacity(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
I32Array array = wapp_i32_array_with_capacity(64);
|
||||
result = array.count == 0 && array.capacity == 64;
|
||||
@@ -32,14 +32,14 @@ TestFuncResult test_i32_array_with_capacity(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_get(void) {
|
||||
b32 result = true;
|
||||
b8 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;
|
||||
b32 running = true;
|
||||
b8 running = true;
|
||||
while (running) {
|
||||
item = wapp_i32_array_get(&array, index);
|
||||
result = result && item && (*item == (i32)index);
|
||||
@@ -52,14 +52,14 @@ TestFuncResult test_i32_array_get(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_set(void) {
|
||||
b32 result = true;
|
||||
b8 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;
|
||||
b32 running = true;
|
||||
b8 running = true;
|
||||
while (running) {
|
||||
i32 num = (i32)(index * 2);
|
||||
wapp_i32_array_set(&array, index, &num);
|
||||
@@ -74,7 +74,7 @@ TestFuncResult test_i32_array_set(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_append_capped(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
I32Array array = wapp_i32_array_with_capacity(64);
|
||||
i32 item1 = 10;
|
||||
@@ -94,7 +94,7 @@ TestFuncResult test_i32_array_append_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_extend_capped(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
I32Array array1 = wapp_i32_array(1, 2, 3, 4);
|
||||
I32Array array2 = wapp_i32_array(10, 20);
|
||||
@@ -109,7 +109,7 @@ TestFuncResult test_i32_array_extend_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_clear(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
I32Array array = wapp_i32_array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
result = array.count == 9;
|
||||
@@ -122,7 +122,7 @@ TestFuncResult test_i32_array_clear(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_pop(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
I32Array array1 = wapp_i32_array(0, 1, 2, 3, 4, 5, 6, 7, 8);
|
||||
I32Array array2 = wapp_i32_array_with_capacity(32);
|
||||
@@ -136,7 +136,7 @@ TestFuncResult test_i32_array_pop(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_copy_capped(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
I32Array src = wapp_i32_array(1, 2, 3, 4, 5);
|
||||
I32Array dst1 = wapp_i32_array(1, 2, 3, 4, 5, 6);
|
||||
@@ -147,7 +147,7 @@ TestFuncResult test_i32_array_copy_capped(void) {
|
||||
result = dst1.count == expected_count;
|
||||
|
||||
u64 index = 0;
|
||||
b32 running = true;
|
||||
b8 running = true;
|
||||
while (running) {
|
||||
result = result && (*wapp_i32_array_get(&src, index) == *wapp_i32_array_get(&dst1, index));
|
||||
|
||||
@@ -172,7 +172,7 @@ TestFuncResult test_i32_array_copy_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_alloc_capacity(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(MB(4));
|
||||
u64 capacity = 32;
|
||||
@@ -186,7 +186,7 @@ TestFuncResult test_i32_array_alloc_capacity(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_append_alloc(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(MB(4));
|
||||
I32Array array1 = wapp_i32_array(1, 2, 3, 4, 5, 6, 7, 8);
|
||||
@@ -198,7 +198,7 @@ TestFuncResult test_i32_array_append_alloc(void) {
|
||||
|
||||
u64 count = 4;
|
||||
u64 index = 0;
|
||||
b32 running = true;
|
||||
b8 running = true;
|
||||
while (running) {
|
||||
i32 num = (i32)index;
|
||||
arr_ptr = wapp_i32_array_append_alloc(&allocator, &array2, &num);
|
||||
@@ -214,7 +214,7 @@ TestFuncResult test_i32_array_append_alloc(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_extend_alloc(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(MB(4));
|
||||
I32Array array1 = wapp_i32_array(1, 2, 3, 4, 5, 6, 7, 8);
|
||||
@@ -233,7 +233,7 @@ TestFuncResult test_i32_array_extend_alloc(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_i32_array_copy_alloc(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(MB(4));
|
||||
I32Array src = wapp_i32_array(1, 2, 3, 4, 5);
|
||||
@@ -246,7 +246,7 @@ TestFuncResult test_i32_array_copy_alloc(void) {
|
||||
result = array_ptr->count == expected_count && array_ptr == &dst1;
|
||||
|
||||
u64 index = 0;
|
||||
b32 running = true;
|
||||
b8 running = true;
|
||||
while (running) {
|
||||
result = result && (*wapp_i32_array_get(&src, index) == *wapp_i32_array_get(array_ptr, index));
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "test_str8_array.h"
|
||||
|
||||
TestFuncResult test_str8_array(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8 expected[] = {wapp_str8_lit("Hello"), wapp_str8_lit("Hi"), wapp_str8_lit("Bye")};
|
||||
Str8Array array = wapp_str8_array(wapp_str8_lit("Hello"), wapp_str8_lit("Hi"), wapp_str8_lit("Bye"));
|
||||
@@ -12,7 +12,7 @@ TestFuncResult test_str8_array(void) {
|
||||
Str8 *item;
|
||||
u64 count = array.count;
|
||||
u64 index = 0;
|
||||
b32 running = true;
|
||||
b8 running = true;
|
||||
while (running) {
|
||||
item = wapp_str8_array_get(&array, index);
|
||||
result = result && item && (wapp_str8_equal(item, &expected[index]));
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "test_str8_array.h"
|
||||
|
||||
TestFuncResult test_str8_array(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8 expected[] = {wapp_str8_lit("Hello"), wapp_str8_lit("Hi"), wapp_str8_lit("Bye")};
|
||||
|
||||
@@ -17,7 +17,7 @@ TestFuncResult test_str8_array(void) {
|
||||
Str8 *item;
|
||||
u64 count = array.count;
|
||||
u64 index = 0;
|
||||
b32 running = true;
|
||||
b8 running = true;
|
||||
while (running) {
|
||||
item = wapp_str8_array_get(&array, index);
|
||||
result = result && item && (wapp_str8_equal(item, &expected[index]));
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#define TMP_BUF_SIZE 1024
|
||||
|
||||
TestFuncResult test_cpath_join_path(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8 expected = wapp_str8_buf(MAIN_BUF_SIZE);
|
||||
Str8 out = wapp_str8_buf(MAIN_BUF_SIZE);
|
||||
@@ -86,7 +86,7 @@ TestFuncResult test_cpath_dirname(void) {
|
||||
return wapp_tester_result(false);
|
||||
}
|
||||
|
||||
b32 result;
|
||||
b8 result;
|
||||
Str8 *output = NULL;
|
||||
|
||||
Str8 expected = wapp_str8_buf(MAIN_BUF_SIZE);
|
||||
@@ -134,7 +134,7 @@ TestFuncResult test_cpath_dirup(void) {
|
||||
return wapp_tester_result(false);
|
||||
}
|
||||
|
||||
b32 result;
|
||||
b8 result;
|
||||
Str8 *output = NULL;
|
||||
|
||||
Str8 expected = wapp_str8_buf(MAIN_BUF_SIZE);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#define TMP_BUF_SIZE 1024
|
||||
|
||||
TestFuncResult test_cpath_join_path(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8 expected = wapp_str8_buf(MAIN_BUF_SIZE);
|
||||
Str8 out = wapp_str8_buf(MAIN_BUF_SIZE);
|
||||
@@ -107,7 +107,7 @@ TestFuncResult test_cpath_dirname(void) {
|
||||
return wapp_tester_result(false);
|
||||
}
|
||||
|
||||
b32 result;
|
||||
b8 result;
|
||||
Str8 *output = nullptr;
|
||||
|
||||
Str8 expected = wapp_str8_buf(MAIN_BUF_SIZE);
|
||||
@@ -157,7 +157,7 @@ TestFuncResult test_cpath_dirup(void) {
|
||||
return wapp_tester_result(false);
|
||||
}
|
||||
|
||||
b32 result;
|
||||
b8 result;
|
||||
Str8 *output = nullptr;
|
||||
|
||||
Str8 expected = wapp_str8_buf(MAIN_BUF_SIZE);
|
||||
|
||||
@@ -10,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);
|
||||
b32 succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
|
||||
b8 succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
|
||||
result.error == SHELL_ERR_NO_ERROR;
|
||||
|
||||
return wapp_tester_result(succeeded);
|
||||
@@ -21,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);
|
||||
b32 failed = result.exited && result.exit_code != EXIT_SUCCESS &&
|
||||
b8 failed = result.exited && result.exit_code != EXIT_SUCCESS &&
|
||||
result.error == SHELL_ERR_NO_ERROR;
|
||||
|
||||
return wapp_tester_result(failed);
|
||||
@@ -38,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);
|
||||
b32 succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
|
||||
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);
|
||||
@@ -55,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);
|
||||
b32 failed = !result.exited && result.exit_code != EXIT_SUCCESS &&
|
||||
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);
|
||||
|
||||
@@ -12,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);
|
||||
b32 succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
|
||||
b8 succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
|
||||
result.error == SHELL_ERR_NO_ERROR;
|
||||
|
||||
return wapp_tester_result(succeeded);
|
||||
@@ -24,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);
|
||||
b32 failed = result.exited && result.exit_code != EXIT_SUCCESS &&
|
||||
b8 failed = result.exited && result.exit_code != EXIT_SUCCESS &&
|
||||
result.error == SHELL_ERR_NO_ERROR;
|
||||
|
||||
return wapp_tester_result(failed);
|
||||
@@ -43,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);
|
||||
b32 succeeded = result.exited && result.exit_code == EXIT_SUCCESS &&
|
||||
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);
|
||||
@@ -62,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);
|
||||
b32 failed = !result.exited && result.exit_code != EXIT_SUCCESS &&
|
||||
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);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#define ARRLEN(ARR) (sizeof(ARR) / sizeof(ARR[0]))
|
||||
|
||||
TestFuncResult test_str8_lit(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8 s1 = wapp_str8_lit("Hello world");
|
||||
result = s1.capacity == 22 && s1.capacity != s1.size;
|
||||
@@ -31,7 +31,7 @@ TestFuncResult test_str8_lit(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_lit_ro(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8RO s1 = wapp_str8_lit_ro("Hello world");
|
||||
result = s1.capacity == 11 && s1.capacity == s1.size;
|
||||
@@ -58,7 +58,7 @@ TestFuncResult test_str8_lit_ro(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_buf(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8 s1 = wapp_str8_buf(1024);
|
||||
result = s1.capacity == 1024 && s1.size == 0;
|
||||
@@ -76,7 +76,7 @@ TestFuncResult test_str8_buf(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_alloc_buf(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(KB(100));
|
||||
if (wapp_mem_allocator_invalid(&allocator)) {
|
||||
return wapp_tester_result(false);
|
||||
@@ -104,7 +104,7 @@ TEST_ALLOC_BUF_CLEANUP:
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_alloc_cstr(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(KB(100));
|
||||
if (wapp_mem_allocator_invalid(&allocator)) {
|
||||
return wapp_tester_result(false);
|
||||
@@ -125,7 +125,7 @@ TestFuncResult test_str8_alloc_cstr(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_alloc_str8(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(KB(100));
|
||||
if (wapp_mem_allocator_invalid(&allocator)) {
|
||||
return wapp_tester_result(false);
|
||||
@@ -145,7 +145,7 @@ TestFuncResult test_str8_alloc_str8(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_alloc_substr(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(KB(100));
|
||||
if (wapp_mem_allocator_invalid(&allocator)) {
|
||||
return wapp_tester_result(false);
|
||||
@@ -165,7 +165,7 @@ TestFuncResult test_str8_alloc_substr(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_get_index_within_bounds(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8RO s1 = wapp_str8_lit_ro("Hello world");
|
||||
result = wapp_str8_get(&s1, 4) == 'o';
|
||||
@@ -193,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");
|
||||
b32 result = wapp_str8_get(&s1, 20) == '\0';
|
||||
b8 result = wapp_str8_get(&s1, 20) == '\0';
|
||||
return wapp_tester_result(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_set(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8 s1 = wapp_str8_lit("Hello world");
|
||||
wapp_str8_set(&s1, 4, 'f');
|
||||
@@ -232,7 +232,7 @@ TestFuncResult test_str8_set(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_push_back(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8 expected = wapp_str8_lit("Abdelrahman");
|
||||
Str8 buf = wapp_str8_buf(64);
|
||||
@@ -254,7 +254,7 @@ TestFuncResult test_str8_push_back(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_equal(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8RO s1 = wapp_str8_lit_ro("hello");
|
||||
Str8RO s2 = wapp_str8_lit_ro("hell");
|
||||
@@ -269,7 +269,7 @@ TestFuncResult test_str8_equal(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_slice(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
Str8 s = wapp_str8_lit("Different strokes for different folks");
|
||||
|
||||
Str8RO sub1 = wapp_str8_slice(&s, 3, 9);
|
||||
@@ -288,7 +288,7 @@ TestFuncResult test_str8_slice(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_alloc_concat(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("Hello world");
|
||||
@@ -311,7 +311,7 @@ TestFuncResult test_str8_alloc_concat(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_concat_capped(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8 str = wapp_str8_lit("Hello world");
|
||||
Str8 suffix1 = wapp_str8_lit(" from me.");
|
||||
@@ -329,7 +329,7 @@ TestFuncResult test_str8_concat_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_copy_cstr_capped(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8 buf = wapp_str8_buf(32);
|
||||
const char *src1 = "Hello world";
|
||||
@@ -347,7 +347,7 @@ TestFuncResult test_str8_copy_cstr_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_copy_str8_capped(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8 buf = wapp_str8_buf(32);
|
||||
Str8RO src1 = wapp_str8_lit_ro("Hello world");
|
||||
@@ -364,7 +364,7 @@ TestFuncResult test_str8_copy_str8_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_format(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8 buf = wapp_str8_buf(128);
|
||||
Str8 expected = wapp_str8_lit("My name is Abdelrahman and I am 35 years old");
|
||||
@@ -377,7 +377,7 @@ TestFuncResult test_str8_format(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_find(void) {
|
||||
b32 result;
|
||||
b8 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;
|
||||
@@ -393,7 +393,7 @@ TestFuncResult test_str8_find(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_rfind(void) {
|
||||
b32 result;
|
||||
b8 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;
|
||||
@@ -409,7 +409,7 @@ TestFuncResult test_str8_rfind(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_split(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("hello world from me");
|
||||
@@ -431,11 +431,11 @@ TestFuncResult test_str8_split(void) {
|
||||
|
||||
u64 index1 = 0;
|
||||
u64 count1 = ARRLEN(splits1);
|
||||
b32 running1 = true;
|
||||
b8 running1 = true;
|
||||
|
||||
u64 index2 = 0;
|
||||
u64 count2 = ARRLEN(splits2);
|
||||
b32 running2 = true;
|
||||
b8 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;
|
||||
@@ -466,7 +466,7 @@ TestFuncResult test_str8_split(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_split_with_max(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("hello world from me");
|
||||
@@ -481,7 +481,7 @@ TestFuncResult test_str8_split_with_max(void) {
|
||||
|
||||
u64 index = 0;
|
||||
u64 count = ARRLEN(splits);
|
||||
b32 running = true;
|
||||
b8 running = true;
|
||||
|
||||
result = list->node_count == count && wapp_str8_list_total_size(list) == str.size - 2;
|
||||
|
||||
@@ -501,7 +501,7 @@ TestFuncResult test_str8_split_with_max(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_rsplit(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("hello world from me");
|
||||
@@ -523,11 +523,11 @@ TestFuncResult test_str8_rsplit(void) {
|
||||
|
||||
u64 index1 = 0;
|
||||
u64 count1 = ARRLEN(splits1);
|
||||
b32 running1 = true;
|
||||
b8 running1 = true;
|
||||
|
||||
u64 index2 = 0;
|
||||
u64 count2 = ARRLEN(splits2);
|
||||
b32 running2 = true;
|
||||
b8 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;
|
||||
@@ -558,7 +558,7 @@ TestFuncResult test_str8_rsplit(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_rsplit_with_max(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("hello world from me");
|
||||
@@ -573,7 +573,7 @@ TestFuncResult test_str8_rsplit_with_max(void) {
|
||||
|
||||
u64 index = 0;
|
||||
u64 count = ARRLEN(splits);
|
||||
b32 running = true;
|
||||
b8 running = true;
|
||||
|
||||
result = list->node_count == count && wapp_str8_list_total_size(list) == str.size - 2;
|
||||
|
||||
@@ -593,7 +593,7 @@ TestFuncResult test_str8_rsplit_with_max(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_join(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("hello world from me");
|
||||
@@ -613,7 +613,7 @@ TestFuncResult test_str8_join(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_from_bytes(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8 str = wapp_str8_buf(1024);
|
||||
U8Array bytes = wapp_u8_array('W', 'A', 'P', 'P');
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#define ARRLEN(ARR) (sizeof(ARR) / sizeof(ARR[0]))
|
||||
|
||||
TestFuncResult test_str8_lit(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8 s1 = wapp_str8_lit("Hello world");
|
||||
result = s1.capacity == 22 && s1.capacity != s1.size;
|
||||
@@ -31,7 +31,7 @@ TestFuncResult test_str8_lit(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_lit_ro(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8RO s1 = wapp_str8_lit_ro("Hello world");
|
||||
result = s1.capacity == 11 && s1.capacity == s1.size;
|
||||
@@ -58,7 +58,7 @@ TestFuncResult test_str8_lit_ro(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_buf(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8 s1 = wapp_str8_buf(1024);
|
||||
result = s1.capacity == 1024 && s1.size == 0;
|
||||
@@ -76,7 +76,7 @@ TestFuncResult test_str8_buf(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_alloc_buf(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(KB(100));
|
||||
if (wapp_mem_allocator_invalid(&allocator)) {
|
||||
return wapp_tester_result(false);
|
||||
@@ -104,7 +104,7 @@ TestFuncResult test_str8_alloc_buf(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_alloc_cstr(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(KB(100));
|
||||
if (wapp_mem_allocator_invalid(&allocator)) {
|
||||
return wapp_tester_result(false);
|
||||
@@ -125,7 +125,7 @@ TestFuncResult test_str8_alloc_cstr(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_alloc_str8(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(KB(100));
|
||||
if (wapp_mem_allocator_invalid(&allocator)) {
|
||||
return wapp_tester_result(false);
|
||||
@@ -145,7 +145,7 @@ TestFuncResult test_str8_alloc_str8(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_alloc_substr(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
Allocator allocator = wapp_mem_arena_allocator_init(KB(100));
|
||||
if (wapp_mem_allocator_invalid(&allocator)) {
|
||||
return wapp_tester_result(false);
|
||||
@@ -165,7 +165,7 @@ TestFuncResult test_str8_alloc_substr(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_get_index_within_bounds(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8RO s1 = wapp_str8_lit_ro("Hello world");
|
||||
result = wapp_str8_get(&s1, 4) == 'o';
|
||||
@@ -193,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");
|
||||
b32 result = wapp_str8_get(&s1, 20) == '\0';
|
||||
b8 result = wapp_str8_get(&s1, 20) == '\0';
|
||||
return wapp_tester_result(result);
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_set(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8 s1 = wapp_str8_lit("Hello world");
|
||||
wapp_str8_set(&s1, 4, 'f');
|
||||
@@ -232,7 +232,7 @@ TestFuncResult test_str8_set(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_push_back(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8 expected = wapp_str8_lit("Abdelrahman");
|
||||
Str8 buf = wapp_str8_buf(64);
|
||||
@@ -254,7 +254,7 @@ TestFuncResult test_str8_push_back(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_equal(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8RO s1 = wapp_str8_lit_ro("hello");
|
||||
Str8RO s2 = wapp_str8_lit_ro("hell");
|
||||
@@ -269,7 +269,7 @@ TestFuncResult test_str8_equal(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_slice(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
Str8 s = wapp_str8_lit("Different strokes for different folks");
|
||||
|
||||
Str8RO sub1 = wapp_str8_slice(&s, 3, 9);
|
||||
@@ -288,7 +288,7 @@ TestFuncResult test_str8_slice(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_alloc_concat(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("Hello world");
|
||||
@@ -311,7 +311,7 @@ TestFuncResult test_str8_alloc_concat(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_concat_capped(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8 str = wapp_str8_lit("Hello world");
|
||||
Str8 suffix1 = wapp_str8_lit(" from me.");
|
||||
@@ -329,7 +329,7 @@ TestFuncResult test_str8_concat_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_copy_cstr_capped(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8 buf = wapp_str8_buf(32);
|
||||
const char *src1 = "Hello world";
|
||||
@@ -347,7 +347,7 @@ TestFuncResult test_str8_copy_cstr_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_copy_str8_capped(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8 buf = wapp_str8_buf(32);
|
||||
Str8RO src1 = wapp_str8_lit_ro("Hello world");
|
||||
@@ -364,7 +364,7 @@ TestFuncResult test_str8_copy_str8_capped(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_format(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8 buf = wapp_str8_buf(128);
|
||||
Str8 expected = wapp_str8_lit("My name is Abdelrahman and I am 35 years old");
|
||||
@@ -377,7 +377,7 @@ TestFuncResult test_str8_format(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_find(void) {
|
||||
b32 result;
|
||||
b8 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;
|
||||
@@ -393,7 +393,7 @@ TestFuncResult test_str8_find(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_rfind(void) {
|
||||
b32 result;
|
||||
b8 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;
|
||||
@@ -409,7 +409,7 @@ TestFuncResult test_str8_rfind(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_split(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("hello world from me");
|
||||
@@ -431,11 +431,11 @@ TestFuncResult test_str8_split(void) {
|
||||
|
||||
u64 index1 = 0;
|
||||
u64 count1 = ARRLEN(splits1);
|
||||
b32 running1 = true;
|
||||
b8 running1 = true;
|
||||
|
||||
u64 index2 = 0;
|
||||
u64 count2 = ARRLEN(splits2);
|
||||
b32 running2 = true;
|
||||
b8 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;
|
||||
@@ -466,7 +466,7 @@ TestFuncResult test_str8_split(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_split_with_max(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("hello world from me");
|
||||
@@ -481,7 +481,7 @@ TestFuncResult test_str8_split_with_max(void) {
|
||||
|
||||
u64 index = 0;
|
||||
u64 count = ARRLEN(splits);
|
||||
b32 running = true;
|
||||
b8 running = true;
|
||||
|
||||
result = list->node_count == count && wapp_str8_list_total_size(list) == str.size - 2;
|
||||
|
||||
@@ -501,7 +501,7 @@ TestFuncResult test_str8_split_with_max(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_rsplit(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("hello world from me");
|
||||
@@ -523,11 +523,11 @@ TestFuncResult test_str8_rsplit(void) {
|
||||
|
||||
u64 index1 = 0;
|
||||
u64 count1 = ARRLEN(splits1);
|
||||
b32 running1 = true;
|
||||
b8 running1 = true;
|
||||
|
||||
u64 index2 = 0;
|
||||
u64 count2 = ARRLEN(splits2);
|
||||
b32 running2 = true;
|
||||
b8 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;
|
||||
@@ -558,7 +558,7 @@ TestFuncResult test_str8_rsplit(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_rsplit_with_max(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("hello world from me");
|
||||
@@ -573,7 +573,7 @@ TestFuncResult test_str8_rsplit_with_max(void) {
|
||||
|
||||
u64 index = 0;
|
||||
u64 count = ARRLEN(splits);
|
||||
b32 running = true;
|
||||
b8 running = true;
|
||||
|
||||
result = list->node_count == count && wapp_str8_list_total_size(list) == str.size - 2;
|
||||
|
||||
@@ -593,7 +593,7 @@ TestFuncResult test_str8_rsplit_with_max(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_join(void) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
Allocator arena = wapp_mem_arena_allocator_init(KB(100));
|
||||
|
||||
Str8 str = wapp_str8_lit("hello world from me");
|
||||
@@ -613,7 +613,7 @@ TestFuncResult test_str8_join(void) {
|
||||
}
|
||||
|
||||
TestFuncResult test_str8_from_bytes(void) {
|
||||
b32 result;
|
||||
b8 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) {
|
||||
b32 result;
|
||||
b8 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) {
|
||||
b32 result;
|
||||
b8 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) {
|
||||
b32 result;
|
||||
b8 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) {
|
||||
b32 result;
|
||||
b8 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) {
|
||||
b32 result;
|
||||
b8 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) {
|
||||
b32 result;
|
||||
b8 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) {
|
||||
b32 result;
|
||||
b8 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) {
|
||||
b32 result;
|
||||
b8 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) {
|
||||
b32 result;
|
||||
b8 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) {
|
||||
b32 result;
|
||||
b8 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) {
|
||||
b32 result;
|
||||
b8 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) {
|
||||
b32 result;
|
||||
b8 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) {
|
||||
b32 result;
|
||||
b8 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) {
|
||||
b32 result;
|
||||
b8 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) {
|
||||
b32 result;
|
||||
b8 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) {
|
||||
b32 result;
|
||||
b8 result;
|
||||
|
||||
Str8List list = {};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user