From 2a43ce17057638667ffefb4909632100149a71d8 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 24 Jul 2020 15:37:49 -0400 Subject: [PATCH] testsuite: Use better names for sortlistmodel tests Name the tests for what they do. --- testsuite/gtk/sortlistmodel-exhaustive.c | 28 +++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/testsuite/gtk/sortlistmodel-exhaustive.c b/testsuite/gtk/sortlistmodel-exhaustive.c index 8c1a208b81..519df756ad 100644 --- a/testsuite/gtk/sortlistmodel-exhaustive.c +++ b/testsuite/gtk/sortlistmodel-exhaustive.c @@ -167,6 +167,29 @@ sort_list_model_new (GListModel *source, #define N_MODELS 8 +static char * +create_test_name (guint id) +{ + GString *s = g_string_new (""); + + if (id & (1 << 0)) + g_string_append (s, "set-model"); + else + g_string_append (s, "construct-with-model"); + + if (id & (1 << 1)) + g_string_append (s, "/set-sorter"); + else + g_string_append (s, "/construct-with-sorter"); + + if (id & (1 << 2)) + g_string_append (s, "/incremental"); + else + g_string_append (s, "/non-incremental"); + + return g_string_free (s, FALSE); +} + static GtkSortListModel * create_sort_list_model (gconstpointer model_id, gboolean track_changes, @@ -418,12 +441,15 @@ add_test_for_all_models (const char *name, GTestDataFunc test_func) { guint i; + char *test; for (i = 0; i < N_MODELS; i++) { - char *path = g_strdup_printf ("/sorterlistmodel/model%u/%s", i, name); + test = create_test_name (i); + char *path = g_strdup_printf ("/sorterlistmodel/%s/%s", test, name); g_test_add_data_func (path, GUINT_TO_POINTER (i), test_func); g_free (path); + g_free (test); } }