diff options
Diffstat (limited to 'src/tests/testclient.c')
-rw-r--r-- | src/tests/testclient.c | 65 |
1 files changed, 35 insertions, 30 deletions
diff --git a/src/tests/testclient.c b/src/tests/testclient.c index e58d6f4..b781821 100644 --- a/src/tests/testclient.c +++ b/src/tests/testclient.c @@ -1304,63 +1304,68 @@ test_hash_table_of_structures (void) /* ---------------------------------------------------------------------------------------------------- */ -#if 0 static void test_hash_table_of_hash_table_of_structures (void) { GError *error; - GHashTable *hash_of_points; - GHashTable *hash_of_hash_of_points; - GHashTable *res_hash_of_hash_of_points; + EggDBusHashMap *hash_of_points; + EggDBusHashMap *hash_of_hash_of_points; + EggDBusHashMap *ret_hash_of_hash_of_points; TestPoint *point; error = NULL; - hash_of_hash_of_points = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) g_hash_table_unref); - hash_of_points = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref); - g_hash_table_insert (hash_of_points, "alpha", test_point_new (10, 10)); - g_hash_table_insert (hash_of_points, "beta", test_point_new (12, 12)); - g_hash_table_insert (hash_of_points, "gamma", test_point_new (14, 14)); - g_hash_table_insert (hash_of_hash_of_points, "org1", hash_of_points); - hash_of_points = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref); - g_hash_table_insert (hash_of_points, "rip", test_point_new (1, 1)); - g_hash_table_insert (hash_of_points, "rap", test_point_new (2, 2)); - g_hash_table_insert (hash_of_points, "rup", test_point_new (3, 3)); - g_hash_table_insert (hash_of_hash_of_points, "org2", hash_of_points); - g_assert (test_frob_invoke_test_hash_table_of_hash_tables_of_structures_sync (TEST_QUERY_INTERFACE_FROB (object_proxy), 0, /* flags */ + hash_of_hash_of_points = egg_dbus_hash_map_new (G_TYPE_STRING, NULL, EGG_DBUS_TYPE_HASH_MAP, g_object_unref); + + hash_of_points = egg_dbus_hash_map_new (G_TYPE_STRING, NULL, TEST_TYPE_POINT, g_object_unref); + egg_dbus_hash_map_insert (hash_of_points, "alpha", test_point_new (10, 10)); + egg_dbus_hash_map_insert (hash_of_points, "beta", test_point_new (12, 12)); + egg_dbus_hash_map_insert (hash_of_points, "gamma", test_point_new (14, 14)); + egg_dbus_hash_map_insert (hash_of_hash_of_points, "org1", hash_of_points); + + hash_of_points = egg_dbus_hash_map_new (G_TYPE_STRING, NULL, TEST_TYPE_POINT, g_object_unref); + egg_dbus_hash_map_insert (hash_of_points, "rip", test_point_new (1, 1)); + egg_dbus_hash_map_insert (hash_of_points, "rap", test_point_new (2, 2)); + egg_dbus_hash_map_insert (hash_of_points, "rup", test_point_new (3, 3)); + egg_dbus_hash_map_insert (hash_of_hash_of_points, "org2", hash_of_points); + + g_assert (test_frob_invoke_test_hash_table_of_hash_tables_of_structures_sync (TEST_QUERY_INTERFACE_FROB (object_proxy), + 0, /* flags */ hash_of_hash_of_points, - &res_hash_of_hash_of_points, + &ret_hash_of_hash_of_points, NULL, &error)); g_assert_no_error (error); - g_hash_table_unref (hash_of_hash_of_points); + g_object_unref (hash_of_hash_of_points); - hash_of_points = g_hash_table_lookup (res_hash_of_hash_of_points, "org1_new"); - point = g_hash_table_lookup (hash_of_points, "alpha_new_new"); + hash_of_points = egg_dbus_hash_map_lookup (ret_hash_of_hash_of_points, "org1_new"); + point = egg_dbus_hash_map_lookup (hash_of_points, "alpha_new_new"); g_assert_cmpint (test_point_get_x (point), ==, 10 + 100); g_assert_cmpint (test_point_get_y (point), ==, 10 + 200); - point = g_hash_table_lookup (hash_of_points, "beta_new_new"); + point = egg_dbus_hash_map_lookup (hash_of_points, "beta_new_new"); g_assert_cmpint (test_point_get_x (point), ==, 12 + 100); g_assert_cmpint (test_point_get_y (point), ==, 12 + 200); - point = g_hash_table_lookup (hash_of_points, "gamma_new_new"); + point = egg_dbus_hash_map_lookup (hash_of_points, "gamma_new_new"); g_assert_cmpint (test_point_get_x (point), ==, 14 + 100); g_assert_cmpint (test_point_get_y (point), ==, 14 + 200); - hash_of_points = g_hash_table_lookup (res_hash_of_hash_of_points, "org2_new"); - point = g_hash_table_lookup (hash_of_points, "rip_new_new"); + + hash_of_points = egg_dbus_hash_map_lookup (ret_hash_of_hash_of_points, "org2_new"); + point = egg_dbus_hash_map_lookup (hash_of_points, "rip_new_new"); g_assert_cmpint (test_point_get_x (point), ==, 1 + 100); g_assert_cmpint (test_point_get_y (point), ==, 1 + 200); - point = g_hash_table_lookup (hash_of_points, "rap_new_new"); + point = egg_dbus_hash_map_lookup (hash_of_points, "rap_new_new"); g_assert_cmpint (test_point_get_x (point), ==, 2 + 100); g_assert_cmpint (test_point_get_y (point), ==, 2 + 200); - point = g_hash_table_lookup (hash_of_points, "rup_new_new"); + point = egg_dbus_hash_map_lookup (hash_of_points, "rup_new_new"); g_assert_cmpint (test_point_get_x (point), ==, 3 + 100); g_assert_cmpint (test_point_get_y (point), ==, 3 + 200); - egg_dbus_hash_table_unref (res_hash_of_hash_of_points); + g_object_unref (ret_hash_of_hash_of_points); } /* ---------------------------------------------------------------------------------------------------- */ +#if 0 static void test_array_of_hash_table_of_structures (void) { @@ -4348,8 +4353,8 @@ main (int argc, char *argv[]) */ /* Test collection classes */ - test_egg_dbus_array_seq (); - test_egg_dbus_hash_map (); + //test_egg_dbus_array_seq (); + //test_egg_dbus_hash_map (); /* Tests for code generator * @@ -4386,7 +4391,7 @@ main (int argc, char *argv[]) test_hash_tables (); test_hash_tables_of_arrays (); test_hash_table_of_structures (); - /*test_hash_table_of_hash_table_of_structures ();*/ + test_hash_table_of_hash_table_of_structures (); /*test_array_of_hash_table_of_structures ();*/ /*test_array_of_arrays ();*/ /*test_variant_return ();*/ |