Change boolean size to 1 byte
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user