Switch to using b32
This commit is contained in:
@@ -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