summaryrefslogtreecommitdiff
path: root/glib/tests/hash.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2011-06-19 01:04:30 -0400
committerMatthias Clasen <mclasen@redhat.com>2011-06-19 01:04:30 -0400
commited3ac87afe51de67b631abf5f8dc50622b141a8b (patch)
treef4dbc6ce4955e3874527c17be31580dd9188673b /glib/tests/hash.c
parentc4796a4d7a9bbbfbcf9ec82d0cdc442cdccb8113 (diff)
downloadglib-ed3ac87afe51de67b631abf5f8dc50622b141a8b.tar.gz
hash: Improve test coverage
Diffstat (limited to 'glib/tests/hash.c')
-rw-r--r--glib/tests/hash.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/glib/tests/hash.c b/glib/tests/hash.c
index f42dd592d..8ef8208da 100644
--- a/glib/tests/hash.c
+++ b/glib/tests/hash.c
@@ -709,6 +709,7 @@ static void
test_remove_all (void)
{
GHashTable *h;
+ gboolean res;
h = g_hash_table_new_full (g_str_hash, g_str_equal, key_destroy, value_destroy);
g_hash_table_insert (h, "abc", "ABC");
@@ -726,9 +727,19 @@ test_remove_all (void)
g_hash_table_insert (h, "cde", "CDE");
g_hash_table_insert (h, "xyz", "XYZ");
+ res = g_hash_table_steal (h, "nosuchkey");
+ g_assert (!res);
+ g_assert_cmpint (destroy_counter, ==, 0);
+ g_assert_cmpint (destroy_key_counter, ==, 0);
+
+ res = g_hash_table_steal (h, "xyz");
+ g_assert (res);
+ g_assert_cmpint (destroy_counter, ==, 0);
+ g_assert_cmpint (destroy_key_counter, ==, 0);
+
g_hash_table_remove_all (h);
- g_assert_cmpint (destroy_counter, ==, 3);
- g_assert_cmpint (destroy_key_counter, ==, 3);
+ g_assert_cmpint (destroy_counter, ==, 2);
+ g_assert_cmpint (destroy_key_counter, ==, 2);
g_hash_table_unref (h);
}