Rename Tester
This commit is contained in:
@@ -8,23 +8,23 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
wp_intern void handle_test_result(TestFuncResult result);
|
||||
wp_intern void handleTestResult(WpTestFuncResult result);
|
||||
|
||||
void run_tests(TestFunc *func1, ...) {
|
||||
void _runTests(WpTestFunc *func1, ...) {
|
||||
printf("\n");
|
||||
|
||||
handle_test_result(func1());
|
||||
handleTestResult(func1());
|
||||
|
||||
va_list args;
|
||||
va_start(args, func1);
|
||||
|
||||
TestFunc *func = va_arg(args, TestFunc *);
|
||||
WpTestFunc *func = va_arg(args, WpTestFunc *);
|
||||
|
||||
while (func) {
|
||||
TestFuncResult result = func();
|
||||
handle_test_result(result);
|
||||
WpTestFuncResult result = func();
|
||||
handleTestResult(result);
|
||||
|
||||
func = va_arg(args, TestFunc *);
|
||||
func = va_arg(args, WpTestFunc *);
|
||||
}
|
||||
|
||||
va_end(args);
|
||||
@@ -32,7 +32,7 @@ void run_tests(TestFunc *func1, ...) {
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
wp_intern void handle_test_result(TestFuncResult result) {
|
||||
wp_intern void handleTestResult(WpTestFuncResult result) {
|
||||
TerminalColour colour;
|
||||
Str8 result_text = wapp_str8_buf(64);
|
||||
|
||||
|
||||
@@ -10,24 +10,24 @@
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
BEGIN_C_LINKAGE
|
||||
|
||||
#define wapp_tester_result(PASSED) (TestFuncResult{wapp_str8_lit_ro(__func__), PASSED, {}})
|
||||
#define wpTesterResult(PASSED) (WpTestFuncResult{wapp_str8_lit_ro(__func__), PASSED, {}})
|
||||
#else
|
||||
#define wapp_tester_result(PASSED) ((TestFuncResult){.name = wapp_str8_lit_ro(__func__), .passed = PASSED})
|
||||
#define wpTesterResult(PASSED) ((WpTestFuncResult){.name = wapp_str8_lit_ro(__func__), .passed = PASSED})
|
||||
#endif // !WP_PLATFORM_CPP
|
||||
|
||||
#define wapp_tester_run_tests(...) run_tests(__VA_ARGS__, NULL)
|
||||
#define wpTesterRun(...) _runTests(__VA_ARGS__, NULL)
|
||||
|
||||
typedef struct TestFuncResult TestFuncResult;
|
||||
struct TestFuncResult {
|
||||
typedef struct WpTestFuncResult WpTestFuncResult;
|
||||
struct WpTestFuncResult {
|
||||
Str8 name;
|
||||
b8 passed;
|
||||
|
||||
wpMiscUtilsReservePadding(sizeof(Str8) + sizeof(b8));
|
||||
};
|
||||
|
||||
typedef TestFuncResult(TestFunc)(void);
|
||||
typedef WpTestFuncResult(WpTestFunc)(void);
|
||||
|
||||
void run_tests(TestFunc *func1, ...);
|
||||
void _runTests(WpTestFunc *func1, ...);
|
||||
|
||||
#ifdef WP_PLATFORM_CPP
|
||||
END_C_LINKAGE
|
||||
|
||||
Reference in New Issue
Block a user