Change boolean size to 1 byte

This commit is contained in:
2025-12-07 12:17:40 +00:00
parent 432e4a48d5
commit 9c5b95c229
41 changed files with 489 additions and 364 deletions

View File

@@ -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));