Replace functions which called once with their bodies
[pidgin-git.git] / libpurple / tests / test_attention_type.c
blobf4738b67c8b402ebb35c3373bf046a55a046120b
1 /*
2 * Purple
4 * Purple is the legal property of its developers, whose names are too
5 * numerous to list here. Please refer to the COPYRIGHT file distributed
6 * with this source distribution
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or (at
11 * your option) any later version.
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
23 #include <glib.h>
24 #include <string.h>
26 #include <purple.h>
28 /******************************************************************************
29 * Tests
30 *****************************************************************************/
31 static void
32 test_purple_attention_type_new(void) {
33 PurpleAttentionType *type = NULL;
35 type = purple_attention_type_new("id", "name", "incoming", "outgoing");
37 /* check the values new sets */
38 g_assert_cmpstr(purple_attention_type_get_unlocalized_name(type), ==, "id");
39 g_assert_cmpstr(purple_attention_type_get_name(type), ==, "name");
40 g_assert_cmpstr(purple_attention_type_get_incoming_desc(type), ==, "incoming");
41 g_assert_cmpstr(purple_attention_type_get_outgoing_desc(type), ==, "outgoing");
43 /* check that default values are correct */
44 g_assert_cmpstr(purple_attention_type_get_icon_name(type), ==, NULL);
46 g_free(type);
49 static void
50 test_purple_attention_type_copy(void) {
51 PurpleAttentionType *type1 = NULL, *type2 = NULL;
53 type1 = purple_attention_type_new("id", "name", "incoming", "outgoing");
55 type2 = purple_attention_type_copy(type1);
57 /* check the values new sets */
58 g_assert_cmpstr(purple_attention_type_get_unlocalized_name(type2), ==, "id");
59 g_assert_cmpstr(purple_attention_type_get_name(type2), ==, "name");
60 g_assert_cmpstr(purple_attention_type_get_incoming_desc(type2), ==, "incoming");
61 g_assert_cmpstr(purple_attention_type_get_outgoing_desc(type2), ==, "outgoing");
63 /* check that default values are correct */
64 g_assert_cmpstr(purple_attention_type_get_icon_name(type2), ==, NULL);
66 g_free(type1);
67 g_free(type2);
70 static void
71 test_purple_attention_type_set_unlocalized_name(void) {
72 PurpleAttentionType *type = NULL;
74 type = purple_attention_type_new("id", "name", "incoming", "outgoing");
76 purple_attention_type_set_unlocalized_name(type, "this-is-my-id");
77 g_assert_cmpstr(purple_attention_type_get_unlocalized_name(type), ==, "this-is-my-id");
79 g_free(type);
82 static void
83 test_purple_attention_type_set_name(void) {
84 PurpleAttentionType *type = NULL;
86 type = purple_attention_type_new("id", "name", "incoming", "outgoing");
88 purple_attention_type_set_name(type, "this-is-my-name");
89 g_assert_cmpstr(purple_attention_type_get_name(type), ==, "this-is-my-name");
91 g_free(type);
94 static void
95 test_purple_attention_type_set_incoming_desc(void) {
96 PurpleAttentionType *type = NULL;
98 type = purple_attention_type_new("id", "name", "incoming", "outgoing");
100 purple_attention_type_set_incoming_desc(type, "this-is-my-incoming-desc");
101 g_assert_cmpstr(purple_attention_type_get_incoming_desc(type), ==, "this-is-my-incoming-desc");
103 g_free(type);
106 static void
107 test_purple_attention_type_set_outgoing_desc(void) {
108 PurpleAttentionType *type = NULL;
110 type = purple_attention_type_new("id", "name", "incoming", "outgoing");
112 purple_attention_type_set_outgoing_desc(type, "this-is-my-outgoing-desc");
113 g_assert_cmpstr(purple_attention_type_get_outgoing_desc(type), ==, "this-is-my-outgoing-desc");
115 g_free(type);
118 static void
119 test_purple_attention_type_set_icon_name(void) {
120 PurpleAttentionType *type = NULL;
122 type = purple_attention_type_new("id", "name", "incoming", "outgoing");
124 purple_attention_type_set_icon_name(type, "this-is-my-icon-name");
125 g_assert_cmpstr(purple_attention_type_get_icon_name(type), ==, "this-is-my-icon-name");
127 g_free(type);
130 /******************************************************************************
131 * Main
132 *****************************************************************************/
133 gint
134 main(gint argc, gchar **argv) {
135 gint res = 0;
137 g_test_init(&argc, &argv, NULL);
139 g_test_set_nonfatal_assertions();
141 g_test_add_func(
142 "/attention-type/new",
143 test_purple_attention_type_new
146 g_test_add_func(
147 "/attention-type/copy",
148 test_purple_attention_type_copy
151 g_test_add_func(
152 "/attention-type/set-unlocalized-name",
153 test_purple_attention_type_set_unlocalized_name
156 g_test_add_func(
157 "/attention-type/set-name",
158 test_purple_attention_type_set_name
161 g_test_add_func(
162 "/attention-type/set-incoming-desc",
163 test_purple_attention_type_set_incoming_desc
166 g_test_add_func(
167 "/attention-type/set-outgoing-desc",
168 test_purple_attention_type_set_outgoing_desc
171 g_test_add_func(
172 "/attention-type/set-icon-name",
173 test_purple_attention_type_set_icon_name
176 res = g_test_run();
178 return res;