aboutsummaryrefslogtreecommitdiff
path: root/test/common/str.h
diff options
context:
space:
mode:
authorMax Horn2008-09-05 20:07:34 +0000
committerMax Horn2008-09-05 20:07:34 +0000
commit9bf7aa308e4a5cc46e27a8ca9421cc42815c2833 (patch)
treecb24d01e833314b7a4c3431b81cbdfdf228f1f32 /test/common/str.h
parent5388ecf722f3ac32686debc5a3a4fb7bf4e9f0a1 (diff)
downloadscummvm-rg350-9bf7aa308e4a5cc46e27a8ca9421cc42815c2833.tar.gz
scummvm-rg350-9bf7aa308e4a5cc46e27a8ca9421cc42815c2833.tar.bz2
scummvm-rg350-9bf7aa308e4a5cc46e27a8ca9421cc42815c2833.zip
Moved matchString from util.* to str.*; added new String::matchString method; fixed matchString doxygen comment (it confused pattern & string); added unit tests for matchString
svn-id: r34364
Diffstat (limited to 'test/common/str.h')
-rw-r--r--test/common/str.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/common/str.h b/test/common/str.h
index c4819520d8..921c4614f5 100644
--- a/test/common/str.h
+++ b/test/common/str.h
@@ -189,4 +189,22 @@ class StringTestSuite : public CxxTest::TestSuite
TS_ASSERT(Common::normalizePath("foo//./bar//", '/') == "foo/bar");
TS_ASSERT(Common::normalizePath("foo//.bar//", '/') == "foo/.bar");
}
+
+ void test_matchString(void) {
+ TS_ASSERT( Common::matchString("monkey.s01", "monkey.s??"));
+ TS_ASSERT( Common::matchString("monkey.s99", "monkey.s??"));
+ TS_ASSERT(!Common::matchString("monkey.s101", "monkey.s??"));
+
+ TS_ASSERT( Common::matchString("monkey.s01", "monkey.s?1"));
+ TS_ASSERT(!Common::matchString("monkey.s99", "monkey.s?1"));
+ TS_ASSERT(!Common::matchString("monkey.s101", "monkey.s?1"));
+
+ TS_ASSERT( Common::matchString("monkey.s01", "monkey.s*"));
+ TS_ASSERT( Common::matchString("monkey.s99", "monkey.s*"));
+ TS_ASSERT( Common::matchString("monkey.s101", "monkey.s*"));
+
+ TS_ASSERT( Common::matchString("monkey.s01", "monkey.s*1"));
+ TS_ASSERT(!Common::matchString("monkey.s99", "monkey.s*1"));
+ TS_ASSERT( Common::matchString("monkey.s101", "monkey.s*1"));
+ }
};