Improve GCache test coverage

This commit is contained in:
Matthias Clasen 2011-10-05 23:31:14 -04:00
parent eeedaac3e8
commit dca6a601c1

View File

@ -87,6 +87,17 @@ key_foreach (gpointer valuep, gpointer keyp, gpointer data)
g_assert_cmpint (*key, ==, 2);
}
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)
{
@ -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);