aboutsummaryrefslogtreecommitdiff
path: root/test/common
diff options
context:
space:
mode:
authorMax Horn2011-05-23 18:32:42 +0200
committerMax Horn2011-05-23 19:12:25 +0200
commit8e3aafd30d14bcd586cc06a525e2dc2a8298c7b2 (patch)
tree63038cba9ad4d0dd72a65749ee7ac7410ac76edc /test/common
parent3931e1dc50ad773aa3f9d95b2810857a3e7ce943 (diff)
downloadscummvm-rg350-8e3aafd30d14bcd586cc06a525e2dc2a8298c7b2.tar.gz
scummvm-rg350-8e3aafd30d14bcd586cc06a525e2dc2a8298c7b2.tar.bz2
scummvm-rg350-8e3aafd30d14bcd586cc06a525e2dc2a8298c7b2.zip
COMMON: Provide our own implementations for scumm_str(n)icmp
This takes up a tiny little bit of extra binary size, but gets rid of some awful #ifdef hackery.
Diffstat (limited to 'test/common')
-rw-r--r--test/common/str.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/common/str.h b/test/common/str.h
index 5d9fe29af9..0dee16a493 100644
--- a/test/common/str.h
+++ b/test/common/str.h
@@ -378,4 +378,21 @@ class StringTestSuite : public CxxTest::TestSuite
TS_ASSERT_EQUALS(Common::strlcat(test4, appendString, 11), strlen(resultString));
TS_ASSERT_EQUALS(strcmp(test4, resultString), 0);
}
+
+ void test_scumm_stricmp() {
+ TS_ASSERT_EQUALS(scumm_stricmp("abCd", "abCd"), 0);
+ TS_ASSERT_EQUALS(scumm_stricmp("abCd", "ABCd"), 0);
+ TS_ASSERT_LESS_THAN(scumm_stricmp("abCd", "ABCe"), 0);
+ TS_ASSERT_LESS_THAN(scumm_stricmp("abCd", "ABCde"), 0);
+ }
+
+ void test_scumm_strnicmp() {
+ TS_ASSERT_EQUALS(scumm_strnicmp("abCd", "abCd", 3), 0);
+ TS_ASSERT_EQUALS(scumm_strnicmp("abCd", "ABCd", 4), 0);
+ TS_ASSERT_EQUALS(scumm_strnicmp("abCd", "ABCd", 5), 0);
+ TS_ASSERT_EQUALS(scumm_strnicmp("abCd", "ABCe", 3), 0);
+ TS_ASSERT_LESS_THAN(scumm_strnicmp("abCd", "ABCe", 4), 0);
+ TS_ASSERT_EQUALS(scumm_strnicmp("abCd", "ABCde", 4), 0);
+ TS_ASSERT_LESS_THAN(scumm_strnicmp("abCd", "ABCde", 5), 0);
+ }
};