// vim:fileencoding=utf-8:foldmethod=marker

#ifndef TESTER_H
#define TESTER_H

#include "../../common/misc/misc_utils.h"
#include "../../common/platform/platform.h"
#include "../../base/strings/str8/str8.h"

#ifdef WAPP_PLATFORM_CPP
BEGIN_C_LINKAGE

#define wapp_tester_result(PASSED) (TestFuncResult{wapp_str8_lit_ro(__func__), PASSED})
#else
#define wapp_tester_result(PASSED) ((TestFuncResult){.name = wapp_str8_lit_ro(__func__), .passed = PASSED})
#endif // !WAPP_PLATFORM_CPP

#define wapp_tester_run_tests(...) run_tests(__VA_ARGS__, NULL)

typedef struct test_func_result TestFuncResult;
struct test_func_result {
  Str8 name;
  b8 passed;

#ifdef WAPP_PLATFORM_WINDOWS
  wapp_misc_utils_padding_size(sizeof(Str8RO) + sizeof(b8));
#endif // WAPP_PLATFORM_WINDOWS
};

typedef TestFuncResult(TestFunc)(void);

void run_tests(TestFunc *func1, ...);

#ifdef WAPP_PLATFORM_CPP
END_C_LINKAGE
#endif // !WAPP_PLATFORM_CPP

#endif // !TESTER_H
