mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2025-12-24 21:50:19 +01:00
test: Use cairo_test_list_t for the main test list
Instead of embedding the pointer in the test structure, consistently use the cairo_test_list_t structure for test lists. This cleans up the code as the reverse-list operation can be reused. Moreover this makes the code clearer, because each test list is now independent and has no way to know about other test lists.
This commit is contained in:
parent
abced5b882
commit
603ea229b5
2 changed files with 7 additions and 20 deletions
|
|
@ -107,7 +107,7 @@ typedef enum {
|
|||
GT
|
||||
} cairo_test_compare_op_t;
|
||||
|
||||
static cairo_test_t *tests;
|
||||
static cairo_test_list_t *tests;
|
||||
|
||||
static void CAIRO_BOILERPLATE_PRINTF_FORMAT(2,3)
|
||||
_log (cairo_test_context_t *ctx,
|
||||
|
|
@ -125,18 +125,6 @@ _log (cairo_test_context_t *ctx,
|
|||
va_end (ap);
|
||||
}
|
||||
|
||||
static void
|
||||
_tests_reverse (void)
|
||||
{
|
||||
cairo_test_t *list, *next;
|
||||
|
||||
for (list = tests, tests = NULL; list != NULL; list = next) {
|
||||
next = list->next;
|
||||
list->next = tests;
|
||||
tests = list;
|
||||
}
|
||||
}
|
||||
|
||||
static cairo_test_list_t *
|
||||
_list_prepend (cairo_test_list_t *head, const cairo_test_t *test)
|
||||
{
|
||||
|
|
@ -709,7 +697,7 @@ int
|
|||
main (int argc, char **argv)
|
||||
{
|
||||
cairo_test_runner_t runner;
|
||||
cairo_test_t *test;
|
||||
cairo_test_list_t *test_list;
|
||||
cairo_test_status_t *target_status;
|
||||
unsigned int n, m;
|
||||
char targets[4096];
|
||||
|
|
@ -723,7 +711,7 @@ main (int argc, char **argv)
|
|||
#endif
|
||||
|
||||
_cairo_test_runner_register_tests ();
|
||||
_tests_reverse ();
|
||||
tests = _list_reverse (tests);
|
||||
|
||||
memset (&runner, 0, sizeof (runner));
|
||||
runner.num_device_offsets = 1;
|
||||
|
|
@ -768,7 +756,8 @@ main (int argc, char **argv)
|
|||
runner.base.num_targets);
|
||||
}
|
||||
|
||||
for (test = tests; test != NULL; test = test->next) {
|
||||
for (test_list = tests; test_list != NULL; test_list = test_list->next) {
|
||||
const cairo_test_t *test = test_list->test;
|
||||
cairo_test_context_t ctx;
|
||||
cairo_test_status_t status;
|
||||
cairo_bool_t failed = FALSE, xfailed = FALSE, error = FALSE, crashed = FALSE, skipped = TRUE;
|
||||
|
|
@ -1097,6 +1086,5 @@ main (int argc, char **argv)
|
|||
void
|
||||
cairo_test_register (cairo_test_t *test)
|
||||
{
|
||||
test->next = tests;
|
||||
tests = test;
|
||||
tests = _list_prepend (tests, test);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,7 +153,6 @@ typedef cairo_test_status_t
|
|||
(cairo_test_draw_function_t) (cairo_t *cr, int width, int height);
|
||||
|
||||
struct _cairo_test {
|
||||
struct _cairo_test *next;
|
||||
const char *name;
|
||||
const char *description;
|
||||
const char *keywords;
|
||||
|
|
@ -194,7 +193,7 @@ struct _cairo_test {
|
|||
void _register_##name (void); \
|
||||
void _register_##name (void) { \
|
||||
static cairo_test_t test = { \
|
||||
NULL, #name, description, \
|
||||
#name, description, \
|
||||
keywords, requirements, \
|
||||
width, height, \
|
||||
preamble, draw \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue