Files
wizapp-stdlib/tests/array/test_str8_array.cc
T
2026-06-26 16:54:24 +01:00

31 lines
747 B
C++

// vim:fileencoding=utf-8:foldmethod=marker
#include "test_str8_array.h"
WpTestFuncResult test_str8_array(void) {
b8 result;
WpStr8 expected[] = {wpStr8Lit("Hello"), wpStr8Lit("Hi"), wpStr8Lit("Bye")};
WpStr8 str1 = wpStr8Lit("Hello");
WpStr8 str2 = wpStr8Lit("Hi");
WpStr8 str3 = wpStr8Lit("Bye");
WpStr8Array array = wpArray(WpStr8, str1, str2, str3);
result = wpArrayCount(array) == 3 && wpArrayCapacity(array) == 8;
WpStr8 *item;
u64 count = wpArrayCount(array);
u64 index = 0;
b8 running = true;
while (running) {
item = wpArrayGet(WpStr8, array, index);
result = result && item && (wpStr8Equal(item, &expected[index]));
++index;
running = index < count;
}
return wpTesterResult(result);
}