Replace functions which called once with their bodies
[pidgin-git.git] / libpurple / tests / test_protocol_action.c
blobd3a4ee63b4101b728c59ee3f88d7779b2aea3cce
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>
25 #include <purple.h>
27 /******************************************************************************
28 * Helpers
29 *****************************************************************************/
30 static void
31 _test_purple_protocol_action_callback(PurpleProtocolAction *action) {
34 /******************************************************************************
35 * Tests
36 *****************************************************************************/
37 static void
38 test_purple_protocol_action_new(void) {
39 PurpleProtocolAction *action = NULL;
41 action = purple_protocol_action_new(
42 "label",
43 _test_purple_protocol_action_callback
45 g_assert_nonnull(action);
47 g_assert_cmpstr(action->label, ==, "label");
48 g_assert(action->callback == _test_purple_protocol_action_callback);
50 purple_protocol_action_free(action);
53 static void
54 test_purple_protocol_action_copy(void) {
55 PurpleProtocolAction *orig = NULL, *copy = NULL;
57 orig = purple_protocol_action_new(
58 "label",
59 _test_purple_protocol_action_callback
61 g_assert_nonnull(orig);
63 copy = purple_protocol_action_copy(orig);
64 purple_protocol_action_free(orig);
66 g_assert_cmpstr(copy->label, ==, "label");
67 g_assert(copy->callback == _test_purple_protocol_action_callback);
69 purple_protocol_action_free(copy);
72 /******************************************************************************
73 * Main
74 *****************************************************************************/
75 gint
76 main(gint argc, gchar **argv) {
77 gint res = 0;
79 g_test_init(&argc, &argv, NULL);
81 g_test_set_nonfatal_assertions();
83 g_test_add_func(
84 "/protocol-action/new",
85 test_purple_protocol_action_new
88 g_test_add_func(
89 "/protocol-action/copy",
90 test_purple_protocol_action_copy
93 res = g_test_run();
95 return res;