summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2010-01-25 10:24:33 +0200
committerDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2010-01-25 10:24:33 +0200
commitafcd800a2e779f6df7281d73c9d0bb801fb198bf (patch)
treec3cf5a3978e4d478ea2b5947a5aa833e8dbcc20f /src/tests
parent92202ac6ebb0229aa5d8899fafe7ab8b22bc7cff (diff)
* set up (unit) test framework using gtester
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/Makefile.am45
-rwxr-xr-xsrc/tests/test-utilbin0 -> 19704 bytes
-rw-r--r--src/tests/test-util.c60
3 files changed, 105 insertions, 0 deletions
diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am
new file mode 100644
index 0000000..fa595cb
--- /dev/null
+++ b/src/tests/Makefile.am
@@ -0,0 +1,45 @@
+## Copyright (C) 2010 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
+##
+## This program is free software; you can redistribute it and/or modify it
+## under the terms of the GNU General Public License as published by the
+## Free Software Foundation; either version 3, or (at your option) any
+## later version.
+##
+## This program 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 General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software Foundation,
+## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+include $(top_srcdir)/gtest.mk
+
+INCLUDES=$(XAPIAN_CXXFLAGS) \
+ $(GMIME_CFLAGS) \
+ $(GLIB_CFLAGS) \
+ -I ${top_srcdir} \
+ -DABS_SRCDIR=\"${abs_srcdir}\"
+
+noinst_PROGRAMS= $(TEST_PROGS)
+
+TEST_PROGS += test-util
+test_util_SOURCES= test-util.c
+test_util_LDADD= ${top_srcdir}/src/libmu.la
+
+
+# note the question marks; make does not like files with ':'...
+# 11 messages, the '.ignore' message should be ignored when indexing
+# EXTRA_DIST= \
+# TestMaildir/tmp/1220863087.12663.ignore \
+# TestMaildir/new/1220863087.12663_9.mindcrime \
+# TestMaildir/new/1220863087.12663_25.mindcrime \
+# TestMaildir/new/1220863087.12663_21.mindcrime \
+# TestMaildir/new/1220863087.12663_23.mindcrime \
+# TestMaildir/cur/1220863087.12663_5.mindcrime?2,S \
+# TestMaildir/cur/1220863087.12663_7.mindcrime?2,RS \
+# TestMaildir/cur/1220863087.12663_15.mindcrime?2,PS \
+# TestMaildir/cur/1220863087.12663_19.mindcrime?2,S \
+# TestMaildir/cur/1220863042.12663_1.mindcrime?2,S \
+# TestMaildir/cur/1220863060.12663_3.mindcrime?2,S
diff --git a/src/tests/test-util b/src/tests/test-util
new file mode 100755
index 0000000..3d17a81
--- /dev/null
+++ b/src/tests/test-util
Binary files differ
diff --git a/src/tests/test-util.c b/src/tests/test-util.c
new file mode 100644
index 0000000..2f5ed7a
--- /dev/null
+++ b/src/tests/test-util.c
@@ -0,0 +1,60 @@
+/*
+** Copyright (C) 2010 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
+**
+** This program is free software; you can redistribute it and/or modify it
+** under the terms of the GNU General Public License as published by the
+** Free Software Foundation; either version 3, or (at your option) any
+** later version.
+**
+** This program 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 General Public License for more details.
+**
+** You should have received a copy of the GNU General Public License
+** along with this program; if not, write to the Free Software Foundation,
+** Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+**
+*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif /*HAVE_CONFIG_H*/
+
+#include <glib.h>
+#include <stdlib.h>
+
+#include "src/mu-util.h"
+
+static void
+test_mu_util_dir_expand (void)
+{
+ gchar *got, *expected;
+
+ got = mu_util_dir_expand ("~/Desktop");
+ expected = g_strdup_printf ("%s%cDesktop",
+ getenv("HOME"), G_DIR_SEPARATOR);
+
+ g_assert_cmpstr (got,==,expected);
+ g_free (got);
+ g_free (expected);
+}
+
+
+static void
+shutup (void) {}
+
+int
+main (int argc, char *argv[])
+{
+ g_test_init (&argc, &argv, NULL);
+
+ g_test_add_func ("/mu-util/mu-util-dir-expand-01",
+ test_mu_util_dir_expand);
+
+ g_log_set_handler (NULL,
+ G_LOG_LEVEL_DEBUG|G_LOG_LEVEL_MESSAGE|G_LOG_LEVEL_INFO,
+ (GLogFunc)shutup, NULL);
+
+ return g_test_run ();
+}