Update wapp array C API

This commit is contained in:
2025-12-07 21:56:16 +00:00
committed by Abdelrahman Said
parent 551836d4c8
commit 2b49bfcdbf
10 changed files with 365 additions and 3991 deletions

View File

@@ -6,16 +6,16 @@ TestFuncResult test_str8_array(void) {
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"));
result = array.count == 3 && array.capacity == 8;
Str8 *array = wapp_array(Str8, wapp_str8_lit("Hello"), wapp_str8_lit("Hi"), wapp_str8_lit("Bye"));
result = wapp_array_count(Str8, array) == 3 && wapp_array_capacity(Str8, array) == 8;
Str8 *item;
u64 count = array.count;
Str8 item;
u64 count = wapp_array_count(Str8, array);
u64 index = 0;
b8 running = true;
while (running) {
item = wapp_str8_array_get(&array, index);
result = result && item && (wapp_str8_equal(item, &expected[index]));
item = wapp_array_get(Str8, array, index);
result = result && (wapp_str8_equal(&item, &expected[index]));
++index;
running = index < count;