summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStef Walter <stefw@collabora.co.uk>2011-02-16 16:50:27 +0100
committerStef Walter <stefw@collabora.co.uk>2011-02-16 16:50:27 +0100
commit8843f79f35f40e517154d0b231681c220ddebce0 (patch)
treee47636f26d3f3b68e9debbcc31d38b37bca1a099 /lib
parent8ff71251a3e5dd85645b85fe16e161eb126bfe1e (diff)
Migrate from 'check' to glib tests.
https://bugs.freedesktop.org/show_bug.cgi?id=34341
Diffstat (limited to 'lib')
-rw-r--r--lib/gibber/tests/Makefile.am103
-rw-r--r--lib/gibber/tests/check-gibber-iq-helper.c160
-rw-r--r--lib/gibber/tests/check-gibber-listener.c68
-rw-r--r--lib/gibber/tests/check-gibber-r-multicast-causal-transport.c127
-rw-r--r--lib/gibber/tests/check-gibber-r-multicast-packet.c81
-rw-r--r--lib/gibber/tests/check-gibber-r-multicast-sender.c121
-rw-r--r--lib/gibber/tests/check-gibber-unix-transport.c55
-rw-r--r--lib/gibber/tests/check-gibber-xmpp-connection-listener.c37
-rw-r--r--lib/gibber/tests/check-gibber-xmpp-connection.c43
-rw-r--r--lib/gibber/tests/check-gibber-xmpp-error.c69
-rw-r--r--lib/gibber/tests/check-gibber-xmpp-reader.c72
-rw-r--r--lib/gibber/tests/check-gibber.h17
-rw-r--r--lib/gibber/tests/check-helpers.c63
-rw-r--r--lib/gibber/tests/check-helpers.h43
-rw-r--r--lib/gibber/tests/check-main.c53
15 files changed, 515 insertions, 597 deletions
diff --git a/lib/gibber/tests/Makefile.am b/lib/gibber/tests/Makefile.am
index 519661a3..2c241565 100644
--- a/lib/gibber/tests/Makefile.am
+++ b/lib/gibber/tests/Makefile.am
@@ -4,6 +4,31 @@ include $(top_srcdir)/rules/check.mak
SUPPRESSIONS=valgrind.supp dlopen.supp
+AM_CFLAGS = $(ERROR_CFLAGS) @GLIB_CFLAGS@ @LIBXML2_CFLAGS@ @WOCKY_CFLAGS@ \
+ @DBUS_CFLAGS@ \
+ -I $(top_srcdir) -I $(top_builddir) \
+ -I $(top_srcdir)/lib -I $(top_builddir)/lib
+
+AM_LDFLAGS = @GLIB_LIBS@ \
+ $(top_builddir)/lib/gibber/libgibber.la
+
+clean-local:
+ -rm -rf outputs
+
+SUBDIRS = inputs
+
+EXTRA_DIST = \
+ test-transport.h \
+ test-transport.c
+
+$(check_SCRIPTS): always-run
+ chmod +x $(srcdir)/$@
+
+.PHONY: always-run
+
+# ------------------------------------------------------------------------------
+# Test programs
+
# Teach it how to make libgibber.la
$(top_builddir)/lib/gibber/libgibber.la:
${MAKE} -C $(top_builddir)/lib/gibber libgibber.la
@@ -13,13 +38,14 @@ $(top_builddir)/lib/gibber/libgibber.la:
TESTS = \
run-xmpp-connection-test.sh
-check_PROGRAMS = \
+noinst_PROGRAMS = \
test-xmpp-connection \
test-r-multicast-transport-io
check_SCRIPTS = run-xmpp-connection-test.sh
-EXTRA_DIST = simplemeshtest.py mesh.py $(check_SCRIPTS)
+EXTRA_DIST += \
+ simplemeshtest.py mesh.py $(check_SCRIPTS)
test_xmpp_connection_SOURCES = \
test-xmpp-connection.c \
@@ -27,7 +53,6 @@ test_xmpp_connection_SOURCES = \
test-transport.h
test_xmpp_connection_LDADD = \
- $(top_builddir)/lib/gibber/libgibber.la \
$(AM_LDFLAGS)
test_xmpp_connection_CFLAGS = \
@@ -45,64 +70,32 @@ test_r_multicast_transport_io_LDADD = \
test_r_multicast_transport_io_CFLAGS = \
$(AM_CFLAGS)
+# ------------------------------------------------------------------------------
+# Checks
-if HAVE_CHECK
-check_PROGRAMS += check-main
-TESTS += check-main
-check_main_SOURCES = \
- check-main.c \
- check-helpers.c \
- check-helpers.h \
- check-gibber.h \
- check-gibber-xmpp-reader.c \
- check-gibber-r-multicast-causal-transport.c \
- test-transport.c \
- test-transport.h \
- check-gibber-xmpp-connection.c \
- check-gibber-r-multicast-packet.c \
- check-gibber-r-multicast-sender.c \
- check-gibber-iq-helper.c \
- check-gibber-listener.c \
- check-gibber-xmpp-connection-listener.c \
- check-gibber-xmpp-error.c \
- check-gibber-unix-transport.c
-
-check_main_LDADD = \
- @CHECK_LIBS@ \
- $(top_builddir)/lib/gibber/libgibber.la \
- $(AM_LDFLAGS)
-
-check_main_CFLAGS = \
- @CHECK_CFLAGS@ \
- $(AM_CFLAGS)
-
-endif
-
-AM_CFLAGS = $(ERROR_CFLAGS) @GLIB_CFLAGS@ @LIBXML2_CFLAGS@ @WOCKY_CFLAGS@ \
- @DBUS_CFLAGS@ \
- -I $(top_srcdir) -I $(top_builddir) \
- -I $(top_srcdir)/lib -I $(top_builddir)/lib
-
-AM_LDFLAGS = @GLIB_LIBS@
+check_PROGRAMS = \
+ check-gibber-xmpp-reader \
+ check-gibber-r-multicast-causal-transport \
+ check-gibber-xmpp-connection \
+ check-gibber-r-multicast-packet \
+ check-gibber-r-multicast-sender \
+ check-gibber-iq-helper \
+ check-gibber-listener \
+ check-gibber-xmpp-connection-listener \
+ check-gibber-xmpp-error \
+ check-gibber-unix-transport
+
+test: ${TEST_PROGS}
+ gtester -k --verbose $(check_PROGRAMS)
+
+# ------------------------------------------------------------------------------
+# Code Style
# Coding style checks
check_c_sources = \
$(test_xmpp_connection_SOURCES) \
$(test_r_multicast_transport_io_SOURCES)
-if HAVE_CHECK
- check_c_sources += $(check_main_SOURCES)
-endif
-
include $(top_srcdir)/tools/check-coding-style.mk
-check-local: check-coding-style
-
-clean-local:
- -rm -rf outputs
-
-SUBDIRS = inputs
-$(check_SCRIPTS): always-run
- chmod +x $(srcdir)/$@
-
-.PHONY: always-run
+check-local: check-coding-style test
diff --git a/lib/gibber/tests/check-gibber-iq-helper.c b/lib/gibber/tests/check-gibber-iq-helper.c
index c28e8053..20bbdc8d 100644
--- a/lib/gibber/tests/check-gibber-iq-helper.c
+++ b/lib/gibber/tests/check-gibber-iq-helper.c
@@ -29,13 +29,9 @@
#include <gibber/gibber-xmpp-error.h>
#include <gibber/gibber-namespaces.h>
-#include <check.h>
-#include "check-helpers.h"
-#include "check-gibber.h"
-
#include "test-transport.h"
-gboolean received_reply = FALSE;
+static gboolean received_reply = FALSE;
static gboolean
send_hook (GibberTransport *transport,
@@ -63,15 +59,15 @@ create_xmpp_connection (void)
return xmpp_connection;
}
-START_TEST (test_iq_helper_new)
+static void
+test_iq_helper_new (void)
{
GibberXmppConnection *xmpp_connection = create_xmpp_connection ();
GibberIqHelper *iq_helper = gibber_iq_helper_new (xmpp_connection);
- fail_unless (iq_helper != NULL);
+ g_assert (iq_helper != NULL);
g_object_unref (xmpp_connection);
g_object_unref (iq_helper);
}
-END_TEST
static void
reply_func (GibberIqHelper *helper,
@@ -95,13 +91,13 @@ send_stanza_and_reply (GibberXmppConnection *xmpp_connection,
{
result = gibber_iq_helper_send_with_reply (iq_helper, stanza, reply_func,
NULL, NULL, NULL);
- fail_unless (result);
+ g_assert (result);
}
if (reply != NULL)
{
result = gibber_xmpp_connection_send (xmpp_connection, reply, NULL);
- fail_unless (result);
+ g_assert (result);
}
while (g_main_context_iteration (NULL, FALSE))
@@ -109,7 +105,8 @@ send_stanza_and_reply (GibberXmppConnection *xmpp_connection,
}
-START_TEST (test_send_with_reply)
+static void
+test_send_with_reply (void)
{
GibberXmppConnection *xmpp_connection = create_xmpp_connection ();
GibberIqHelper *iq_helper = gibber_iq_helper_new (xmpp_connection);
@@ -131,16 +128,16 @@ START_TEST (test_send_with_reply)
NULL);
send_stanza_and_reply (xmpp_connection, iq_helper, stanza, reply);
- fail_unless (received_reply);
+ g_assert (received_reply);
g_object_unref (stanza);
g_object_unref (reply);
g_object_unref (xmpp_connection);
g_object_unref (iq_helper);
}
-END_TEST
-START_TEST (test_send_without_reply)
+static void
+test_send_without_reply (void)
{
GibberXmppConnection *xmpp_connection = create_xmpp_connection ();
GibberIqHelper *iq_helper = gibber_iq_helper_new (xmpp_connection);
@@ -155,15 +152,15 @@ START_TEST (test_send_without_reply)
NULL);
send_stanza_and_reply (xmpp_connection, iq_helper, stanza, NULL);
- fail_unless (!received_reply);
+ g_assert (!received_reply);
g_object_unref (stanza);
g_object_unref (xmpp_connection);
g_object_unref (iq_helper);
}
-END_TEST
-START_TEST (test_send_with_bad_reply_type)
+static void
+test_send_with_bad_reply_type (void)
{
GibberXmppConnection *xmpp_connection = create_xmpp_connection ();
GibberIqHelper *iq_helper = gibber_iq_helper_new (xmpp_connection);
@@ -185,16 +182,16 @@ START_TEST (test_send_with_bad_reply_type)
NULL);
send_stanza_and_reply (xmpp_connection, iq_helper, stanza, reply);
- fail_unless (!received_reply);
+ g_assert (!received_reply);
g_object_unref (stanza);
g_object_unref (reply);
g_object_unref (xmpp_connection);
g_object_unref (iq_helper);
}
-END_TEST
-START_TEST (test_send_without_id)
+static void
+test_send_without_id (void)
{
GibberXmppConnection *xmpp_connection = create_xmpp_connection ();
GibberIqHelper *iq_helper = gibber_iq_helper_new (xmpp_connection);
@@ -211,7 +208,7 @@ START_TEST (test_send_without_id)
result = gibber_iq_helper_send_with_reply (iq_helper, stanza, reply_func,
NULL, NULL, NULL);
- fail_unless (result);
+ g_assert (result);
/* gibber_iq_helper_send_with_reply generated an id */
id = wocky_node_get_attribute (wocky_stanza_get_top_node (stanza),
@@ -224,21 +221,21 @@ START_TEST (test_send_without_id)
NULL);
result = gibber_xmpp_connection_send (xmpp_connection, reply, NULL);
- fail_unless (result);
+ g_assert (result);
while (g_main_context_iteration (NULL, FALSE))
;
- fail_unless (received_reply);
+ g_assert (received_reply);
g_object_unref (stanza);
g_object_unref (reply);
g_object_unref (xmpp_connection);
g_object_unref (iq_helper);
}
-END_TEST
-START_TEST (test_new_result_reply)
+static void
+test_new_result_reply (void)
{
GibberXmppConnection *xmpp_connection = create_xmpp_connection ();
GibberIqHelper *iq_helper = gibber_iq_helper_new (xmpp_connection);
@@ -254,31 +251,30 @@ START_TEST (test_new_result_reply)
result = gibber_iq_helper_send_with_reply (iq_helper, stanza, reply_func,
NULL, NULL, NULL);
- fail_unless (result);
+ g_assert (result);
reply = gibber_iq_helper_new_result_reply (stanza);
- fail_unless (reply != NULL);
- fail_unless (strcmp (wocky_stanza_get_top_node (reply)->name, "iq") == 0);
- fail_unless (strcmp (
- wocky_node_get_attribute (wocky_stanza_get_top_node (reply),
- "type"),
- "result") == 0);
+ g_assert (reply != NULL);
+ g_assert_cmpstr (wocky_stanza_get_top_node (reply)->name, ==, "iq");
+ g_assert_cmpstr (
+ wocky_node_get_attribute (wocky_stanza_get_top_node (reply), "type"),
+ ==, "result");
result = gibber_xmpp_connection_send (xmpp_connection, reply, NULL);
- fail_unless (result);
+ g_assert (result);
while (g_main_context_iteration (NULL, FALSE))
;
- fail_unless (received_reply);
+ g_assert (received_reply);
g_object_unref (stanza);
g_object_unref (reply);
g_object_unref (xmpp_connection);
g_object_unref (iq_helper);
}
-END_TEST
-START_TEST (test_new_error_reply)
+static void
+test_new_error_reply (void)
{
GibberXmppConnection *xmpp_connection = create_xmpp_connection ();
GibberIqHelper *iq_helper = gibber_iq_helper_new (xmpp_connection);
@@ -295,48 +291,46 @@ START_TEST (test_new_error_reply)
result = gibber_iq_helper_send_with_reply (iq_helper, stanza, reply_func,
NULL, NULL, NULL);
- fail_unless (result);
+ g_assert (result);
reply = gibber_iq_helper_new_error_reply (stanza,
XMPP_ERROR_BAD_REQUEST, "test");
- fail_unless (reply != NULL);
- fail_unless (strcmp (wocky_stanza_get_top_node (reply)->name, "iq") == 0);
- fail_unless (strcmp (wocky_node_get_attribute (
- wocky_stanza_get_top_node (reply), "type"),
- "error") == 0);
+ g_assert (reply != NULL);
+ g_assert_cmpstr (wocky_stanza_get_top_node (reply)->name, ==, "iq");
+ g_assert_cmpstr (
+ wocky_node_get_attribute (wocky_stanza_get_top_node (reply), "type"),
+ ==, "error");
error_node = wocky_node_get_child (wocky_stanza_get_top_node (reply),
"error");
- fail_if (error_node == NULL);
- fail_if (strcmp (wocky_node_get_attribute (error_node, "code"),
- "400") != 0);
- fail_if (strcmp (wocky_node_get_attribute (error_node, "type"),
- "modify") != 0);
+ g_assert (error_node != NULL);
+ g_assert_cmpstr (wocky_node_get_attribute (error_node, "code"), ==, "400");
+ g_assert_cmpstr (wocky_node_get_attribute (error_node, "type"), ==, "modify");
node = wocky_node_get_child_ns (error_node, "bad-request",
GIBBER_XMPP_NS_STANZAS);
- fail_if (node == NULL);
+ g_assert (node != NULL);
node = wocky_node_get_child (error_node, "text");
- fail_if (node == NULL);
- fail_if (strcmp (node->content, "test") != 0);
+ g_assert (node != NULL);
+ g_assert_cmpstr (node->content, ==, "test");
result = gibber_xmpp_connection_send (xmpp_connection, reply, NULL);
- fail_unless (result);
+ g_assert (result);
while (g_main_context_iteration (NULL, FALSE))
;
- fail_unless (received_reply);
+ g_assert (received_reply);
g_object_unref (stanza);
g_object_unref (reply);
g_object_unref (xmpp_connection);
g_object_unref (iq_helper);
}
-END_TEST
-START_TEST (test_send_with_object_living)
+static void
+test_send_with_object_living (void)
{
GibberXmppConnection *xmpp_connection = create_xmpp_connection ();
GibberIqHelper *iq_helper = gibber_iq_helper_new (xmpp_connection);
@@ -356,17 +350,17 @@ START_TEST (test_send_with_object_living)
result = gibber_iq_helper_send_with_reply (iq_helper, stanza, reply_func,
object, NULL, NULL);
- fail_unless (result);
+ g_assert (result);
reply = gibber_iq_helper_new_result_reply (stanza);
- fail_unless (reply != NULL);
+ g_assert (reply != NULL);
result = gibber_xmpp_connection_send (xmpp_connection, reply, NULL);
- fail_unless (result);
+ g_assert (result);
while (g_main_context_iteration (NULL, FALSE))
;
- fail_unless (received_reply);
+ g_assert (received_reply);
g_object_unref (stanza);
g_object_unref (reply);
@@ -374,9 +368,9 @@ START_TEST (test_send_with_object_living)
g_object_unref (xmpp_connection);
g_object_unref (iq_helper);
}
-END_TEST
-START_TEST (test_send_with_object_destroyed)
+static void
+test_send_with_object_destroyed (void)
{
GibberXmppConnection *xmpp_connection = create_xmpp_connection ();
GibberIqHelper *iq_helper = gibber_iq_helper_new (xmpp_connection);
@@ -396,42 +390,50 @@ START_TEST (test_send_with_object_destroyed)
result = gibber_iq_helper_send_with_reply (iq_helper, stanza, reply_func,
object, NULL, NULL);
- fail_unless (result);
+ g_assert (result);
g_object_unref (object);
reply = gibber_iq_helper_new_result_reply (stanza);
- fail_unless (reply != NULL);
+ g_assert (reply != NULL);
result = gibber_xmpp_connection_send (xmpp_connection, reply, NULL);
- fail_unless (result);
+ g_assert (result);
while (g_main_context_iteration (NULL, FALSE))
;
/* Object was destroyed before we send the reply so we don't receive
* the reply */
- fail_unless (!received_reply);
+ g_assert (!received_reply);
g_object_unref (stanza);
g_object_unref (reply);
g_object_unref (xmpp_connection);
g_object_unref (iq_helper);
}
-END_TEST
-TCase *
-make_gibber_iq_helper_tcase (void)
+int
+main (int argc,
+ char **argv)
{
- TCase *tc = tcase_create ("IQ helper");
- tcase_add_test (tc, test_iq_helper_new);
- tcase_add_test (tc, test_send_with_reply);
- tcase_add_test (tc, test_send_without_reply);
- tcase_add_test (tc, test_send_with_bad_reply_type);
- tcase_add_test (tc, test_send_without_id);
- tcase_add_test (tc, test_new_result_reply);
- tcase_add_test (tc, test_new_error_reply);
- tcase_add_test (tc, test_send_with_object_living);
- tcase_add_test (tc, test_send_with_object_destroyed);
-
- return tc;
+ g_test_init (&argc, &argv, NULL);
+ g_type_init ();
+
+ g_test_add_func ("/gibber/iq-helper/new", test_iq_helper_new);
+ g_test_add_func ("/gibber/iq-helper/send-with-reply", test_send_with_reply);
+ g_test_add_func ("/gibber/iq-helper/send-without-reply",
+ test_send_without_reply);
+ g_test_add_func ("/gibber/iq-helper/send-with-bad-reply-type",
+ test_send_with_bad_reply_type);
+ g_test_add_func ("/gibber/iq-helper/send-without-id", test_send_without_id);
+ g_test_add_func ("/gibber/iq-helper/new-result-reply", test_new_result_reply);
+ g_test_add_func ("/gibber/iq-helper/new-error-reply", test_new_error_reply);
+ g_test_add_func ("/gibber/iq-helper/send-with-object-living",
+ test_send_with_object_living);
+ g_test_add_func ("/gibber/iq-helper/send-with-object-destroyed",
+ test_send_with_object_destroyed);
+
+ return g_test_run ();
}
+
+#include "test-transport.c"
diff --git a/lib/gibber/tests/check-gibber-listener.c b/lib/gibber/tests/check-gibber-listener.c
index 4a1bce06..15550b65 100644
--- a/lib/gibber/tests/check-gibber-listener.c
+++ b/lib/gibber/tests/check-gibber-listener.c
@@ -34,9 +34,6 @@
#include <gibber/gibber-unix-transport.h>
#include <gibber/gibber-listener.h>
-#include <check.h>
-#include "check-gibber.h"
-
gboolean got_connection;
gboolean signalled;
@@ -77,7 +74,8 @@ connect_to_port (int port, GMainLoop *loop)
return GIBBER_TRANSPORT (transport);
}
-START_TEST (test_unix_listen)
+static void
+test_unix_listen (void)
{
GibberListener *listener_unix;
GibberUnixTransport *unix_transport;
@@ -87,34 +85,35 @@ START_TEST (test_unix_listen)
gchar *path = "/tmp/check-gibber-listener-socket";
ret = unlink (path);
- fail_if (ret == -1 && errno != ENOENT);
+ g_assert (!(ret == -1 && errno != ENOENT));
mainloop = g_main_loop_new (NULL, FALSE);
listener_unix = gibber_listener_new ();
- fail_if (listener_unix == NULL);
+ g_assert (listener_unix != NULL);
g_signal_connect (listener_unix, "new-connection",
G_CALLBACK (new_connection_cb), mainloop);
ret = gibber_listener_listen_socket (listener_unix, path, FALSE, &error);
- fail_if (ret != TRUE);
+ g_assert (ret == TRUE);
unix_transport = gibber_unix_transport_new ();
ret = gibber_unix_transport_connect (unix_transport, path, &error);
- fail_if (ret != TRUE);
+ g_assert (ret == TRUE);
if (!signalled)
g_main_loop_run (mainloop);
- fail_if (!got_connection, "Failed to connect");
+ g_assert (got_connection && "Failed to connect");
g_object_unref (listener_unix);
g_object_unref (unix_transport);
g_main_loop_unref (mainloop);
-} END_TEST
+}
-START_TEST (test_tcp_listen)
+static void
+test_tcp_listen (void)
{
GibberListener *listener;
GibberListener *listener_without_port;
@@ -128,13 +127,13 @@ START_TEST (test_tcp_listen)
/* tcp socket tests without a specified port */
listener_without_port = gibber_listener_new ();
- fail_if (listener_without_port == NULL);
+ g_assert (listener_without_port != NULL);
g_signal_connect (listener_without_port, "new-connection",
G_CALLBACK (new_connection_cb), mainloop);
ret = gibber_listener_listen_tcp (listener_without_port, 0, &error);
- fail_if (ret != TRUE);
+ g_assert (ret == TRUE);
port = gibber_listener_get_port (listener_without_port);
signalled = FALSE;
@@ -142,14 +141,14 @@ START_TEST (test_tcp_listen)
if (!signalled)
g_main_loop_run (mainloop);
- fail_if (!got_connection, "Failed to connect");
+ g_assert (got_connection);
g_object_unref (listener_without_port);
g_object_unref (transport);
/* tcp socket tests with a specified port */
listener = gibber_listener_new ();
- fail_if (listener == NULL);
+ g_assert (listener != NULL);
g_signal_connect (listener, "new-connection", G_CALLBACK (new_connection_cb),
mainloop);
@@ -159,20 +158,20 @@ START_TEST (test_tcp_listen)
if (gibber_listener_listen_tcp (listener, port, &error))
break;
- fail_if (!g_error_matches (error, GIBBER_LISTENER_ERROR,
- GIBBER_LISTENER_ERROR_ADDRESS_IN_USE));
+ g_assert_error (error, GIBBER_LISTENER_ERROR,
+ GIBBER_LISTENER_ERROR_ADDRESS_IN_USE);
g_error_free (error);
error = NULL;
}
- fail_if (port >= 5400);
- fail_if (port != gibber_listener_get_port (listener));
+ g_assert (port < 5400);
+ g_assert (port == gibber_listener_get_port (listener));
/* try a second listener on the same port */
listener2 = gibber_listener_new ();
- fail_if (listener2 == NULL);
- fail_if (gibber_listener_listen_tcp (listener2, port, &error));
- fail_if (!g_error_matches (error, GIBBER_LISTENER_ERROR,
- GIBBER_LISTENER_ERROR_ADDRESS_IN_USE));
+ g_assert (listener2 != NULL);
+ g_assert (!gibber_listener_listen_tcp (listener2, port, &error));
+ g_assert_error (error, GIBBER_LISTENER_ERROR,
+ GIBBER_LISTENER_ERROR_ADDRESS_IN_USE);
g_object_unref (listener2);
g_error_free (error);
error = NULL;
@@ -182,7 +181,7 @@ START_TEST (test_tcp_listen)
if (!signalled)
g_main_loop_run (mainloop);
- fail_if (!got_connection, "Failed to connect");
+ g_assert (got_connection);
g_object_unref (listener);
g_object_unref (transport);
@@ -194,18 +193,23 @@ START_TEST (test_tcp_listen)
if (!signalled)
g_main_loop_run (mainloop);
- fail_if (got_connection, "Connected while listening should have stopped");
+ /* Connected while listening should have stopped */
+ g_assert (!got_connection);
g_object_unref (transport);
g_main_loop_unref (mainloop);
-} END_TEST
+}
-TCase *
-make_gibber_listener_tcase (void)
+int
+main (int argc,
+ char **argv)
{
- TCase *tc = tcase_create ("GibberListener");
- tcase_add_test (tc, test_tcp_listen);
- tcase_add_test (tc, test_unix_listen);
- return tc;
+ g_test_init (&argc, &argv, NULL);
+ g_type_init ();
+
+ g_test_add_func ("/gibber/listener/tcp-listen", test_tcp_listen);
+ g_test_add_func ("/gibber/listener/unix-listen", test_unix_listen);
+
+ return g_test_run ();
}
diff --git a/lib/gibber/tests/check-gibber-r-multicast-causal-transport.c b/lib/gibber/tests/check-gibber-r-multicast-causal-transport.c
index 8dc92782..0d9f7427 100644
--- a/lib/gibber/tests/check-gibber-r-multicast-causal-transport.c
+++ b/lib/gibber/tests/check-gibber-r-multicast-causal-transport.c
@@ -24,9 +24,6 @@
#include <gibber/gibber-r-multicast-causal-transport.h>
#include <gibber/gibber-r-multicast-packet.h>
#include "test-transport.h"
-#include "check-gibber.h"
-
-#include <check.h>
/* Numer of polls we expect the id generation to do */
#define ID_GENERATION_EXPECTED_POLLS 3
@@ -45,7 +42,7 @@ create_rmulticast_transport (TestTransport **testtransport,
GibberRMulticastCausalTransport *rmctransport;
t = test_transport_new (test_send_hook, user_data);
- fail_unless (t != NULL);
+ g_assert (t != NULL);
GIBBER_TRANSPORT (t)->max_packet_size = 150;
rmctransport = gibber_r_multicast_causal_transport_new
@@ -66,9 +63,9 @@ static void
rmulticast_connect (GibberRMulticastCausalTransport *transport)
{
- fail_unless (transport != NULL);
+ g_assert (transport != NULL);
- fail_unless (gibber_r_multicast_causal_transport_connect (transport,
+ g_assert (gibber_r_multicast_causal_transport_connect (transport,
FALSE, NULL));
}
@@ -99,7 +96,7 @@ depends_send_hook (GibberTransport *transport,
guint i, n;
packet = gibber_r_multicast_packet_parse (data, length, NULL);
- fail_unless (packet != NULL);
+ g_assert (packet != NULL);
if (packet->type == PACKET_TYPE_WHOIS_REQUEST)
{
@@ -121,7 +118,7 @@ depends_send_hook (GibberTransport *transport,
goto out;
}
- fail_unless (senders[i].name != NULL);
+ g_assert (senders[i].name != NULL);
reply = gibber_r_multicast_packet_new (PACKET_TYPE_WHOIS_REPLY,
senders[i].sender_id, transport->max_packet_size);
@@ -139,7 +136,7 @@ depends_send_hook (GibberTransport *transport,
goto out;
}
- fail_unless (packet->depends->len > 0);
+ g_assert (packet->depends->len > 0);
for (n = 0; n < packet->depends->len; n++)
{
@@ -150,18 +147,18 @@ depends_send_hook (GibberTransport *transport,
GibberRMulticastPacketSenderInfo *, n);
if (senders[i].sender_id == sender_info->sender_id)
{
- fail_unless (senders[i].seen == FALSE);
- fail_unless (senders[i].packet_id + 1 == sender_info->packet_id);
+ g_assert (senders[i].seen == FALSE);
+ g_assert (senders[i].packet_id + 1 == sender_info->packet_id);
senders[i].seen = TRUE;
break;
}
}
- fail_unless (senders[i].name != NULL);
+ g_assert (senders[i].name != NULL);
}
for (i = 0; senders[i].name != NULL ; i++)
{
- fail_unless (senders[i].seen, "Not all senders in depends");
+ g_assert (senders[i].seen && "Not all senders in depends");
}
g_main_loop_quit (loop);
@@ -177,7 +174,7 @@ depends_send_test_data (gpointer data)
GIBBER_R_MULTICAST_CAUSAL_TRANSPORT (data);
guint8 testdata[] = { 1, 2, 3 };
- fail_unless (gibber_transport_send (GIBBER_TRANSPORT (t), testdata,
+ g_assert (gibber_transport_send (GIBBER_TRANSPORT (t), testdata,
3, NULL));
return FALSE;
@@ -221,7 +218,8 @@ depends_connected (GibberTransport *transport,
g_timeout_add (300, depends_send_test_data, rmctransport);
}
-START_TEST (test_depends)
+static void
+test_depends (void)
{
GibberRMulticastCausalTransport *rmctransport;
TestTransport *testtransport;
@@ -242,12 +240,11 @@ START_TEST (test_depends)
for (i = 0 ; senders[i].name != NULL; i++)
{
- fail_unless (senders[i].seen);
+ g_assert (senders[i].seen);
}
g_object_unref (rmctransport);
}
-END_TEST
/* test fragmentation testing */
@@ -266,7 +263,7 @@ fragmentation_send_hook (GibberTransport *transport,
guint8 *payload;
packet = gibber_r_multicast_packet_parse (data, length, NULL);
- fail_unless (packet != NULL);
+ g_assert (packet != NULL);
if (packet->type != PACKET_TYPE_DATA)
{
@@ -276,24 +273,24 @@ fragmentation_send_hook (GibberTransport *transport,
payload = gibber_r_multicast_packet_get_payload (packet, &size);
if (bytes == 0)
- fail_unless
+ g_assert
(packet->data.data.flags == GIBBER_R_MULTICAST_DATA_PACKET_START);
else if (bytes + size < TEST_DATA_SIZE)
- fail_unless (packet->data.data.flags == 0);
+ g_assert (packet->data.data.flags == 0);
bytes += size;
- fail_unless (bytes <= TEST_DATA_SIZE);
+ g_assert (bytes <= TEST_DATA_SIZE);
/* check our bytes */
for (i = 0; i < size; i++)
{
- fail_unless (payload[i] == next_byte);
+ g_assert (payload[i] == next_byte);
next_byte++;
}
if (bytes == TEST_DATA_SIZE)
{
- fail_unless
+ g_assert
(packet->data.data.flags == GIBBER_R_MULTICAST_DATA_PACKET_END);
g_object_unref (packet);
g_main_loop_quit (loop);
@@ -319,11 +316,12 @@ fragmentation_connected (GibberTransport *transport,
testdata[i] = (guint8) (i & 0xff);
}
- fail_unless (gibber_transport_send (GIBBER_TRANSPORT (rmctransport),
+ g_assert (gibber_transport_send (GIBBER_TRANSPORT (rmctransport),
(guint8 *) testdata, TEST_DATA_SIZE, NULL));
}
-START_TEST (test_fragmentation)
+static void
+test_fragmentation (void)
{
GibberRMulticastCausalTransport *rmctransport;
@@ -342,7 +340,6 @@ START_TEST (test_fragmentation)
g_object_unref (rmctransport);
}
-END_TEST
/* test unique id */
@@ -358,7 +355,7 @@ unique_id_send_hook (GibberTransport *transport,
packet = gibber_r_multicast_packet_parse (data, length, NULL);
- fail_unless (packet != NULL);
+ g_assert (packet != NULL);
if (*test_id == 0)
{
@@ -368,9 +365,9 @@ unique_id_send_hook (GibberTransport *transport,
gsize psize;
/* First packet must be a whois request to see if the id is taken */
- fail_unless (packet->type == PACKET_TYPE_WHOIS_REQUEST);
+ g_assert (packet->type == PACKET_TYPE_WHOIS_REQUEST);
/* Sender must be 0 as it couldn't choose a id just yet */
- fail_unless (packet->sender == 0);
+ g_assert (packet->sender == 0);
*test_id = packet->data.whois_request.sender_id;
@@ -385,11 +382,11 @@ unique_id_send_hook (GibberTransport *transport,
}
else
{
- fail_unless (*test_id != packet->sender);
+ g_assert (*test_id != packet->sender);
switch (packet->type)
{
case PACKET_TYPE_WHOIS_REQUEST:
- fail_unless (*test_id != packet->data.whois_request.sender_id);
+ g_assert (*test_id != packet->data.whois_request.sender_id);
break;
case PACKET_TYPE_WHOIS_REPLY:
/* transport sends a unsolicited whois reply after choosing a
@@ -397,7 +394,9 @@ unique_id_send_hook (GibberTransport *transport,
g_main_loop_quit (loop);
break;
default:
- fail ("Unexpected packet type: %x", packet->type);
+ g_warning ("Unexpected packet type: %x", packet->type);
+ g_assert_not_reached ();
+ break;
}
}
@@ -405,7 +404,8 @@ unique_id_send_hook (GibberTransport *transport,
return TRUE;
}
-START_TEST (test_unique_id)
+static void
+test_unique_id (void)
{
/* Test if the multicast transport correctly handles the case that it gets a
* WHOIS_REPLY on one of it's WHOIS_REQUESTS when it's determining a unique
@@ -426,7 +426,6 @@ START_TEST (test_unique_id)
g_object_unref (rmctransport);
}
-END_TEST
/* test id generation conflict */
typedef struct {
@@ -446,14 +445,14 @@ id_generation_conflict_send_hook (GibberTransport *transport,
unique_id_conflict_test_t *test = (unique_id_conflict_test_t *) user_data;
packet = gibber_r_multicast_packet_parse (data, length, NULL);
- fail_unless (packet != NULL);
+ g_assert (packet != NULL);
if (test->id == 0)
{
/* First packet must be a whois request to see if the id is taken */
- fail_unless (packet->type == PACKET_TYPE_WHOIS_REQUEST);
+ g_assert (packet->type == PACKET_TYPE_WHOIS_REQUEST);
/* Sender must be 0 as it couldn't choose a id just yet */
- fail_unless (packet->sender == 0);
+ g_assert (packet->sender == 0);
test->id = packet->data.whois_request.sender_id;
}
@@ -465,7 +464,7 @@ id_generation_conflict_send_hook (GibberTransport *transport,
if (test->count < test->wait)
{
- fail_unless (test->id == packet->data.whois_request.sender_id);
+ g_assert (test->id == packet->data.whois_request.sender_id);
}
else if (test->count == test->wait)
{
@@ -474,7 +473,7 @@ id_generation_conflict_send_hook (GibberTransport *transport,
guint8 *pdata;
gsize psize;
- fail_unless (test->id == packet->data.whois_request.sender_id);
+ g_assert (test->id == packet->data.whois_request.sender_id);
reply = gibber_r_multicast_packet_new (PACKET_TYPE_WHOIS_REQUEST,
0, transport->max_packet_size);
@@ -487,7 +486,7 @@ id_generation_conflict_send_hook (GibberTransport *transport,
}
else if (test->count > test->wait)
{
- fail_unless (test->id != packet->data.whois_request.sender_id);
+ g_assert (test->id != packet->data.whois_request.sender_id);
}
break;
@@ -495,21 +494,24 @@ id_generation_conflict_send_hook (GibberTransport *transport,
case PACKET_TYPE_WHOIS_REPLY:
/* transport sends a unsolicited whois reply after choosing a
* identifier */
- fail_unless (packet->sender != test->id);
- fail_unless (test->count ==
+ g_assert (packet->sender != test->id);
+ g_assert_cmpuint (test->count, ==,
ID_GENERATION_EXPECTED_POLLS + test->wait);
g_main_loop_quit (loop);
break;
default:
- fail ("Unexpected packet type: %x", packet->type);
+ g_warning ("Unexpected packet type: %x", packet->type);
+ g_assert_not_reached ();
+ break;
}
g_object_unref (packet);
return TRUE;
}
-START_TEST (test_id_generation_conflict)
+static void
+test_id_generation_conflict (gint _i)
{
/* Test if the multicast transport correctly handles the case that it sees
* another WHOIS_REQUEST on one of its WHOIS_REQUESTS when it's determining
@@ -533,18 +535,33 @@ START_TEST (test_id_generation_conflict)
g_object_unref (rmtransport);
}
-END_TEST
+static void
+test_id_generation_conflict_loop (void)
+{
+ gint i;
+ for (i = 0; i < ID_GENERATION_EXPECTED_POLLS; ++i)
+ test_id_generation_conflict (i);
+}
-TCase *
-make_gibber_r_multicast_causal_transport_tcase (void)
+int
+main (int argc,
+ char **argv)
{
- TCase *tc = tcase_create ("Gibber R Multicast Causal transport");
- tcase_add_test (tc, test_unique_id);
- tcase_add_loop_test (tc, test_id_generation_conflict, 0,
- ID_GENERATION_EXPECTED_POLLS);
- tcase_add_test (tc, test_fragmentation);
- tcase_add_test (tc, test_depends);
-
- return tc;
+ g_test_init (&argc, &argv, NULL);
+ g_type_init ();
+
+ g_test_add_func ("/gibber/r-multicast-casual-transport/unique-id",
+ test_unique_id);
+ g_test_add_func (
+ "/gibber/r-multicast-casual-transport/id-generation-conflict",
+ test_id_generation_conflict_loop);
+ g_test_add_func ("/gibber/r-multicast-casual-transport/fragmentation",
+ test_fragmentation);
+ g_test_add_func ("/gibber/r-multicast-casual-transport/depends",
+ test_depends);
+
+ return g_test_run ();
}
+
+#include "test-transport.c"
diff --git a/lib/gibber/tests/check-gibber-r-multicast-packet.c b/lib/gibber/tests/check-gibber-r-multicast-packet.c
index 52bfef41..5d5fcfd8 100644
--- a/lib/gibber/tests/check-gibber-r-multicast-packet.c
+++ b/lib/gibber/tests/check-gibber-r-multicast-packet.c
@@ -3,11 +3,8 @@
#include <gibber/gibber-r-multicast-packet.h>
-#include <check.h>
-#include "check-gibber.h"
-
#define COMPARE(x) G_STMT_START { \
- fail_unless (a->x == b->x); \
+ g_assert (a->x == b->x); \
} G_STMT_END
typedef struct {
@@ -24,7 +21,8 @@ typedef struct {
#define NUMBER_OF_DIFF_TESTS 15
-START_TEST (test_r_multicast_packet_diff)
+static void
+test_r_multicast_packet_diff (gint _i)
{
diff_testcase cases[NUMBER_OF_DIFF_TESTS] =
{ { 0, 0, 0 },
@@ -47,11 +45,19 @@ START_TEST (test_r_multicast_packet_diff)
diff_testcase *c = cases + _i;
gint32 result = gibber_r_multicast_packet_diff (c->a, c->b);
- fail_unless (c->result == result);
+ g_assert (c->result == result);
+}
+
+static void
+test_r_multicast_packet_diff_loop (void)
+{
+ gint i;
+ for (i = 0; i < NUMBER_OF_DIFF_TESTS; ++i)
+ test_r_multicast_packet_diff (i);
}
-END_TEST
-START_TEST (test_data_packet)
+static void
+test_data_packet (void)
{
GibberRMulticastPacket *a;
GibberRMulticastPacket *b;
@@ -87,7 +93,7 @@ START_TEST (test_data_packet)
data = gibber_r_multicast_packet_get_raw_data (a, &len);
b = gibber_r_multicast_packet_parse (data, len, NULL);
- fail_unless (b != NULL);
+ g_assert (b != NULL);
COMPARE (type);
COMPARE (version);
@@ -96,7 +102,7 @@ START_TEST (test_data_packet)
COMPARE (packet_id);
COMPARE (data.data.stream_id);
- fail_unless (a->sender == b->sender);
+ g_assert (a->sender == b->sender);
for (n = 0 ; n < b->depends->len; n++)
{
@@ -106,32 +112,33 @@ START_TEST (test_data_packet)
GibberRMulticastPacketSenderInfo *, n);
if (senders[i].sender_id == s->sender_id)
{
- fail_unless (senders[i].packet_id == s->packet_id);
- fail_unless (senders[i].seen == FALSE);
+ g_assert (senders[i].packet_id == s->packet_id);
+ g_assert (senders[i].seen == FALSE);
senders[i].seen = TRUE;
break;
}
}
- fail_unless (senders[i].sender_id != 0);
+ g_assert (senders[i].sender_id != 0);
}
for (i = 0; senders[i].sender_id != 0 ; i++)
{
- fail_unless (senders[i].seen == TRUE);
+ g_assert (senders[i].seen == TRUE);
}
pdata = gibber_r_multicast_packet_get_payload (b, &plen);
- fail_unless (plen == strlen (payload));
+ g_assert (plen == strlen (payload));
- fail_unless (memcmp (payload, pdata, plen) == 0);
+ g_assert (memcmp (payload, pdata, plen) == 0);
g_object_unref (a);
g_object_unref (b);
-} END_TEST
+}
-START_TEST (test_attempt_join_packet)
+static void
+test_attempt_join_packet (void)
{
GibberRMulticastPacket *a;
GibberRMulticastPacket *b;
@@ -166,14 +173,14 @@ START_TEST (test_attempt_join_packet)
b = gibber_r_multicast_packet_parse (data, len, NULL);
- fail_unless (b != NULL);
+ g_assert (b != NULL);
COMPARE (type);
COMPARE (version);
COMPARE (packet_id);
COMPARE (data.attempt_join.senders->len);
- fail_unless (a->sender == b->sender);
+ g_assert (a->sender == b->sender);
for (n = 0; n < b->depends->len; n++)
{
@@ -183,24 +190,24 @@ START_TEST (test_attempt_join_packet)
GibberRMulticastPacketSenderInfo *, n);
if (senders[i].sender_id == s->sender_id)
{
- fail_unless (senders[i].packet_id == s->packet_id);
- fail_unless (senders[i].seen == FALSE);
+ g_assert (senders[i].packet_id == s->packet_id);
+ g_assert (senders[i].seen == FALSE);
senders[i].seen = TRUE;
break;
}
}
- fail_unless (senders[i].sender_id != 0);
+ g_assert (senders[i].sender_id != 0);
}
for (i = 0; senders[i].sender_id != 0; i++)
{
- fail_unless (senders[i].seen == TRUE);
+ g_assert (senders[i].seen == TRUE);
}
for (i = 0; new_senders[i].sender_id != 0; i++)
{
- fail_unless (new_senders[i].sender_id ==
+ g_assert (new_senders[i].sender_id ==
g_array_index (b->data.attempt_join.senders, guint32, i));
new_senders[i].seen = TRUE;
break;
@@ -208,21 +215,25 @@ START_TEST (test_attempt_join_packet)
for (i = 0; new_senders[i].sender_id != 0; i++)
{
- fail_unless (senders[i].seen == TRUE);
+ g_assert (senders[i].seen == TRUE);
}
g_object_unref (a);
g_object_unref (b);
}
-END_TEST
-TCase *
-make_gibber_r_multicast_packet_tcase (void)
+int
+main (int argc,
+ char **argv)
{
- TCase *tc = tcase_create ("RMulticast Packet");
- tcase_add_test (tc, test_data_packet);
- tcase_add_test (tc, test_attempt_join_packet);
- tcase_add_loop_test (tc, test_r_multicast_packet_diff, 0,
- NUMBER_OF_DIFF_TESTS);
- return tc;
+ g_test_init (&argc, &argv, NULL);
+ g_type_init ();
+
+ g_test_add_func ("/gibber/r-multicast-packet/data-packet", test_data_packet);
+ g_test_add_func ("/gibber/r-multicast-packet/attempt-join-packet",
+ test_attempt_join_packet);
+ g_test_add_func ("/gibber/r-multicast-packet/diff",
+ test_r_multicast_packet_diff_loop);
+
+ return g_test_run ();
}
diff --git a/lib/gibber/tests/check-gibber-r-multicast-sender.c b/lib/gibber/tests/check-gibber-r-multicast-sender.c
index b0a4c903..7eb41943 100644
--- a/lib/gibber/tests/check-gibber-r-multicast-sender.c
+++ b/lib/gibber/tests/check-gibber-r-multicast-sender.c
@@ -1,12 +1,29 @@
+/*
+ * check-gibber-r-multicast-sender.c
+ * Copyright (C) 2007 Collabora Ltd.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
#include <gibber/gibber-r-multicast-sender.h>
-#include <check.h>
-#include "check-gibber.h"
-
#define SENDER 4321
#define SENDER_NAME "testsender"
@@ -98,13 +115,13 @@ data_received_cb (GibberRMulticastSender *sender, guint8 stream_id,
for (i = 0 ; lines[i] != NULL && *lines[i] != '\0'; i++) {
guint32 v = atoi (lines[i]);
- fail_unless (v == expected);
- fail_unless ((v % G_MAXUINT8) - i == stream_id);
+ g_assert (v == expected);
+ g_assert ((v % G_MAXUINT8) - i == stream_id);
expected++;
}
/* serial % 3 is send out in a single packet the other two together.
* So expected can't be % 3 == 2 here */
- fail_if (expected % 3 == 2);
+ g_assert_cmpuint (expected % 3, !=, 2);
if (expected == serial_offset + NR_PACKETS
|| expected == serial_offset + NR_PACKETS + EXTRA_SEEN) {
@@ -121,7 +138,7 @@ repair_request_cb (GibberRMulticastSender *sender, guint id, gpointer data)
{
GibberRMulticastPacket *p;
- fail_unless (gibber_r_multicast_packet_diff (serial_offset, id) >= 0
+ g_assert (gibber_r_multicast_packet_diff (serial_offset, id) >= 0
|| gibber_r_multicast_packet_diff (id,
serial_offset + NR_PACKETS + EXTRA_SEEN) < 0);
@@ -135,8 +152,8 @@ repair_message_cb (GibberRMulticastSender *sender,
GibberRMulticastPacket *packet, gpointer user_data)
{
- fail_unless (packet->type == PACKET_TYPE_DATA);
- fail_unless (packet->packet_id == REPAIR_PACKET + serial_offset);
+ g_assert (packet->type == PACKET_TYPE_DATA);
+ g_assert (packet->packet_id == REPAIR_PACKET + serial_offset);
g_main_loop_quit ((GMainLoop *) user_data);
}
@@ -168,7 +185,8 @@ add_packet (gpointer data)
#define NUMBER_OF_TESTS 3
-START_TEST (test_sender)
+static void
+test_sender (gint _i)
{
GibberRMulticastSender *s;
GibberRMulticastSenderGroup *group;
@@ -227,7 +245,15 @@ START_TEST (test_sender)
g_main_loop_run (loop);
gibber_r_multicast_sender_group_free (group);
-} END_TEST
+}
+
+static void
+test_sender_loop (void)
+{
+ gint i;
+ for (i = 0; i < NUMBER_OF_TESTS; ++i)
+ test_sender (i);
+}
/* Holding test */
guint32 idle_timer = 0;
@@ -297,12 +323,12 @@ h_idle_next_step (gpointer user_data)
case START_DATA:
case FAIL:
case EXPECT:
- fail ("Should not be reached");
+ g_assert_not_reached ();
break;
case HOLD:
s = g_hash_table_find (d->group->senders,
h_find_sender, e->expected_node);
- fail_unless (s != NULL);
+ g_assert (s != NULL);
d->test_step++;
gibber_r_multicast_sender_hold_data (s, e->hold_id);
h_next_test_step (d);
@@ -310,7 +336,7 @@ h_idle_next_step (gpointer user_data)
case UNHOLD:
s = g_hash_table_find (d->group->senders,
h_find_sender, e->expected_node);
- fail_unless (s != NULL);
+ g_assert (s != NULL);
d->test_step++;
gibber_r_multicast_sender_release_data (s);
h_next_test_step (d);
@@ -336,7 +362,7 @@ h_next_test_step (h_data_t *d)
case UNHOLD_IMMEDIATE:
s = g_hash_table_find (d->group->senders,
h_find_sender, e->expected_node);
- fail_unless (s != NULL);
+ g_assert (s != NULL);
d->test_step++;
gibber_r_multicast_sender_release_data (s);
h_next_test_step (d);
@@ -344,7 +370,7 @@ h_next_test_step (h_data_t *d)
case START_DATA:
s = g_hash_table_find (d->group->senders,
h_find_sender, e->expected_node);
- fail_unless (s != NULL);
+ g_assert (s != NULL);
d->test_step++;
gibber_r_multicast_sender_set_data_start (s, e->hold_id);
h_next_test_step (d);
@@ -352,7 +378,7 @@ h_next_test_step (h_data_t *d)
case FAIL:
s = g_hash_table_find (d->group->senders,
h_find_sender, e->expected_node);
- fail_unless (s != NULL);
+ g_assert (s != NULL);
d->test_step++;
gibber_r_multicast_sender_set_failed (s);
h_next_test_step (d);
@@ -373,11 +399,11 @@ h_received_data_cb (GibberRMulticastSender *sender, guint16 stream_id,
{
h_data_t *d = (h_data_t *) user_data;
- fail_unless (d->expectation[d->test_step].type == EXPECT);
- fail_unless (d->expectation[d->test_step].packet_type == PACKET_TYPE_DATA);
- fail_unless (
- strcmp (d->expectation[d->test_step].expected_node, sender->name) == 0);
- fail_unless (d->expectation[d->test_step].data_stream_id == stream_id);
+ g_assert (d->expectation[d->test_step].type == EXPECT);
+ g_assert (d->expectation[d->test_step].packet_type == PACKET_TYPE_DATA);
+ g_assert_cmpstr (d->expectation[d->test_step].expected_node, ==,
+ sender->name);
+ g_assert (d->expectation[d->test_step].data_stream_id == stream_id);
d->test_step++;
h_next_test_step (d);
@@ -389,10 +415,10 @@ h_received_control_packet_cb (GibberRMulticastSender *sender,
{
h_data_t *d = (h_data_t *) user_data;
- fail_unless (d->expectation[d->test_step].type == EXPECT);
- fail_unless (d->expectation[d->test_step].packet_type == packet->type);
- fail_unless (
- strcmp (d->expectation[d->test_step].expected_node, sender->name) == 0);
+ g_assert (d->expectation[d->test_step].type == EXPECT);
+ g_assert (d->expectation[d->test_step].packet_type == packet->type);
+ g_assert_cmpstr (d->expectation[d->test_step].expected_node, ==,
+ sender->name);
d->test_step++;
h_next_test_step (d);
@@ -565,7 +591,9 @@ add_h_sender (guint32 sender, gchar *name, GibberRMulticastSenderGroup *group,
G_CALLBACK (h_received_control_packet_cb), data);
}
-START_TEST (test_holding) {
+static void
+test_holding (gint _i)
+{
GibberRMulticastSenderGroup *group;
guint32 sender_offset = 0xf00;
/* control packets aren't hold back, thus we get them interleaved at first
@@ -599,7 +627,7 @@ START_TEST (test_holding) {
s0 = g_hash_table_find (group->senders, h_find_sender,
test->setup[i].name);
- fail_unless (s0 != NULL);
+ g_assert (s0 != NULL);
p = gibber_r_multicast_packet_new (test->setup[i].packet_type, s0->id,
1500);
@@ -609,13 +637,13 @@ START_TEST (test_holding) {
{
s1 = g_hash_table_find (group->senders, h_find_sender,
test->setup[i].depend_node);
- fail_unless (s1 != NULL);
- fail_unless (gibber_r_multicast_packet_add_sender_info (p, s1->id,
+ g_assert (s1 != NULL);
+ g_assert (gibber_r_multicast_packet_add_sender_info (p, s1->id,
test->setup[i].depend_packet_id, NULL));
}
if (test->setup[i].packet_type == PACKET_TYPE_DATA)
{
- fail_unless (test->setup[i].data != NULL);
+ g_assert (test->setup[i].data != NULL);
gibber_r_multicast_packet_set_data_info (p,
test->setup[i].data_stream_id,
@@ -637,16 +665,29 @@ START_TEST (test_holding) {
}
while (data.expectation[data.test_step].type != DONE);
- fail_unless (idle_timer == 0);
+ g_assert (idle_timer == 0);
+}
-} END_TEST
+static void
+test_holding_loop (void)
+{
+ gint i;
+ for (i = 0; i < NUMBER_OF_H_TESTS; ++i)
+ test_holding (i);
+}
-TCase *
-make_gibber_r_multicast_sender_tcase (void)
+int
+main (int argc,
+ char **argv)
{
- TCase *tc = tcase_create ("RMulticast Sender");
- tcase_set_timeout (tc, 20);
- tcase_add_loop_test (tc, test_sender, 0, NUMBER_OF_TESTS);
- tcase_add_loop_test (tc, test_holding, 0, NUMBER_OF_H_TESTS );
- return tc;
+ g_test_init (&argc, &argv, NULL);
+ g_type_init ();
+
+ /* Kill this process after 20 seconds */
+ alarm (20);
+
+ g_test_add_func ("/gibber/r-multicast-sender/sender", test_sender_loop);
+ g_test_add_func ("/gibber/r-multicast-sender/holding", test_holding_loop);
+
+ return g_test_run ();
}
diff --git a/lib/gibber/tests/check-gibber-unix-transport.c b/lib/gibber/tests/check-gibber-unix-transport.c
index 6a048fef..c3cfbed8 100644
--- a/lib/gibber/tests/check-gibber-unix-transport.c
+++ b/lib/gibber/tests/check-gibber-unix-transport.c
@@ -34,9 +34,6 @@
#include <gibber/gibber-unix-transport.h>
#include <gibber/gibber-listener.h>
-#include <check.h>
-#include "check-gibber.h"
-
gboolean got_connection;
gboolean received_credentials;
GibberUnixTransport *unix_transport;
@@ -107,7 +104,8 @@ new_connection_cb (GibberListener *listener,
g_main_loop_quit (loop);
}
-START_TEST (test_send_credentials)
+static void
+test_send_credentials (void)
{
GibberListener *listener_unix;
int ret;
@@ -116,33 +114,34 @@ START_TEST (test_send_credentials)
gchar *path = "/tmp/check-gibber-unix-transport-socket";
ret = unlink (path);
- fail_if (ret == -1 && errno != ENOENT);
+ g_assert (!(ret == -1 && errno != ENOENT));
got_connection = FALSE;
mainloop = g_main_loop_new (NULL, FALSE);
listener_unix = gibber_listener_new ();
- fail_if (listener_unix == NULL);
+ g_assert (listener_unix != NULL);
g_signal_connect (listener_unix, "new-connection",
G_CALLBACK (new_connection_cb), mainloop);
ret = gibber_listener_listen_socket (listener_unix, path, FALSE, &error);
- fail_if (ret != TRUE);
+ g_assert (ret == TRUE);
unix_transport = gibber_unix_transport_new ();
ret = gibber_unix_transport_connect (unix_transport, path, &error);
- fail_if (ret != TRUE);
+ g_assert (ret == TRUE);
if (!got_connection)
g_main_loop_run (mainloop);
- fail_if (!got_connection, "Failed to connect");
+ /* "Failed to connect" */
+ g_assert (got_connection);
g_object_unref (listener_unix);
g_object_unref (unix_transport);
g_main_loop_unref (mainloop);
-} END_TEST
+}
static void
get_credentials_cb (GibberUnixTransport *transport,
@@ -184,7 +183,8 @@ receive_new_connection_cb (GibberListener *listener,
g_assert (ok == gibber_unix_transport_supports_credentials ());
}
-START_TEST (test_receive_credentials)
+static void
+test_receive_credentials (void)
{
GibberListener *listener_unix;
int ret;
@@ -193,41 +193,50 @@ START_TEST (test_receive_credentials)
gchar *path = "/tmp/check-gibber-unix-transport-socket";
ret = unlink (path);
- fail_if (ret == -1 && errno != ENOENT);
+ g_assert (!(ret == -1 && errno != ENOENT));
received_credentials = FALSE;
mainloop = g_main_loop_new (NULL, FALSE);
listener_unix = gibber_listener_new ();
- fail_if (listener_unix == NULL);
+ g_assert (listener_unix != NULL);
g_signal_connect (listener_unix, "new-connection",
G_CALLBACK (receive_new_connection_cb), mainloop);
ret = gibber_listener_listen_socket (listener_unix, path, FALSE, &error);
- fail_if (ret != TRUE);
+ g_assert (ret == TRUE);
unix_transport = gibber_unix_transport_new ();
ret = gibber_unix_transport_connect (unix_transport, path, &error);
- fail_if (ret != TRUE);
+ g_assert (ret == TRUE);
#if defined(__linux__)
if (!received_credentials)
g_main_loop_run (mainloop);
- fail_if (!received_credentials, "Failed to receive credentials");
+ /* Failed to receive credentials */
+ g_assert (received_credentials);
#endif
g_object_unref (listener_unix);
g_object_unref (unix_transport);
g_main_loop_unref (mainloop);
-} END_TEST
+}
-TCase *
-make_gibber_unix_transport_tcase (void)
+int
+main (int argc,
+ char **argv)
{
- TCase *tc = tcase_create ("GibberUnixTransport");
- tcase_add_test (tc, test_send_credentials);
- tcase_add_test (tc, test_receive_credentials);
- return tc;
+ g_test_init (&argc, &argv, NULL);
+ g_type_init ();
+
+ alarm (20);
+
+ g_test_add_func ("/gibber/unix-transport/send-credentials",
+ test_send_credentials);
+ g_test_add_func ("/gibber/unix-transport/receive-credentials",
+ test_receive_credentials);
+
+ return g_test_run ();
}
diff --git a/lib/gibber/tests/check-gibber-xmpp-connection-listener.c b/lib/gibber/tests/check-gibber-xmpp-connection-listener.c
index 8dd19314..96bdb17f 100644
--- a/lib/gibber/tests/check-gibber-xmpp-connection-listener.c
+++ b/lib/gibber/tests/check-gibber-xmpp-connection-listener.c
@@ -33,9 +33,6 @@
#include <gibber/gibber-xmpp-connection.h>
#include <gibber/gibber-xmpp-connection-listener.h>
-#include <check.h>
-#include "check-gibber.h"
-
gboolean got_connection;
static void
@@ -69,7 +66,8 @@ connect_to_port (int port)
return result;
}
-START_TEST (test_listen)
+static void
+test_listen (void)
{
GibberXmppConnectionListener *listener;
int port;
@@ -78,7 +76,7 @@ START_TEST (test_listen)
got_connection = FALSE;
listener = gibber_xmpp_connection_listener_new ();
- fail_if (listener == NULL);
+ g_assert (listener != NULL);
g_signal_connect (listener, "new-connection", G_CALLBACK (new_connection_cb),
NULL);
@@ -89,32 +87,37 @@ START_TEST (test_listen)
if (gibber_xmpp_connection_listener_listen (listener, port, &error))
break;
- fail_if (!g_error_matches (error, GIBBER_LISTENER_ERROR,
- GIBBER_LISTENER_ERROR_ADDRESS_IN_USE));
+ g_assert_error (error, GIBBER_LISTENER_ERROR,
+ GIBBER_LISTENER_ERROR_ADDRESS_IN_USE);
g_error_free (error);
error = NULL;
}
- fail_if (port >= 5400);
+ g_assert (port < 5400);
result = connect_to_port (port);
- fail_if (result == FALSE);
+ g_assert (result != FALSE);
while (g_main_context_iteration (NULL, FALSE))
;
- fail_if (got_connection == FALSE);
+ g_assert (got_connection);
g_object_unref (listener);
/* listener is destroyed, connection should be refused now */
got_connection = FALSE;
result = connect_to_port (port);
- fail_if (result == TRUE);
-} END_TEST
+ g_assert (result != TRUE);
+}
-TCase *
-make_gibber_xmpp_connection_listener_tcase (void)
+int
+main (int argc,
+ char **argv)
{
- TCase *tc = tcase_create ("GibberXmppConnectionListener");
- tcase_add_test (tc, test_listen);
- return tc;
+ g_test_init (&argc, &argv, NULL);
+ g_type_init ();
+
+ g_test_add_func ("/gibber/xmpp-connection-listener/listen",
+ test_listen);
+
+ return g_test_run ();
}
diff --git a/lib/gibber/tests/check-gibber-xmpp-connection.c b/lib/gibber/tests/check-gibber-xmpp-connection.c
index de9dd1da..03412579 100644
--- a/lib/gibber/tests/check-gibber-xmpp-connection.c
+++ b/lib/gibber/tests/check-gibber-xmpp-connection.c
@@ -5,9 +5,6 @@
#include <gibber/gibber-xmpp-connection.h>
#include <gibber/gibber-transport.h>
#include "test-transport.h"
-#include "check-gibber.h"
-
-#include <check.h>
struct _FileChunker {
gchar *contents;
@@ -51,7 +48,8 @@ file_chunker_get_chunk (FileChunker *fc,
}
-START_TEST (test_instantiation)
+static void
+test_instantiation (void)
{
GibberXmppConnection *connection;
TestTransport *transport;
@@ -59,13 +57,12 @@ START_TEST (test_instantiation)
transport = test_transport_new (NULL, NULL);
connection = gibber_xmpp_connection_new (GIBBER_TRANSPORT(transport));
- fail_if (connection == NULL);
+ g_assert (connection != NULL);
connection = gibber_xmpp_connection_new (NULL);
- fail_if (connection == NULL);
+ g_assert (connection != NULL);
}
-END_TEST
static void
parse_error_cb (GibberXmppConnection *connection, gpointer user_data)
@@ -74,7 +71,8 @@ parse_error_cb (GibberXmppConnection *connection, gpointer user_data)
*parse_error_found = TRUE;
}
-START_TEST (test_simple_message)
+static void
+test_simple_message (void)
{
GibberXmppConnection *connection;
TestTransport *transport;
@@ -96,7 +94,7 @@ START_TEST (test_simple_message)
}
fc = file_chunker_new (file, 10);
- fail_if (fc == NULL);
+ g_assert (fc != NULL);
transport = test_transport_new (NULL, NULL);
connection = gibber_xmpp_connection_new (GIBBER_TRANSPORT(transport));
@@ -110,17 +108,28 @@ START_TEST (test_simple_message)
test_transport_write (transport, (guint8 *) chunk, chunk_length);
}
- fail_if (parse_error_found);
+ g_assert (!parse_error_found);
g_free (file);
file_chunker_destroy (fc);
-} END_TEST
+}
-TCase *
-make_gibber_xmpp_connection_tcase (void)
+int
+main (int argc,
+ char **argv)
{
- TCase *tc = tcase_create ("XMPP Connection");
- tcase_add_test (tc, test_instantiation);
- tcase_add_test (tc, test_simple_message);
- return tc;
+ g_test_init (&argc, &argv, NULL);
+ g_type_init ();
+
+ /* Kill tests in 20 seconds */
+ alarm (20);
+
+ g_test_add_func ("/gibber/xmpp-connection/instantiation",
+ test_instantiation);
+ g_test_add_func ("/gibber/xmpp-connection/simple-message",
+ test_simple_message);
+
+ return g_test_run ();
}
+
+#include "test-transport.c"
diff --git a/lib/gibber/tests/check-gibber-xmpp-error.c b/lib/gibber/tests/check-gibber-xmpp-error.c
index c0bf5f96..926b2720 100644
--- a/lib/gibber/tests/check-gibber-xmpp-error.c
+++ b/lib/gibber/tests/check-gibber-xmpp-error.c
@@ -28,9 +28,6 @@
#define DEBUG_FLAG DEBUG_XMPP
#include <gibber/gibber-debug.h>
-#include <check.h>
-#include "check-gibber.h"
-
static void
test_xmpp_error_to_node_with_bad_request (void)
{
@@ -46,17 +43,17 @@ test_xmpp_error_to_node_with_bad_request (void)
node = gibber_xmpp_error_to_node (XMPP_ERROR_BAD_REQUEST,
wocky_stanza_get_top_node (stanza), NULL);
- fail_if (node == NULL);
- fail_if (strcmp (node->name, "error") != 0);
+ g_assert (node != NULL);
+ g_assert_cmpstr (node->name, ==, "error");
code = wocky_node_get_attribute (node, "code");
- fail_if (code == NULL || strcmp (code, "400") != 0);
+ g_assert (!(code == NULL || strcmp (code, "400") != 0));
type = wocky_node_get_attribute (node, "type");
- fail_if (type == NULL || strcmp (type, "modify") != 0);
+ g_assert (!(type == NULL || strcmp (type, "modify") != 0));
- fail_if (wocky_node_get_child_ns (node, "bad-request",
- "urn:ietf:params:xml:ns:xmpp-stanzas") == NULL);
+ g_assert (wocky_node_get_child_ns (node, "bad-request",
+ "urn:ietf:params:xml:ns:xmpp-stanzas") != NULL);
g_object_unref (stanza);
}
@@ -76,31 +73,33 @@ test_xmpp_error_to_node_with_si_bad_profile (void)
node = gibber_xmpp_error_to_node (XMPP_ERROR_SI_BAD_PROFILE,
wocky_stanza_get_top_node (stanza), NULL);
- fail_if (node == NULL);
- fail_if (strcmp (node->name, "error") != 0);
+ g_assert (node != NULL);
+ g_assert_cmpstr (node->name, ==, "error");
code = wocky_node_get_attribute (node, "code");
- fail_if (code == NULL || strcmp (code, "400") != 0);
+ g_assert (!(code == NULL || strcmp (code, "400") != 0));
type = wocky_node_get_attribute (node, "type");
- fail_if (type == NULL || strcmp (type, "modify") != 0);
+ g_assert (!(type == NULL || strcmp (type, "modify") != 0));
- fail_if (wocky_node_get_child_ns (node, "bad-request",
- "urn:ietf:params:xml:ns:xmpp-stanzas") == NULL);
+ g_assert (wocky_node_get_child_ns (node, "bad-request",
+ "urn:ietf:params:xml:ns:xmpp-stanzas") != NULL);
- fail_if (wocky_node_get_child_ns (node, "bad-profile",
- "http://jabber.org/protocol/si") == NULL);
+ g_assert (wocky_node_get_child_ns (node, "bad-profile",
+ "http://jabber.org/protocol/si") != NULL);
g_object_unref (stanza);
}
-START_TEST (test_xmpp_error_to_node)
+static void
+test_xmpp_error_to_node (void)
{
test_xmpp_error_to_node_with_bad_request ();
test_xmpp_error_to_node_with_si_bad_profile ();
-} END_TEST
+}
-START_TEST (test_message_get_xmpp_error)
+static void
+test_message_get_xmpp_error (void)
{
GibberXmppError xmpp_error;
@@ -117,24 +116,30 @@ START_TEST (test_message_get_xmpp_error)
wocky_stanza_get_top_node (stanza), NULL);
error = gibber_message_get_xmpp_error (stanza);
- fail_if (error == NULL);
+ g_assert (error != NULL);
- fail_if (error->domain != GIBBER_XMPP_ERROR);
- fail_if (error->code != (gint) xmpp_error);
- fail_if (strcmp (error->message, gibber_xmpp_error_description (
- xmpp_error)) != 0);
+ g_assert (error->domain == GIBBER_XMPP_ERROR);
+ g_assert (error->code == (gint) xmpp_error);
+ g_assert_cmpstr (error->message, ==,
+ gibber_xmpp_error_description (xmpp_error));
g_object_unref (stanza);
g_error_free (error);
}
-} END_TEST
+}
-TCase *
-make_gibber_xmpp_error_tcase (void)
+int
+main (int argc,
+ char **argv)
{
- TCase *tc = tcase_create ("XMPP Error");
- tcase_add_test (tc, test_xmpp_error_to_node);
- tcase_add_test (tc, test_message_get_xmpp_error);
- return tc;
+ g_test_init (&argc, &argv, NULL);
+ g_type_init ();
+
+ g_test_add_func ("/gibber/xmpp-error/to-node",
+ test_xmpp_error_to_node);
+ g_test_add_func ("/gibber/xmpp-error/message-get-xmpp-error",
+ test_message_get_xmpp_error);
+
+ return g_test_run ();
}
diff --git a/lib/gibber/tests/check-gibber-xmpp-reader.c b/lib/gibber/tests/check-gibber-xmpp-reader.c
index 59b3cf91..42bf9930 100644
--- a/lib/gibber/tests/check-gibber-xmpp-reader.c
+++ b/lib/gibber/tests/check-gibber-xmpp-reader.c
@@ -5,10 +5,6 @@
#include <gibber/gibber-xmpp-reader.h>
#include <wocky/wocky-stanza.h>
-#include <check.h>
-
-#include "check-gibber.h"
-
typedef struct _ReceivedStanzaEvent ReceivedStanzaEvent;
struct _ReceivedStanzaEvent {
@@ -22,9 +18,9 @@ static void received_stanza_cb (GibberXmppReader *reader,
GQueue *events_queue = (GQueue *) user_data;
ReceivedStanzaEvent *event;
- fail_if (reader == NULL);
- fail_if (stanza == NULL);
- fail_if (events_queue == NULL);
+ g_assert (reader != NULL);
+ g_assert (stanza != NULL);
+ g_assert (events_queue != NULL);
g_object_ref (stanza);
@@ -36,16 +32,17 @@ static void received_stanza_cb (GibberXmppReader *reader,
}
-START_TEST (test_instantiation)
+static void
+test_instantiation (void)
{
GibberXmppReader *reader;
reader = gibber_xmpp_reader_new_no_stream ();
- fail_if (reader == NULL);
+ g_assert (reader != NULL);
g_object_unref (reader);
}
-END_TEST
-START_TEST (test_simple_message)
+static void
+test_simple_message (void)
{
GibberXmppReader *reader;
WockyNode *node;
@@ -73,41 +70,39 @@ START_TEST (test_simple_message)
file = g_strdup_printf ("%s/inputs/simple-message.input", srcdir);
}
- fail_unless (g_file_get_contents (file, &data, &length, NULL));
+ g_assert (g_file_get_contents (file, &data, &length, NULL));
g_free (file);
valid = gibber_xmpp_reader_push (reader, (guint8 *) data, length, NULL);
- fail_unless (valid);
+ g_assert (valid);
- fail_unless (g_queue_get_length (received_stanzas) == 2);
+ g_assert (g_queue_get_length (received_stanzas) == 2);
event = g_queue_pop_head (received_stanzas);
- fail_unless (event->reader == reader);
+ g_assert (event->reader == reader);
node = wocky_stanza_get_top_node (event->stanza);
- fail_if (node == NULL);
- fail_unless (strcmp (node->name, "message") == 0);
- fail_unless (strcmp (wocky_node_get_language (node), "en") == 0);
- fail_unless (strcmp (wocky_node_get_attribute (node, "to"),
- "juliet@example.com") == 0);
- fail_unless (strcmp (wocky_node_get_attribute (node, "id"),
- "0") == 0);
+ g_assert (node != NULL);
+ g_assert_cmpstr (node->name, ==, "message");
+ g_assert_cmpstr (wocky_node_get_language (node), ==, "en");
+ g_assert_cmpstr (wocky_node_get_attribute (node, "to"), ==,
+ "juliet@example.com");
+ g_assert_cmpstr (wocky_node_get_attribute (node, "id"), ==, "0");
g_object_unref (event->stanza);
g_free (event);
event = g_queue_pop_head (received_stanzas);
- fail_unless (event->reader == reader);
+ g_assert (event->reader == reader);
node = wocky_stanza_get_top_node (event->stanza);
- fail_unless (strcmp (node->name, "message") == 0);
- fail_unless (strcmp (wocky_node_get_language (node), "en") == 0);
- fail_unless (strcmp (wocky_node_get_attribute (node, "to"),
- "juliet@example.com") == 0);
- fail_unless (strcmp (wocky_node_get_attribute (node, "id"),
- "1") == 0);
+ g_assert_cmpstr (node->name, ==, "message");
+ g_assert_cmpstr (wocky_node_get_language (node), ==, "en");
+ g_assert_cmpstr (wocky_node_get_attribute (node, "to"), ==,
+ "juliet@example.com");
+ g_assert_cmpstr (wocky_node_get_attribute (node, "id"), ==, "1");
g_free (data);
g_queue_free (received_stanzas);
@@ -115,13 +110,18 @@ START_TEST (test_simple_message)
g_free (event);
g_object_unref (reader);
}
-END_TEST
-TCase *
-make_gibber_xmpp_reader_tcase (void)
+int
+main (int argc,
+ char **argv)
{
- TCase *tc = tcase_create ("XMPP Reader");
- tcase_add_test (tc, test_instantiation);
- tcase_add_test (tc, test_simple_message);
- return tc;
+ g_test_init (&argc, &argv, NULL);
+ g_type_init ();
+
+ g_test_add_func ("/gibber/xmpp-reader/instantiation",
+ test_instantiation);
+ g_test_add_func ("/gibber/xmpp-reader/simple-message",
+ test_simple_message);
+
+ return g_test_run ();
}
diff --git a/lib/gibber/tests/check-gibber.h b/lib/gibber/tests/check-gibber.h
deleted file mode 100644
index 8e29b730..00000000
--- a/lib/gibber/tests/check-gibber.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef __CHECK_GIBBER_H__
-#define __CHECK_GIBBER_H__
-
-#include <check.h>
-
-TCase *make_gibber_xmpp_reader_tcase (void);
-TCase *make_gibber_xmpp_connection_tcase (void);
-TCase *make_gibber_r_multicast_packet_tcase (void);
-TCase *make_gibber_r_multicast_causal_transport_tcase (void);
-TCase *make_gibber_r_multicast_sender_tcase (void);
-TCase *make_gibber_iq_helper_tcase (void);
-TCase *make_gibber_listener_tcase (void);
-TCase *make_gibber_xmpp_connection_listener_tcase (void);
-TCase *make_gibber_xmpp_error_tcase (void);
-TCase *make_gibber_unix_transport_tcase (void);
-
-#endif /* #ifndef __CHECK_GIBBER_H__ */
diff --git a/lib/gibber/tests/check-helpers.c b/lib/gibber/tests/check-helpers.c
deleted file mode 100644
index 86ef1154..00000000
--- a/lib/gibber/tests/check-helpers.c
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * check-helpers.c - Source for some check helpers
- * Copyright (C) 2007 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "check-helpers.h"
-
-static gboolean expecting_critical = FALSE;
-static gboolean received_critical = FALSE;
-
-static void
-check_helper_log_critical_func (const gchar *log_damain,
- GLogLevelFlags log_level,
- const gchar *message,
- gpointer user_data)
-{
-
- if (!expecting_critical)
- {
- fail ("Unexpected critical message: %s\n", message);
- }
-
- g_assert (log_level & G_LOG_LEVEL_CRITICAL);
-
- received_critical = TRUE;
-}
-
-gboolean
-got_critical (void)
-{
- return received_critical;
-}
-
-void
-expect_critical (gboolean expected)
-{
- expecting_critical = expected;
- received_critical = FALSE;
-}
-
-void
-check_helpers_init (void)
-{
- g_log_set_handler (NULL, G_LOG_LEVEL_CRITICAL,
- check_helper_log_critical_func, NULL);
-}
diff --git a/lib/gibber/tests/check-helpers.h b/lib/gibber/tests/check-helpers.h
deleted file mode 100644
index b71b3b65..00000000
--- a/lib/gibber/tests/check-helpers.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * check-helpers.c - Source for some check helpers
- * Copyright (C) 2007 Collabora Ltd.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#ifndef __CHECK_HELPERS_H__
-#define __CHECK_HELPERS_H__
-
-#include <glib.h>
-#include <check.h>
-
-void
-check_helpers_init (void);
-
-void
-expect_critical (gboolean expected);
-
-gboolean
-got_critical (void);
-
-#define fail_unless_critical(expr, ...) \
-G_STMT_START { \
- expect_critical (TRUE); \
- expr; \
- _fail_unless (got_critical (), __FILE__, __LINE__, \
- "Expected g_critical, got none", ## __VA_ARGS__, NULL); \
- expect_critical (FALSE); \
-} G_STMT_END;
-
-#endif /* #ifndef __CHECK_HELPERS_H__ */
diff --git a/lib/gibber/tests/check-main.c b/lib/gibber/tests/check-main.c
deleted file mode 100644
index 4cd9b6f6..00000000
--- a/lib/gibber/tests/check-main.c
+++ /dev/null
@@ -1,53 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <glib-object.h>
-
-#include <wocky/wocky.h>
-
-#include <check.h>
-
-#include "check-gibber.h"
-#include "check-helpers.h"
-
-#include "config.h"
-
-static Suite *
-make_gibber_suite (void)
-{
- Suite *s = suite_create ("Gibber");
-
- suite_add_tcase (s, make_gibber_xmpp_reader_tcase ());
- suite_add_tcase (s, make_gibber_xmpp_connection_tcase ());
- suite_add_tcase (s, make_gibber_r_multicast_packet_tcase ());
- suite_add_tcase (s, make_gibber_r_multicast_sender_tcase ());
- suite_add_tcase (s, make_gibber_r_multicast_causal_transport_tcase ());
- suite_add_tcase (s, make_gibber_iq_helper_tcase ());
- suite_add_tcase (s, make_gibber_listener_tcase ());
- suite_add_tcase (s, make_gibber_xmpp_connection_listener_tcase ());
- suite_add_tcase (s, make_gibber_xmpp_error_tcase ());
- suite_add_tcase (s, make_gibber_unix_transport_tcase ());
-
- return s;
-}
-
-int
-main (void)
-{
- int number_failed = 0;
- Suite *s;
- SRunner *sr;
-
- check_helpers_init ();
- g_type_init ();
- wocky_init ();
-
- s = make_gibber_suite ();
- sr = srunner_create (s);
- srunner_run_all (sr, CK_NORMAL);
- number_failed += srunner_ntests_failed (sr);
- srunner_free (sr);
-
- wocky_deinit ();
- return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
-}