]> granicus.if.org Git - icinga2/commitdiff
Fix 'make check-coverage' for VPATH builds.
authorGunnar Beutner <gunnar.beutner@netways.de>
Fri, 19 Apr 2013 11:51:33 +0000 (13:51 +0200)
committerGunnar Beutner <gunnar.beutner@netways.de>
Fri, 19 Apr 2013 11:51:33 +0000 (13:51 +0200)
Makefile.am
test/Makefile.am
test/base-match.cpp [new file with mode: 0644]

index bbb11c2bc3e7225f0b768716c4a9b6694f6f0283..4e80c72c1f7137ddcc763bf041b8b1b3f3bf9503 100644 (file)
@@ -68,7 +68,7 @@ check-coverage: all
        lcov -d . -z
        make check
        lcov -d . -c -o icinga2.info
-       lcov -e icinga2.info -o icinga2-filtered.info `pwd`\*
+       lcov -e icinga2.info -o icinga2-filtered.info "`readlink -f $(top_srcdir)`/*"
        mkdir -p docs/lcov
        genhtml -o docs/lcov icinga2-filtered.info
 
index 3199fca59d5264dc96c245f6627eac77661d62a2..4aa1963c8a5484fa3b56e21a4aabb97062adb144 100644 (file)
@@ -12,6 +12,7 @@ icinga2_test_SOURCES = \
        base-convert.cpp \
        base-dictionary.cpp \
        base-fifo.cpp \
+       base-match.cpp \
        base-object.cpp \
        base-shellescape.cpp \
        base-timer.cpp
diff --git a/test/base-match.cpp b/test/base-match.cpp
new file mode 100644 (file)
index 0000000..84ae92e
--- /dev/null
@@ -0,0 +1,36 @@
+/******************************************************************************
+ * Icinga 2                                                                   *
+ * Copyright (C) 2012 Icinga Development Team (http://www.icinga.org/)        *
+ *                                                                            *
+ * 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.                     *
+ *                                                                            *
+ * 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 St, Fifth Floor, Boston, MA 02110-1301, USA.             *
+ ******************************************************************************/
+
+#include "base/utility.h"
+#include <boost/test/unit_test.hpp>
+
+using namespace icinga;
+
+BOOST_AUTO_TEST_SUITE(base_match)
+
+BOOST_AUTO_TEST_CASE(tolong)
+{
+       BOOST_CHECK(Utility::Match("*", "hello"));
+       BOOST_CHECK(!Utility::Match("world", "hello"));
+       BOOST_CHECK(!Utility::Match("hee*", "hello"));
+       BOOST_CHECK(Utility::Match("he??o", "hello"));
+       BOOST_CHECK(Utility::Match("he?", "hel"));
+}
+
+BOOST_AUTO_TEST_SUITE_END()