Kate
katewildcardmatcher_test.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "../katewildcardmatcher.h"
00020 #include <QtGlobal>
00021 #include <QtDebug>
00022
00023
00024
00025 bool testCase(const char * candidate, const char * wildcard) {
00026 qDebug("\"%s\" / \"%s\"", candidate, wildcard);
00027 return KateWildcardMatcher::exactMatch(QString(candidate), QString(wildcard));
00028 }
00029
00030
00031
00032 int main() {
00033 Q_ASSERT(testCase("abc.txt", "*.txt"));
00034 Q_ASSERT(!testCase("abc.txt", "*.cpp"));
00035
00036 Q_ASSERT(testCase("Makefile.am", "*Makefile*"));
00037
00038 Q_ASSERT(testCase("control", "control"));
00039
00040 Q_ASSERT(testCase("abcd", "a??d"));
00041
00042 Q_ASSERT(testCase("a", "?"));
00043 Q_ASSERT(testCase("a", "*?*"));
00044 Q_ASSERT(testCase("a", "*"));
00045 Q_ASSERT(testCase("a", "**"));
00046 Q_ASSERT(testCase("a", "***"));
00047
00048 Q_ASSERT(testCase("", "*"));
00049 Q_ASSERT(testCase("", "**"));
00050 Q_ASSERT(!testCase("", "?"));
00051
00052 Q_ASSERT(testCase("ab", "a*"));
00053 Q_ASSERT(testCase("ab", "*b"));
00054 Q_ASSERT(testCase("ab", "a?"));
00055 Q_ASSERT(testCase("ab", "?b"));
00056
00057 Q_ASSERT(testCase("aXXbXXbYYaYc", "a*b*c"));
00058
00059
00060 qDebug() << endl << "DONE";
00061 return 0;
00062 }
00063