[glib] Improve GCache test coverage
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Improve GCache test coverage
- Date: Sun, 9 Oct 2011 03:50:04 +0000 (UTC)
commit dca6a601c13798dde689cab7f9ac67db2765ae2d
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Oct 5 23:31:14 2011 -0400
Improve GCache test coverage
glib/tests/cache.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/glib/tests/cache.c b/glib/tests/cache.c
index 364bb7d..5ece83d 100644
--- a/glib/tests/cache.c
+++ b/glib/tests/cache.c
@@ -88,6 +88,17 @@ key_foreach (gpointer valuep, gpointer keyp, gpointer data)
}
static void
+value_foreach (gpointer keyp, gpointer nodep, gpointer data)
+{
+ gint *count = data;
+ gint *key = keyp;
+
+ (*count)++;
+
+ g_assert_cmpint (*key, ==, 2);
+}
+
+static void
test_cache_basic (void)
{
GCache *c;
@@ -114,6 +125,10 @@ test_cache_basic (void)
g_cache_key_foreach (c, key_foreach, &count);
g_assert_cmpint (count, ==, 1);
+ count = 0;
+ g_cache_value_foreach (c, value_foreach, &count);
+ g_assert_cmpint (count, ==, 1);
+
value = g_cache_insert (c, key);
g_assert_cmpint (*value, ==, 4);
g_assert_cmpint (value_create_count, ==, 1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]