42 typedef enum unit_test_result {
43 unit_test_failure = 0,
52 const char *
const descr;
53 const char *
const test_file;
54 unit_test_result_t result;
70 #define UNIT_TEST_REGISTER(name, descr) static unit_test_t unit_test_##name = {descr, __FILE__, unit_test_success, 0, 0, 0} 91 #define UNIT_TEST(name) static void unit_test_function_##name(unit_test_t *utp) 96 #define UNIT_TEST_BEGIN() do { \ 97 utp->start = RTIMER_NOW(); \ 98 utp->result = unit_test_success; \ 104 #define UNIT_TEST_END() UNIT_TEST_SUCCEED(); \ 106 utp->end = RTIMER_NOW() 114 #ifndef UNIT_TEST_PRINT_FUNCTION 115 #define UNIT_TEST_PRINT_FUNCTION unit_test_print_report 123 #define UNIT_TEST_PRINT_REPORT(name) UNIT_TEST_PRINT_FUNCTION(&unit_test_##name) 130 #define UNIT_TEST_RUN(name) do { \ 131 unit_test_function_##name(&unit_test_##name); \ 132 UNIT_TEST_PRINT_REPORT(name); \ 147 #define UNIT_TEST_SUCCEED() do { \ 148 utp->exit_line = __LINE__; \ 149 goto unit_test_end; \ 159 #define UNIT_TEST_FAIL() do { \ 160 utp->exit_line = __LINE__; \ 161 utp->result = unit_test_failure; \ 162 goto unit_test_end; \ 170 #define UNIT_TEST_ASSERT(expr) do { \ 185 #define UNIT_TEST_RESULT(name) (unit_test_##name.result) 188 void UNIT_TEST_PRINT_FUNCTION(
const unit_test_t *utp);
struct unit_test unit_test_t
The unit_test structure describes the results of a unit test.
Header file for the real-time timer module.
The unit_test structure describes the results of a unit test.