aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatthew Hoops2011-05-31 14:16:29 -0400
committerMatthew Hoops2011-05-31 14:16:29 -0400
commitaa49b38c5a8032586cb94fc4ca07149eecabe64a (patch)
treeea5c7617f8c482c8cf4141b728b3ccff5a7f84c7 /test
parentd3ea9ab2a9334747eb445c1b45aa30cb17ffdf1b (diff)
parentc86a6c466fabe31fbf36363aa8d0ac8ea6001b9f (diff)
downloadscummvm-rg350-aa49b38c5a8032586cb94fc4ca07149eecabe64a.tar.gz
scummvm-rg350-aa49b38c5a8032586cb94fc4ca07149eecabe64a.tar.bz2
scummvm-rg350-aa49b38c5a8032586cb94fc4ca07149eecabe64a.zip
Merge remote branch 'upstream/master' into t7g-ios
Conflicts: engines/groovie/script.cpp
Diffstat (limited to 'test')
-rw-r--r--test/common/array.h28
-rw-r--r--test/common/str.h17
-rw-r--r--test/module.mk2
3 files changed, 46 insertions, 1 deletions
diff --git a/test/common/array.h b/test/common/array.h
index f17edd3984..c10270436f 100644
--- a/test/common/array.h
+++ b/test/common/array.h
@@ -107,6 +107,34 @@ class ArrayTestSuite : public CxxTest::TestSuite
}
+ void test_self_insert() {
+ Common::Array<int> array;
+ int i;
+
+ // Insert some data -- and make sure we have enough space for
+ // *twice* as much data. This way, there is no need to allocate
+ // new storage, so if the insert() operation is "clever", it
+ // will try to reuse the existing storage.
+ // This in turn may uncover bugs if the insertion code does not
+ // expect self-insertions.
+ array.reserve(128);
+ for (i = 0; i < 64; ++i)
+ array.push_back(i);
+
+ // Now insert the array into the middle of itself
+ array.insert_at(12, array);
+
+ // Verify integrity
+ TS_ASSERT_EQUALS(array.size(), 128UL);
+
+ for (i = 0; i < 12; ++i)
+ TS_ASSERT_EQUALS(array[i], i);
+ for (i = 0; i < 64; ++i)
+ TS_ASSERT_EQUALS(array[i+12], i);
+ for (i = 12; i < 64; ++i)
+ TS_ASSERT_EQUALS(array[i+64], i);
+ }
+
void test_remove_at() {
Common::Array<int> array;
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);
+ }
};
diff --git a/test/module.mk b/test/module.mk
index 3542ae2903..4e5cbf62e1 100644
--- a/test/module.mk
+++ b/test/module.mk
@@ -9,7 +9,7 @@ TESTS := $(srcdir)/test/common/*.h $(srcdir)/test/audio/*.h
TEST_LIBS := audio/libaudio.a common/libcommon.a
#
-TEST_FLAGS := --runner=StdioPrinter
+TEST_FLAGS := --runner=StdioPrinter --no-std --no-eh
TEST_CFLAGS := -I$(srcdir)/test/cxxtest
TEST_LDFLAGS := $(LIBS)
TEST_CXXFLAGS := $(filter-out -Wglobal-constructors,$(CXXFLAGS))