// 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 str1       = wapp_str8_lit("Hello");
  Str8 str2       = wapp_str8_lit("Hi");
  Str8 str3       = wapp_str8_lit("Bye");
  Str8Array array = wapp_array(Str8, Str8Array, str1, str2, str3);

  result = array.count == 3 && array.capacity == 8;

  Str8 *item;
  u64 count   = array.count;
  u64 index   = 0;
  b8 running = true;
  while (running) {
    item   = wapp_array_get(Str8, &array, index);
    result = result && item && (wapp_str8_equal(item, &expected[index]));

    ++index;
    running = index < count;
  }

  return wapp_tester_result(result);
}
