37 lines
857 B
C
37 lines
857 B
C
// 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 WP_PLATFORM_CPP
|
|
BEGIN_C_LINKAGE
|
|
|
|
#define wpTesterResult(PASSED) (WpTestFuncResult{wpStr8LitRo(__func__), PASSED, {}})
|
|
#else
|
|
#define wpTesterResult(PASSED) ((WpTestFuncResult){.name = wpStr8LitRo(__func__), .passed = PASSED})
|
|
#endif // !WP_PLATFORM_CPP
|
|
|
|
#define wpTesterRun(...) runTests(__VA_ARGS__, NULL)
|
|
|
|
typedef struct WpTestFuncResult WpTestFuncResult;
|
|
struct WpTestFuncResult {
|
|
WpStr8 name;
|
|
b8 passed;
|
|
|
|
wpMiscUtilsReservePadding(sizeof(WpStr8) + sizeof(b8));
|
|
};
|
|
|
|
typedef WpTestFuncResult(WpTestFunc)(void);
|
|
|
|
void runTests(WpTestFunc *func1, ...);
|
|
|
|
#ifdef WP_PLATFORM_CPP
|
|
END_C_LINKAGE
|
|
#endif // !WP_PLATFORM_CPP
|
|
|
|
#endif // !TESTER_H
|