aboutsummaryrefslogtreecommitdiffstats
path: root/tests/check-irc-helper.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-02-18 07:38:19 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-02-18 07:38:19 +0800
commit8107cb72c02be53157fc87955b4bc4f454662182 (patch)
treec37e04a560b3c654a5b509e2dd02c5a79178bed1 /tests/check-irc-helper.c
parent20c9a85036f7c951eb24df9587db695895869342 (diff)
downloadgsoc2013-empathy-8107cb72c02be53157fc87955b4bc4f454662182.tar
gsoc2013-empathy-8107cb72c02be53157fc87955b4bc4f454662182.tar.gz
gsoc2013-empathy-8107cb72c02be53157fc87955b4bc4f454662182.tar.bz2
gsoc2013-empathy-8107cb72c02be53157fc87955b4bc4f454662182.tar.lz
gsoc2013-empathy-8107cb72c02be53157fc87955b4bc4f454662182.tar.xz
gsoc2013-empathy-8107cb72c02be53157fc87955b4bc4f454662182.tar.zst
gsoc2013-empathy-8107cb72c02be53157fc87955b4bc4f454662182.zip
Merge commit 'cassidy/irc'
svn path=/trunk/; revision=649
Diffstat (limited to 'tests/check-irc-helper.c')
-rw-r--r--tests/check-irc-helper.c80
1 files changed, 80 insertions, 0 deletions
diff --git a/tests/check-irc-helper.c b/tests/check-irc-helper.c
new file mode 100644
index 000000000..477b134c2
--- /dev/null
+++ b/tests/check-irc-helper.c
@@ -0,0 +1,80 @@
+#include "check-irc-helper.h"
+
+void
+check_server (EmpathyIrcServer *server,
+ const gchar *_address,
+ guint _port,
+ gboolean _ssl)
+{
+ gchar *address;
+ guint port;
+ gboolean ssl;
+
+ fail_if (server == NULL);
+
+ g_object_get (server,
+ "address", &address,
+ "port", &port,
+ "ssl", &ssl,
+ NULL);
+
+ fail_if (address == NULL || strcmp (address, _address) != 0);
+ fail_if (port != _port);
+ fail_if (ssl != _ssl);
+
+ g_free (address);
+}
+
+void
+check_network (EmpathyIrcNetwork *network,
+ const gchar *_name,
+ const gchar *_charset,
+ struct server_t *_servers,
+ guint nb_servers)
+{
+ gchar *name, *charset;
+ GSList *servers, *l;
+ guint i;
+
+ fail_if (network == NULL);
+
+ g_object_get (network,
+ "name", &name,
+ "charset", &charset,
+ NULL);
+
+ fail_if (name == NULL || strcmp (name, _name) != 0);
+ fail_if (charset == NULL || strcmp (charset, _charset) != 0);
+
+ servers = empathy_irc_network_get_servers (network);
+ fail_if (g_slist_length (servers) != nb_servers);
+
+ /* Is that the right servers ? */
+ for (l = servers, i = 0; l != NULL; l = g_slist_next (l), i++)
+ {
+ EmpathyIrcServer *server;
+ gchar *address;
+ guint port;
+ gboolean ssl;
+
+ server = l->data;
+
+ g_object_get (server,
+ "address", &address,
+ "port", &port,
+ "ssl", &ssl,
+ NULL);
+
+ fail_if (address == NULL || strcmp (address, _servers[i].address)
+ != 0);
+ fail_if (port != _servers[i].port);
+ fail_if (ssl != _servers[i].ssl);
+
+ g_free (address);
+ }
+
+ g_slist_foreach (servers, (GFunc) g_object_unref, NULL);
+ g_slist_free (servers);
+ g_free (name);
+ g_free (charset);
+}