26 lines
683 B
C
26 lines
683 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")};
|
|
WpStr8Array array = wapp_array(WpStr8, wpStr8Lit("Hello"), wpStr8Lit("Hi"), wpStr8Lit("Bye"));
|
|
result = wapp_array_count(array) == 3 && wapp_array_capacity(array) == 8;
|
|
|
|
WpStr8 *item;
|
|
u64 count = wapp_array_count(array);
|
|
u64 index = 0;
|
|
b8 running = true;
|
|
while (running) {
|
|
item = wapp_array_get(WpStr8, array, index);
|
|
result = result && item && (wpStr8Equal(item, &expected[index]));
|
|
|
|
++index;
|
|
running = index < count;
|
|
}
|
|
|
|
return wpTesterResult(result);
|
|
}
|