[libgnome-keyring] Don't assume the returned item ids are in a specific order.
- From: Stefan Walter <stefw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libgnome-keyring] Don't assume the returned item ids are in a specific order.
- Date: Mon, 14 Dec 2009 15:12:27 +0000 (UTC)
commit 18fa50fa88a5ebe6957c728eea63734ca1c31298
Author: Stef Walter <stef memberwebs com>
Date: Sat Dec 12 22:24:08 2009 +0000
Don't assume the returned item ids are in a specific order.
library/tests/test-keyrings.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/library/tests/test-keyrings.c b/library/tests/test-keyrings.c
index 69d8a63..f466af2 100644
--- a/library/tests/test-keyrings.c
+++ b/library/tests/test-keyrings.c
@@ -99,6 +99,14 @@ DEFINE_TEST(recreate_keyring)
g_assert_cmpint (GNOME_KEYRING_RESULT_OK, ==, res);
}
+static gint
+compare_ids (gconstpointer a, gconstpointer b)
+{
+ if (a < b)
+ return -1;
+ return a == b ? 0 : 1;
+}
+
DEFINE_TEST(create_list_items)
{
GnomeKeyringResult res;
@@ -152,6 +160,7 @@ DEFINE_TEST(create_list_items)
/* "Wrong number of ids created" */
g_assert_cmpint (g_list_length (ids), ==, 2);
if (g_list_length (ids) == 2) {
+ ids = g_list_sort (ids, compare_ids);
g_assert_cmpint (id, ==, GPOINTER_TO_UINT (ids->data));
g_assert_cmpint (id2, ==, GPOINTER_TO_UINT (ids->next->data));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]