|
| #define | ACUTEST_ATTRIBUTE_(attr) |
| |
| #define | ACUTEST_CMDLINE_AUXBUF_SIZE_ 32 |
| |
| #define | ACUTEST_CMDLINE_OPTFLAG_OPTIONALARG_ 0x0001 |
| |
| #define | ACUTEST_CMDLINE_OPTFLAG_REQUIREDARG_ 0x0002 |
| |
| #define | ACUTEST_CMDLINE_OPTID_BOGUSARG_ (-0x7fffffff + 2) |
| |
| #define | ACUTEST_CMDLINE_OPTID_MISSINGARG_ (-0x7fffffff + 1) |
| |
| #define | ACUTEST_CMDLINE_OPTID_NONE_ 0 |
| |
| #define | ACUTEST_CMDLINE_OPTID_UNKNOWN_ (-0x7fffffff + 0) |
| |
| #define | ACUTEST_COLOR_DEFAULT_ 0 |
| |
| #define | ACUTEST_COLOR_DEFAULT_INTENSIVE_ 3 |
| |
| #define | ACUTEST_COLOR_GREEN_ 1 |
| |
| #define | ACUTEST_COLOR_GREEN_INTENSIVE_ 4 |
| |
| #define | ACUTEST_COLOR_RED_ 2 |
| |
| #define | ACUTEST_COLOR_RED_INTENSIVE_ 5 |
| |
| #define | TEST_ASSERT(cond) |
| |
| #define | TEST_ASSERT_(cond, ...) |
| |
| #define | TEST_CASE(name) acutest_case_("%s", name) |
| |
| #define | TEST_CASE_(...) acutest_case_(__VA_ARGS__) |
| |
| #define | TEST_CASE_MAXSIZE 64 |
| |
| #define | TEST_CHECK(cond) acutest_check_((cond), __FILE__, __LINE__, "%s", #cond) |
| |
| #define | TEST_CHECK_(cond, ...) acutest_check_((cond), __FILE__, __LINE__, __VA_ARGS__) |
| |
| #define | TEST_DUMP(title, addr, size) TEST_DUMP_FAIL(title, addr, size) |
| |
| #define | TEST_DUMP_ALWAYS(title, addr, size) acutest_dump_(true, title, addr, size); |
| |
| #define | TEST_DUMP_FAIL(title, addr, size) acutest_dump_(false, title, addr, size); |
| |
| #define | TEST_DUMP_MAXSIZE 1024 |
| |
| #define | TEST_LIST const struct acutest_test_ acutest_list_[] |
| |
| #define | TEST_LOG_MAXSIZE ((TEST_DUMP_MAXSIZE * 3) + TEST_MSG_MAXSIZE + 3) |
| |
| #define | TEST_MSG(...) TEST_MSG_FAIL(__VA_ARGS__) |
| |
| #define | TEST_MSG_ALWAYS(...) acutest_message_(true, __VA_ARGS__) |
| |
| #define | TEST_MSG_FAIL(...) acutest_message_(false, __VA_ARGS__) |
| |
| #define | TEST_MSG_MAXSIZE 1024 |
| |
| #define | TEST_TERMINATOR { .name = NULL } |
| |
|
| void | acutest_abort_ (void) ACUTEST_ATTRIBUTE_(noreturn) |
| |
| void | ACUTEST_ATTRIBUTE_ (format(printf, 1, 2)) acutest_log_(const char *fmt |
| |
| static int | ACUTEST_ATTRIBUTE_ (format(printf, 2, 3)) acutest_colored_printf_(int color |
| |
| int | ACUTEST_ATTRIBUTE_ (format(printf, 4, 5)) acutest_check_(int cond |
| |
| static void | ACUTEST_ATTRIBUTE_ (noreturn) acutest_exit_(int exit_code) |
| |
| static void | acutest_begin_test_line_ (const struct acutest_test_ *test) |
| |
| void | acutest_case_ (const char *fmt,...) |
| |
| int | acutest_check_ (int cond, const char *file, int line, const char *fmt,...) |
| |
| static void | acutest_cleanup_ (void) |
| |
| static int | acutest_cmdline_callback_ (int id, const char *arg) |
| |
| static int | acutest_cmdline_handle_short_opt_group_ (const ACUTEST_CMDLINE_OPTION_ *options, const char *arggroup, int(*callback)(int, const char *)) |
| |
| static int | acutest_cmdline_read_ (const ACUTEST_CMDLINE_OPTION_ *options, int argc, char **argv, int(*callback)(int, const char *)) |
| |
| static int | acutest_do_run_ (const struct acutest_test_ *test, int index) |
| |
| void | acutest_dump_ (bool always, const char *title, const void *addr, size_t size) |
| |
| static void | acutest_fini_ (const char *test_name) |
| |
| static void | acutest_finish_test_line_ (int result) |
| |
| static void | acutest_help_ (void) |
| |
| static void | acutest_init_ (const char *test_name) |
| |
| static void | acutest_line_indent_ (int level) |
| |
| static void | acutest_list_names_ (void) |
| |
| | acutest_log_ ("%s", buffer) |
| |
| void | acutest_log_ (const char *fmt,...) |
| |
| static int | acutest_lookup_ (const char *pattern) |
| |
| void | acutest_message_ (bool always, const char *fmt,...) |
| |
| static int | acutest_name_contains_word_ (const char *name, const char *pattern) |
| |
| static void | acutest_remember_ (int i) |
| |
| static void | acutest_run_ (const struct acutest_test_ *test, int index, int master_index) |
| |
| static void | acutest_set_duration_ (int i, double duration) |
| |
| static void | acutest_set_success_ (int i, int success) |
| |
| static double | acutest_timer_diff_ (int start, int end) |
| |
| static void | acutest_timer_get_time_ (int *ts) |
| |
| void | acutest_timer_init_ (void) |
| |
| static void | acutest_timer_print_diff_ (void) |
| |
| | if (!acutest_colorize_) |
| |
| | if (!acutest_test_data_[acutest_current_index_].log_head) acutest_test_data_[acutest_current_index_].log_head |
| |
| | if ((acutest_current_test_==NULL||!acutest_cond_failed_) &&!always) return |
| |
| | if (acutest_case_name_[0]) |
| |
| | if (acutest_test_data_[acutest_current_index_].log_tail) acutest_test_data_[acutest_current_index_].log_tail -> next=log_entry |
| |
| | if (acutest_verbose_level_ >=verbose_level) |
| |
| void | if (acutest_verbose_level_< 2) return |
| |
| | if (cond) |
| |
| | if (fmt==NULL) return |
| |
| | if (line_beg[0] !='\0') |
| |
| | if (log_entry->msg==NULL) |
| |
| | if (log_entry==NULL) |
| |
| int | main (int argc, char **argv) |
| |
| | strcpy (log_entry->msg, buffer) |
| |
| | va_end (args) |
| |
| | va_start (args, fmt) |
| |
| | vsnprintf (acutest_case_name_, sizeof(acutest_case_name_) - 1, fmt, args) |
| |
| | vsnprintf (buffer, sizeof(buffer), fmt, args) |
| |
| | vsnprintf (buffer, TEST_LOG_MAXSIZE - 1, fmt, args) |
| |
| | vsnprintf (buffer, TEST_MSG_MAXSIZE, fmt, args) |
| |
| | while (1) |
| |