diff options
-rw-r--r-- | fastlib/CMakeLists.txt | 2 | ||||
-rw-r--r-- | fastlib/src/vespa/fastlib/util/.gitignore | 15 | ||||
-rw-r--r-- | fastlib/src/vespa/fastlib/util/CMakeLists.txt | 6 | ||||
-rw-r--r-- | fastlib/src/vespa/fastlib/util/testproject.el | 20 | ||||
-rw-r--r-- | fastlib/src/vespa/fastlib/util/tests/.gitignore | 42 | ||||
-rw-r--r-- | fastlib/src/vespa/fastlib/util/tests/CMakeLists.txt | 8 | ||||
-rw-r--r-- | fastlib/src/vespa/fastlib/util/tests/wildcard_match_test.cpp | 47 | ||||
-rw-r--r-- | fastlib/src/vespa/packages/CMakeLists.txt | 1 | ||||
-rw-r--r-- | juniper/src/test/matchobjectTestApp.cpp | 29 | ||||
-rw-r--r-- | juniper/src/vespa/juniper/matchobject.cpp | 2 | ||||
-rw-r--r-- | juniper/src/vespa/juniper/wildcard_match.h (renamed from fastlib/src/vespa/fastlib/util/wildcard_match.h) | 0 |
11 files changed, 30 insertions, 142 deletions
diff --git a/fastlib/CMakeLists.txt b/fastlib/CMakeLists.txt index 035c691c04b..8d7208e956c 100644 --- a/fastlib/CMakeLists.txt +++ b/fastlib/CMakeLists.txt @@ -11,7 +11,5 @@ vespa_define_module( src/vespa/fastlib/text src/vespa/fastlib/text/apps src/vespa/fastlib/text/tests - src/vespa/fastlib/util - src/vespa/fastlib/util/tests src/vespa/packages ) diff --git a/fastlib/src/vespa/fastlib/util/.gitignore b/fastlib/src/vespa/fastlib/util/.gitignore deleted file mode 100644 index da7183fc8af..00000000000 --- a/fastlib/src/vespa/fastlib/util/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -*.So -*.a -*.ilk -*.lib -*.o -*.obj -*.pdb -.cvsignore -.depend -.pure -Debug -Makefile -SunWS_cache -extcase -extprop diff --git a/fastlib/src/vespa/fastlib/util/CMakeLists.txt b/fastlib/src/vespa/fastlib/util/CMakeLists.txt deleted file mode 100644 index 56c7baabee2..00000000000 --- a/fastlib/src/vespa/fastlib/util/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_library(fastlib_util - SOURCES - INSTALL lib64 - DEPENDS -) diff --git a/fastlib/src/vespa/fastlib/util/testproject.el b/fastlib/src/vespa/fastlib/util/testproject.el deleted file mode 100644 index 94bbe60394d..00000000000 --- a/fastlib/src/vespa/fastlib/util/testproject.el +++ /dev/null @@ -1,20 +0,0 @@ -;; Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -;; testproject.el - -;; Local configurations for the cpptest Emacs unit-test framework - -;; Author: Nils Sandøy <nils.sandoy@fast.no> - -(message "Setting local test configuration") - -(setq cppt-test-dir "tests") - -(setq cppt-use-underscore-p t) - -(setq cppt-extra-object-files '()) - -;; We have no parameters to our test executables -(setq cppt-test-parameters "") - -;; Use -d to turn on debug mode -(setq cppt-test-dbflags "-d") diff --git a/fastlib/src/vespa/fastlib/util/tests/.gitignore b/fastlib/src/vespa/fastlib/util/tests/.gitignore deleted file mode 100644 index c43f5961bad..00000000000 --- a/fastlib/src/vespa/fastlib/util/tests/.gitignore +++ /dev/null @@ -1,42 +0,0 @@ -*.So -*.a -*.ilk -*.o -*.obj -*.pdb -.cvsignore -.depend -.pure -Debug -Makefile -SunWS_cache -arraytest -bagtest -base64test -bitstest -bloomfilter.* -bloomfiltertest -bobhashtest -crc32test -datetimetest -debugtest -fixedarraytest -flisttest -genkeyhashmaptest -hashmaptest -hashtabletest -refcounttest -resourcestatstest -ringbuffertest -scopeguardtest -singletontest -stacktest -stringbuffertest -stringtest -stringutilitytest -trietest -utiltestsuite -wildcard_match_test -fastlib_wildcard_match_test_app -fastlib_bagtest_app -fastlib_base64test_app diff --git a/fastlib/src/vespa/fastlib/util/tests/CMakeLists.txt b/fastlib/src/vespa/fastlib/util/tests/CMakeLists.txt deleted file mode 100644 index cf655b548e5..00000000000 --- a/fastlib/src/vespa/fastlib/util/tests/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_executable(fastlib_wildcard_match_test_app TEST - SOURCES - wildcard_match_test.cpp - DEPENDS - fastlib_fast_testsuite -) -vespa_add_test(NAME fastlib_wildcard_match_test_app NO_VALGRIND COMMAND fastlib_wildcard_match_test_app) diff --git a/fastlib/src/vespa/fastlib/util/tests/wildcard_match_test.cpp b/fastlib/src/vespa/fastlib/util/tests/wildcard_match_test.cpp deleted file mode 100644 index a63a6943fc6..00000000000 --- a/fastlib/src/vespa/fastlib/util/tests/wildcard_match_test.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <iostream> -#include "../wildcard_match.h" - -namespace -{ -template<typename T> -bool Test(const T* word, const T* pattern, bool expect) -{ - if (fast::util::wildcard_match(word, pattern) != expect) - { - if (expect == true) - std::cout << "ERROR: " << word << " didn't match " << pattern << std::endl; - else - std::cout << "ERROR: " << word << " matched " << pattern << std::endl; - - return false; - } - - return true; -} -} - -int main(int, char **) -{ - bool success = - Test("a", "b", false) && - Test("b", "b", true) && - Test("abc", "def", false) && - Test("def", "def", true) && - Test("def", "d?f", true) && - Test("def", "d?d", false) && - Test("def", "??d", false) && - Test("def", "d??", true) && - Test("abcdef", "a*e", false) && - Test("abcdef", "a*f", true) && - Test("abcdef", "a?c*f", true) && - Test("abcdef", "a?b*f", false) && - Test("abcdef", "a*b*f", true) && - Test("abcdef", "abc*", true) && - Test("abcdef", "*def", true); - - if (success == true) - std::cout << "wildcard_match_test: SUCCESS" << std::endl; - - return 0; -} diff --git a/fastlib/src/vespa/packages/CMakeLists.txt b/fastlib/src/vespa/packages/CMakeLists.txt index f6a00c9ec06..ca4437854d3 100644 --- a/fastlib/src/vespa/packages/CMakeLists.txt +++ b/fastlib/src/vespa/packages/CMakeLists.txt @@ -5,6 +5,5 @@ vespa_add_library(fastlib_fast DEPENDS fastlib_text fastlib_io - fastlib_util fastlib_fast_testsuite ) diff --git a/juniper/src/test/matchobjectTestApp.cpp b/juniper/src/test/matchobjectTestApp.cpp index 7fae5b4c0de..525f7b9446a 100644 --- a/juniper/src/test/matchobjectTestApp.cpp +++ b/juniper/src/test/matchobjectTestApp.cpp @@ -3,8 +3,37 @@ #include "matchobjectTest.h" #include "testenv.h" #include <vespa/vespalib/testkit/testapp.h> +#include <vespa/juniper/wildcard_match.h> +#include <iostream> + +namespace { +void test(const char * word, const char * pattern, bool expect) { + EXPECT_EQUAL(expect, fast::util::wildcard_match(word, pattern)); +} +} + +void +test_wildcard() +{ + test("a", "b", false); + test("b", "b", true); + test("abc", "def", false); + test("def", "def", true); + test("def", "d?f", true); + test("def", "d?d", false); + test("def", "??d", false); + test("def", "d??", true); + test("abcdef", "a*e", false); + test("abcdef", "a*f", true); + test("abcdef", "a?c*f", true); + test("abcdef", "a?b*f", false); + test("abcdef", "a*b*f", true); + test("abcdef", "abc*", true); + test("abcdef", "*def", true); +} int main(int argc, char **argv) { + test_wildcard(); juniper::TestEnv te(argc, argv, TEST_PATH("../rpclient/testclient.rc").c_str()); MatchObjectTest test; test.SetStream(&std::cout); diff --git a/juniper/src/vespa/juniper/matchobject.cpp b/juniper/src/vespa/juniper/matchobject.cpp index d6657250f80..376f970d73b 100644 --- a/juniper/src/vespa/juniper/matchobject.cpp +++ b/juniper/src/vespa/juniper/matchobject.cpp @@ -5,7 +5,7 @@ #include "juniperdebug.h" #include "result.h" #include "charutil.h" -#include <vespa/fastlib/util/wildcard_match.h> +#include "wildcard_match.h" #include <stack> #include <vespa/log/log.h> LOG_SETUP(".juniper.matchobject"); diff --git a/fastlib/src/vespa/fastlib/util/wildcard_match.h b/juniper/src/vespa/juniper/wildcard_match.h index 2cde4364693..2cde4364693 100644 --- a/fastlib/src/vespa/fastlib/util/wildcard_match.h +++ b/juniper/src/vespa/juniper/wildcard_match.h |