Add testing utilities

This commit is contained in:
2024-06-02 23:34:53 +01:00
parent 55d0c25c90
commit 59f1c3eb58
2 changed files with 74 additions and 0 deletions

26
src/tester/tester.h Normal file
View File

@@ -0,0 +1,26 @@
#ifndef TESTER_H
#define TESTER_H
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#define TEST_RESULT(BOOL) ((TestFuncResult){.name = __func__, .success = BOOL})
typedef struct test_func_result TestFuncResult;
struct test_func_result {
const char *name;
bool success;
};
typedef TestFuncResult(TestFunc)(void);
void run_tests(TestFunc *func1, ...);
#ifdef __cplusplus
}
#endif // __cplusplus
#endif // !TESTER_H