aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test-irc-helper.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-10-29 23:04:12 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-11-03 20:25:02 +0800
commitc0796c470597870b3b821aad1ea352d666153e83 (patch)
tree406488e383c0115495261e6a9f9660941bd57e88 /tests/test-irc-helper.c
parentd948dd18d07e799223057134557312885d0cad42 (diff)
downloadgsoc2013-empathy-c0796c470597870b3b821aad1ea352d666153e83.tar
gsoc2013-empathy-c0796c470597870b3b821aad1ea352d666153e83.tar.gz
gsoc2013-empathy-c0796c470597870b3b821aad1ea352d666153e83.tar.bz2
gsoc2013-empathy-c0796c470597870b3b821aad1ea352d666153e83.tar.lz
gsoc2013-empathy-c0796c470597870b3b821aad1ea352d666153e83.tar.xz
gsoc2013-empathy-c0796c470597870b3b821aad1ea352d666153e83.tar.zst
gsoc2013-empathy-c0796c470597870b3b821aad1ea352d666153e83.zip
rename check-irc-helper to test-irc-helper
Diffstat (limited to 'tests/test-irc-helper.c')
-rw-r--r--tests/test-irc-helper.c80
1 files changed, 80 insertions, 0 deletions
diff --git a/tests/test-irc-helper.c b/tests/test-irc-helper.c
new file mode 100644
index 000000000..ade247f39
--- /dev/null
+++ b/tests/test-irc-helper.c
@@ -0,0 +1,80 @@
+#include "test-irc-helper.h"
+
+void
+check_server (EmpathyIrcServer *server,
+ const gchar *_address,
+ guint _port,
+ gboolean _ssl)
+{
+ gchar *address;
+ guint port;
+ gboolean ssl;
+
+ g_assert (server != NULL);
+
+ g_object_get (server,
+ "address", &address,
+ "port", &port,
+ "ssl", &ssl,
+ NULL);
+
+ g_assert (address != NULL && strcmp (address, _address) == 0);
+ g_assert (port == _port);
+ g_assert (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;
+
+ g_assert (network != NULL);
+
+ g_object_get (network,
+ "name", &name,
+ "charset", &charset,
+ NULL);
+
+ g_assert (name != NULL && strcmp (name, _name) == 0);
+ g_assert (charset != NULL && strcmp (charset, _charset) == 0);
+
+ servers = empathy_irc_network_get_servers (network);
+ g_assert (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);
+
+ g_assert (address != NULL && strcmp (address, _servers[i].address)
+ == 0);
+ g_assert (port == _servers[i].port);
+ g_assert (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);
+}