[easytag/wip/test-scan: 27/27] Add simple scanner test



commit 788ffd43c1ad6fe19721cf0f43a26f1f8f390b74
Author: David King <amigadave amigadave com>
Date:   Sat Mar 8 10:54:40 2014 +0000

    Add simple scanner test

 Makefile.am       |   21 ++++++++++++++++++++-
 tests/test-scan.c |   18 ++++++++++++++++++
 2 files changed, 38 insertions(+), 1 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 36935d3..312c312 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -123,6 +123,24 @@ easytag_LDADD = \
        $(ID3LIB_LIBS) \
        $(easytag_rc)
 
+check_PROGRAMS = tests/test-scan
+tests_test_scan_CPPFLAGS = \
+       -I$(top_srcdir)/src \
+       -I$(top_builddir) \
+       $(DEPRECATED_CPPFLAGS)
+
+tests_test_scan_CFLAGS = \
+       $(WARN_CFLAGS) \
+       $(EASYTAG_CFLAGS)
+
+tests_test_scan_SOURCES = \
+       tests/test-scan.c \
+       src/scan.c
+
+tests_test_scan_LDADD = \
+       $(EASYTAG_LIBS) \
+       $(ID3LIB_LIBS)
+
 if WINDOWS_HOST
 ICONDIR = $(srcdir)/data/icons/win32
 MANIFESTDIR = $(srcdir)/src/win32
@@ -273,7 +291,8 @@ check_SCRIPTS = \
        tests/test-desktop-file-validate.sh
 
 TESTS = \
-       $(check_SCRIPTS)
+       $(check_SCRIPTS) \
+       tests/test-scan
 endif
 
 CLEANFILES = \
diff --git a/tests/test-scan.c b/tests/test-scan.c
new file mode 100644
index 0000000..fca2ae6
--- /dev/null
+++ b/tests/test-scan.c
@@ -0,0 +1,18 @@
+#include <gtk/gtk.h>
+#include "scan.h"
+
+static void
+scanTest (void)
+{
+    gchar *string = "STRING_A_B";
+    Scan_Convert_Underscore_Into_Space (string);
+    g_assert_cmpstr (string, ==, "STRING A B");
+}
+
+int
+main (int argc, char** argv)
+{
+    g_test_init (&argc, &argv, NULL);
+    g_test_add_func ("/scantest", scanTest);
+    return g_test_run ();
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]