31 lines
777 B
C++
31 lines
777 B
C++
// vim:fileencoding=utf-8:foldmethod=marker
|
|
|
|
#include "test_str8_array.h"
|
|
|
|
TestFuncResult test_str8_array(void) {
|
|
b32 result;
|
|
|
|
Str8 expected[] = {wapp_str8_lit("Hello"), wapp_str8_lit("Hi"), wapp_str8_lit("Bye")};
|
|
|
|
Str8 str1 = wapp_str8_lit("Hello");
|
|
Str8 str2 = wapp_str8_lit("Hi");
|
|
Str8 str3 = wapp_str8_lit("Bye");
|
|
Str8Array array = wapp_str8_array(str1, str2, str3);
|
|
|
|
result = array.count == 3 && array.capacity == 8;
|
|
|
|
Str8 *item;
|
|
u64 count = array.count;
|
|
u64 index = 0;
|
|
b32 running = true;
|
|
while (running) {
|
|
item = wapp_str8_array_get(&array, index);
|
|
result = result && item && (wapp_str8_equal(item, &expected[index]));
|
|
|
|
++index;
|
|
running = index < count;
|
|
}
|
|
|
|
return wapp_tester_result(result);
|
|
}
|