summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2011-02-24 13:49:06 +1100
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2011-02-24 14:08:22 +1100
commit50ade52118f3f38ae4e3d36db45654511f17286e (patch)
tree613687bbfaee884f8fc79a8aa295d5c1cc05c017
parent32e152fb296897e7da3faace99da11ac43abd215 (diff)
Sort entities to make test deterministictelepathy-logger-0.2.0
-rw-r--r--tests/dbus/test-tpl-log-store-pidgin.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/dbus/test-tpl-log-store-pidgin.c b/tests/dbus/test-tpl-log-store-pidgin.c
index 7076e74..f8563da 100644
--- a/tests/dbus/test-tpl-log-store-pidgin.c
+++ b/tests/dbus/test-tpl-log-store-pidgin.c
@@ -395,6 +395,15 @@ test_get_events_for_date_jabber (PidginTestCaseFixture *fixture,
g_date_free (date);
}
+static int
+cmp_entities (gconstpointer a,
+ gconstpointer b)
+{
+ return -1 * g_strcmp0 (
+ tpl_entity_get_identifier (TPL_ENTITY (a)),
+ tpl_entity_get_identifier (TPL_ENTITY (b)));
+}
+
static void
test_get_entities_jabber (PidginTestCaseFixture *fixture,
gconstpointer user_data)
@@ -407,6 +416,9 @@ test_get_entities_jabber (PidginTestCaseFixture *fixture,
g_assert_cmpint (g_list_length (l), ==, 2);
+ /* sort the entities, since their ordering depends on the file order */
+ l = g_list_sort (l, cmp_entities);
+
entity = g_list_nth_data (l, 0);
g_assert_cmpstr (tpl_entity_get_identifier (entity), ==,
"user2@collabora.co.uk");