--- a/libpurple/tests/.hgignore Thu Jun 01 19:59:58 2017 -0500
+++ b/libpurple/tests/.hgignore Thu Jun 08 22:28:30 2017 -0500
@@ -5,6 +5,7 @@
--- a/libpurple/tests/Makefile.am Thu Jun 01 19:59:58 2017 -0500
+++ b/libpurple/tests/Makefile.am Thu Jun 08 22:28:30 2017 -0500
@@ -11,6 +11,7 @@
@@ -30,6 +31,9 @@
test_smiley_SOURCES=test_smiley.c
test_smiley_LDADD=$(COMMON_LIBS)
+test_smiley_list_SOURCES=test_smiley_list.c +test_smiley_list_LDADD=$(COMMON_LIBS) test_trie_SOURCES=test_trie.c
test_trie_LDADD=$(COMMON_LIBS)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/libpurple/tests/test_smiley_list.c Thu Jun 08 22:28:30 2017 -0500
@@ -0,0 +1,82 @@
+ * Purple is the legal property of its developers, whose names are too + * numerous to list here. Please refer to the COPYRIGHT file distributed + * with this source distribution + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA +/****************************************************************************** + *****************************************************************************/ +test_smiley_list_new(void) { + PurpleSmileyList *list = NULL; + list = purple_smiley_list_new(); + g_assert(purple_smiley_list_is_empty(list)); + g_assert(purple_smiley_list_get_unique(list) == NULL); + g_assert(purple_smiley_list_get_all(list) == NULL); +test_smiley_list_add_remove(void) { + PurpleSmileyList *list = NULL; + PurpleSmiley *smiley = NULL; + gboolean added = FALSE; + list = purple_smiley_list_new(); + g_assert(purple_smiley_list_is_empty(list)); + smiley = purple_smiley_new_from_data("testing", NULL, 0); + // add the smiley to the list + added = purple_smiley_list_add(list, smiley); + g_assert(!purple_smiley_list_is_empty(list)); + // add it again (should fail) + added = purple_smiley_list_add(list, smiley); + // now remove it and make sure the list is empty + purple_smiley_list_remove(list, smiley); + g_assert(purple_smiley_list_is_empty(list)); + g_object_unref(G_OBJECT(smiley)); + g_object_unref(G_OBJECT(list)); +/****************************************************************************** + *****************************************************************************/ +main(gint argc, gchar **argv) { + g_test_init(&argc, &argv, NULL); + g_test_add_func("/smiley_list/new", test_smiley_list_new); + g_test_add_func("/smiley_list/add-remove", test_smiley_list_add_remove);