26 lines
664 B
C
26 lines
664 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 = wpArray(WpStr8, wpStr8Lit("Hello"), wpStr8Lit("Hi"), wpStr8Lit("Bye"));
|
|
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);
|
|
}
|