aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2009-12-27 11:12:26 +0000
committerJohannes Schickel2009-12-27 11:12:26 +0000
commit3c99391b49d1b4ee40d2f74f94b290f9cdcefb49 (patch)
tree21ad5bc1989ad5c5d987d8bc4b9bc16e98567698
parent11a835b6ce3a0bfe4b985c94361247f8916ea7e6 (diff)
downloadscummvm-rg350-3c99391b49d1b4ee40d2f74f94b290f9cdcefb49.tar.gz
scummvm-rg350-3c99391b49d1b4ee40d2f74f94b290f9cdcefb49.tar.bz2
scummvm-rg350-3c99391b49d1b4ee40d2f74f94b290f9cdcefb49.zip
Add some tests for checkSort just in case... :-)
svn-id: r46622
-rw-r--r--test/common/algorithm.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/common/algorithm.h b/test/common/algorithm.h
index bc10841fae..bb2932178d 100644
--- a/test/common/algorithm.h
+++ b/test/common/algorithm.h
@@ -34,6 +34,17 @@ class AlgorithmTestSuite : public CxxTest::TestSuite {
}
};
public:
+ void test_check_sort() {
+ const int arraySorted[] = { 1, 2, 3, 3, 4, 5 };
+ const int arrayUnsorted[] = { 5, 3, 1, 2, 4, 3 };
+
+ TS_ASSERT_EQUALS(checkSort(arraySorted, arraySorted + ARRAYSIZE(arraySorted), Common::Less<int>()), true);
+ TS_ASSERT_EQUALS(checkSort(arraySorted, arraySorted + ARRAYSIZE(arraySorted), Common::Greater<int>()), false);
+
+ TS_ASSERT_EQUALS(checkSort(arrayUnsorted, arrayUnsorted + ARRAYSIZE(arrayUnsorted), Common::Less<int>()), false);
+ TS_ASSERT_EQUALS(checkSort(arrayUnsorted, arrayUnsorted + ARRAYSIZE(arrayUnsorted), Common::Greater<int>()), false);
+ }
+
void test_pod_sort() {
{
int array[] = { 63, 11, 31, 72, 1, 48, 32, 69, 38, 31 };