[gnome-commander] Adds first tiny unit test for function in src/utils-no-dependencies.cc



commit 8fd7a1417c0cb0042c9846d7dfe168a464df0818
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Thu Jun 29 23:08:24 2017 +0200

    Adds first tiny unit test for function in src/utils-no-dependencies.cc

 tests/Makefile.am                    |   21 ++++++++++++++++++-
 tests/gcmd_tests_main.cc             |    4 +--
 tests/utils_no_dependencies_tests.cc |   36 ++++++++++++++++++++++++++++++++++
 3 files changed, 57 insertions(+), 4 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3551046..230b325 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -24,13 +24,20 @@ INTVLIBS = \
        $(GNOMEUI_LIBS) \
        -lgtest
 
+GCMD_LIBS = \
+       $(GLIB_LIBS) \
+       $(GOBJECT_CFLAGS) \
+       $(GTK_LIBS) \
+       $(GNOMEUI_LIBS) \
+       -lgtest
+
 ADDITIONAL_LDADD = \
        $(top_builddir)/src/intviewer/libgviewer.a \
        $(GOBJECT_LIBS) \
        $(GTK_LIBS) \
        $(GNOMEUI_LIBS)
 
-TESTS = \
+IV_TESTS = \
        iv_viewerwidget \
        iv_fileops \
        iv_bm_search \
@@ -39,6 +46,13 @@ TESTS = \
        iv_inputmodes \
        iv_textrenderer
 
+GCMD_TESTS = \
+       utils_no_dependencies
+
+TESTS = \
+       $(IV_TESTS) \
+       $(GCMD_TESTS)
+
 check_PROGRAMS = $(TESTS)
 
 # *** Internal Viewer Tests *** Most of these only consist of serialised
@@ -79,4 +93,9 @@ iv_datapresentation_CXXFLAGS = $(AM_CPPFLAGS)
 iv_datapresentation_LDFLAGS = $(INTVLIBS)
 iv_datapresentation_LDADD = $(ADDITIONAL_LDADD)
 
+utils_no_dependencies_SOURCES = utils_no_dependencies_tests.cc $(top_srcdir)/src/utils-no-dependencies.cc 
gcmd_tests_main.cc
+utils_no_dependencies_CXXFLAGS = $(AM_CPPFLAGS)
+utils_no_dependencies_LDFLAGS = $(GCMD_LIBS)
+utils_no_dependencies_LDADD = $(ADDITIONAL_LDADD)
+
 -include $(top_srcdir)/git.mk
diff --git a/tests/gcmd_tests_main.cc b/tests/gcmd_tests_main.cc
index 3e3dba1..dc2eeae 100644
--- a/tests/gcmd_tests_main.cc
+++ b/tests/gcmd_tests_main.cc
@@ -22,11 +22,9 @@
  */
 
  #include "gtest/gtest.h"
- #include <glib-object.h>
+
 
 int main(int argc, char **argv) {
-  if (glib_check_version (2, 36, 0) != NULL)
-    g_type_init ();
   ::testing::InitGoogleTest(&argc, argv);
   return RUN_ALL_TESTS();
 }
diff --git a/tests/utils_no_dependencies_tests.cc b/tests/utils_no_dependencies_tests.cc
new file mode 100644
index 0000000..fecb06b
--- /dev/null
+++ b/tests/utils_no_dependencies_tests.cc
@@ -0,0 +1,36 @@
+/**
+ * @file utils_no_dependencies_test.cc
+ * @brief Part of GNOME Commander - A GNOME based file manager
+ *
+ * @details In this file all tests are placed which belong to the
+ * Boyer–Moore string search algorithm, used in the internal viewer of
+ * GCMD. Currently, only a single test is implemented in which a short
+ * pattern of integers is searched inside a bigger array of integers.
+ *
+ * @copyright (C) 2013-2017 Uwe Scholz\n
+ *
+ * @copyright 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 2 of the License, or
+ * (at your option) any later version.
+ *
+ * @copyright 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.
+ *
+ * @copyright 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 St, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <glib.h>
+#include <gtest/gtest.h>
+#include "../src/gnome-cmd-includes.h"
+#include "../src/utils-no-dependencies.h"
+
+
+TEST(StrUriBasename, IfNullReturnNull)
+{
+    EXPECT_EQ (NULL, str_uri_basename(NULL));
+}


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