26 lines
738 B
C
26 lines
738 B
C
// vim:fileencoding=utf-8:foldmethod=marker
|
|
|
|
#include "test_str8_array.h"
|
|
|
|
TestFuncResult test_str8_array(void) {
|
|
b8 result;
|
|
|
|
Str8 expected[] = {wapp_str8_lit("Hello"), wapp_str8_lit("Hi"), wapp_str8_lit("Bye")};
|
|
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 = wapp_array_count(Str8, array);
|
|
u64 index = 0;
|
|
b8 running = true;
|
|
while (running) {
|
|
item = wapp_array_get(Str8, array, index);
|
|
result = result && (wapp_str8_equal(&item, &expected[index]));
|
|
|
|
++index;
|
|
running = index < count;
|
|
}
|
|
|
|
return wapp_tester_result(result);
|
|
}
|