add empathy_connection_managers_call_when_ready
[empathy-mirror.git] / tests / test-irc-helper.c
blobade247f398bd29af71a12369a278ceaf1399a401
1 #include "test-irc-helper.h"
3 void
4 check_server (EmpathyIrcServer *server,
5 const gchar *_address,
6 guint _port,
7 gboolean _ssl)
9 gchar *address;
10 guint port;
11 gboolean ssl;
13 g_assert (server != NULL);
15 g_object_get (server,
16 "address", &address,
17 "port", &port,
18 "ssl", &ssl,
19 NULL);
21 g_assert (address != NULL && strcmp (address, _address) == 0);
22 g_assert (port == _port);
23 g_assert (ssl == _ssl);
25 g_free (address);
28 void
29 check_network (EmpathyIrcNetwork *network,
30 const gchar *_name,
31 const gchar *_charset,
32 struct server_t *_servers,
33 guint nb_servers)
35 gchar *name, *charset;
36 GSList *servers, *l;
37 guint i;
39 g_assert (network != NULL);
41 g_object_get (network,
42 "name", &name,
43 "charset", &charset,
44 NULL);
46 g_assert (name != NULL && strcmp (name, _name) == 0);
47 g_assert (charset != NULL && strcmp (charset, _charset) == 0);
49 servers = empathy_irc_network_get_servers (network);
50 g_assert (g_slist_length (servers) == nb_servers);
52 /* Is that the right servers ? */
53 for (l = servers, i = 0; l != NULL; l = g_slist_next (l), i++)
55 EmpathyIrcServer *server;
56 gchar *address;
57 guint port;
58 gboolean ssl;
60 server = l->data;
62 g_object_get (server,
63 "address", &address,
64 "port", &port,
65 "ssl", &ssl,
66 NULL);
68 g_assert (address != NULL && strcmp (address, _servers[i].address)
69 == 0);
70 g_assert (port == _servers[i].port);
71 g_assert (ssl == _servers[i].ssl);
73 g_free (address);
76 g_slist_foreach (servers, (GFunc) g_object_unref, NULL);
77 g_slist_free (servers);
78 g_free (name);
79 g_free (charset);