summaryrefslogtreecommitdiff
path: root/tests/internal-debug.c
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2009-03-17 14:44:10 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2009-03-17 14:44:10 +0000
commit85aa079ae7e85f5e7ea4486e0d9c39440506dbef (patch)
tree16e4568be48945e03ec73a6a07d0148099abe1a3 /tests/internal-debug.c
parent07a1c96e574ce45fd82f4919c78df11ddc16f683 (diff)
downloadtelepathy-glib-85aa079ae7e85f5e7ea4486e0d9c39440506dbef.tar.gz
tests: remove test- prefix from all sources
As well as making tab completion work better, this means .gitignore can be much simpler.
Diffstat (limited to 'tests/internal-debug.c')
-rw-r--r--tests/internal-debug.c79
1 files changed, 79 insertions, 0 deletions
diff --git a/tests/internal-debug.c b/tests/internal-debug.c
new file mode 100644
index 000000000..b852da78d
--- /dev/null
+++ b/tests/internal-debug.c
@@ -0,0 +1,79 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <glib.h>
+
+#include <telepathy-glib/debug.h>
+
+#undef DEBUG_FLAG
+#define DEBUG_FLAG TP_DEBUG_IM
+#include "telepathy-glib/debug-internal.h"
+
+static void
+test_debugging (void)
+{
+#ifndef DEBUG
+#error internal-debug.h should always define DEBUG
+#endif
+
+#ifndef DEBUGGING
+#error internal-debug.h should always define DEBUGGING
+#endif
+
+#ifdef ENABLE_DEBUG
+ g_assert (DEBUGGING == 1);
+#else
+ g_assert (DEBUGGING == 0);
+#endif
+}
+
+#undef DEBUG_FLAG
+#define DEBUG_FLAG TP_DEBUG_CONNECTION
+#include "telepathy-glib/debug-internal.h"
+
+static void
+test_not_debugging (void)
+{
+#ifndef DEBUG
+#error internal-debug.h should always define DEBUG
+#endif
+
+#ifndef DEBUGGING
+#error internal-debug.h should always define DEBUGGING
+#endif
+
+ g_assert (DEBUGGING == 0);
+}
+
+#undef DEBUG_FLAG
+#define DEBUG_FLAG TP_DEBUG_IM
+#include "telepathy-glib/debug-internal.h"
+
+static void
+test_debugging_again (void)
+{
+#ifndef DEBUG
+#error internal-debug.h should always define DEBUG
+#endif
+
+#ifndef DEBUGGING
+#error internal-debug.h should always define DEBUGGING
+#endif
+
+#ifdef ENABLE_DEBUG
+ g_assert (DEBUGGING == 1);
+#else
+ g_assert (DEBUGGING == 0);
+#endif
+}
+
+int
+main (int argc, char **argv)
+{
+ /* We enable debugging for IM, but not for the connection. */
+ tp_debug_set_flags ("im");
+ test_debugging ();
+ test_not_debugging ();
+ test_debugging_again ();
+ return 0;
+}