about summary refs log blame commit diff stats
path: root/html/125write-stream-data.subx.html
blob: b430402bc47ff31122b00a50c163130f06e27be2 (plain) (tree)
/span> roster_add("person@server.org", NULL, groups1, NULL, FALSE); GSList* groups2 = NULL; groups2 = g_slist_append(groups2, strdup("friends")); groups2 = g_slist_append(groups2, strdup("work")); groups2 = g_slist_append(groups2, strdup("different")); roster_add("bob@server.org", NULL, groups2, NULL, FALSE); GList* groups_res = roster_get_groups(); assert_int_equal(g_list_length(groups_res), 4); GList* found = g_list_find_custom(groups_res, "friends", (GCompareFunc)g_strcmp0); assert_true(found != NULL); found = g_list_find_custom(groups_res, "work", (GCompareFunc)g_strcmp0); assert_true(found != NULL); found = g_list_find_custom(groups_res, "stuff", (GCompareFunc)g_strcmp0); assert_true(found != NULL); found = g_list_find_custom(groups_res, "different", (GCompareFunc)g_strcmp0); assert_true(found != NULL); g_list_free_full(groups_res, free); roster_destroy(); } void remove_contact_with_remaining_in_group(void** state) { roster_create(); GSList* groups1 = NULL; groups1 = g_slist_append(groups1, strdup("friends")); groups1 = g_slist_append(groups1, strdup("work")); groups1 = g_slist_append(groups1, strdup("stuff")); roster_add("person@server.org", NULL, groups1, NULL, FALSE); GSList* groups2 = NULL; groups2 = g_slist_append(groups2, strdup("friends")); groups2 = g_slist_append(groups2, strdup("work")); groups2 = g_slist_append(groups2, strdup("different")); roster_add("bob@server.org", NULL, groups2, NULL, FALSE); roster_remove("bob@server.org", "bob@server.org"); GList* groups_res = roster_get_groups(); assert_int_equal(g_list_length(groups_res), 3); GList* found = g_list_find_custom(groups_res, "friends", (GCompareFunc)g_strcmp0); assert_true(found != NULL); found = g_list_find_custom(groups_res, "work", (GCompareFunc)g_strcmp0); assert_true(found != NULL); found = g_list_find_custom(groups_res, "stuff", (GCompareFunc)g_strcmp0); assert_true(found != NULL); g_list_free_full(groups_res, free); roster_destroy(); } void get_contact_display_name(void** state) { roster_create(); roster_add("person@server.org", "nickname", NULL, NULL, FALSE); assert_string_equal("nickname", roster_get_display_name("person@server.org")); roster_destroy(); } void get_contact_display_name_is_barejid_if_name_is_empty(void** state) { roster_create(); roster_add("person@server.org", NULL, NULL, NULL, FALSE); assert_string_equal("person@server.org", roster_get_display_name("person@server.org")); roster_destroy(); } void get_contact_display_name_is_passed_barejid_if_contact_does_not_exist(void** state) { roster_create(); assert_string_equal("person@server.org", roster_get_display_name("person@server.org")); roster_destroy(); }