mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-03-30 20:33:08 +02:00
Improve GCache test coverage
This commit is contained in:
parent
eeedaac3e8
commit
dca6a601c1
@ -87,6 +87,17 @@ key_foreach (gpointer valuep, gpointer keyp, gpointer data)
|
|||||||
g_assert_cmpint (*key, ==, 2);
|
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
|
static void
|
||||||
test_cache_basic (void)
|
test_cache_basic (void)
|
||||||
{
|
{
|
||||||
@ -114,6 +125,10 @@ test_cache_basic (void)
|
|||||||
g_cache_key_foreach (c, key_foreach, &count);
|
g_cache_key_foreach (c, key_foreach, &count);
|
||||||
g_assert_cmpint (count, ==, 1);
|
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);
|
value = g_cache_insert (c, key);
|
||||||
g_assert_cmpint (*value, ==, 4);
|
g_assert_cmpint (*value, ==, 4);
|
||||||
g_assert_cmpint (value_create_count, ==, 1);
|
g_assert_cmpint (value_create_count, ==, 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user