cosms-core/tests/test.h

22 lines
821 B
C

#ifndef COSMS_TEST
#define COSMS_TEST
#include <stdio.h>
#include <stdbool.h>
#define COSMS_CORE_TEST_HEADER(test_module_name) printf("----------------------------------------\n%s\n----------------------------------------\n", test_module_name);
#define COSMS_CORE_TEST_START(test_name) printf("[*] running test %s...\n", test_name)
#define COSMS_CORE_TEST_SUCCESS(test_name) printf("[+] test %s completed successfully!\n", test_name);
#define COSMS_CORE_TEST_FAIL(test_name, error) printf("[-] test %s failed with error: %s\n", test_name, error)
static inline bool cosms_core_test_assert(const char *test_name, bool expression, const char *error_message) {
if (!expression) {
printf("[-] test %s failed with error: %s\n", test_name, error_message);
return false;
}
return true;
}
#endif