aboutsummaryrefslogtreecommitdiff
path: root/test/common
diff options
context:
space:
mode:
authorMax Horn2008-09-05 20:29:03 +0000
committerMax Horn2008-09-05 20:29:03 +0000
commit0dcb30e75c79900d90874eb098fbec67ef0c703b (patch)
tree1b8f75d715be40c87c0756a54979795a97da1f6c /test/common
parente5c8ebf995a8500d5c99cc238f911eac43e8073d (diff)
downloadscummvm-rg350-0dcb30e75c79900d90874eb098fbec67ef0c703b.tar.gz
scummvm-rg350-0dcb30e75c79900d90874eb098fbec67ef0c703b.tar.bz2
scummvm-rg350-0dcb30e75c79900d90874eb098fbec67ef0c703b.zip
Optimized matchString for the common case where there is a trailing * (if that is the case, abort immediately instead of scanning the rest of the string)
svn-id: r34367
Diffstat (limited to 'test/common')
-rw-r--r--test/common/str.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/common/str.h b/test/common/str.h
index 921c4614f5..a94ec3227f 100644
--- a/test/common/str.h
+++ b/test/common/str.h
@@ -191,6 +191,14 @@ class StringTestSuite : public CxxTest::TestSuite
}
void test_matchString(void) {
+ TS_ASSERT( Common::matchString("", "*"));
+ TS_ASSERT( Common::matchString("a", "*"));
+ TS_ASSERT( Common::matchString("monkey.s01", "*"));
+
+ TS_ASSERT(!Common::matchString("", "?"));
+ TS_ASSERT( Common::matchString("a", "?"));
+ TS_ASSERT(!Common::matchString("monkey.s01", "?"));
+
TS_ASSERT( Common::matchString("monkey.s01", "monkey.s??"));
TS_ASSERT( Common::matchString("monkey.s99", "monkey.s??"));
TS_ASSERT(!Common::matchString("monkey.s101", "monkey.s??"));