[Scummvm-cvs-logs] SF.net SVN: scummvm:[46622] scummvm/trunk/test/common/algorithm.h

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sun Dec 27 12:12:27 CET 2009


Revision: 46622
          http://scummvm.svn.sourceforge.net/scummvm/?rev=46622&view=rev
Author:   lordhoto
Date:     2009-12-27 11:12:26 +0000 (Sun, 27 Dec 2009)

Log Message:
-----------
Add some tests for checkSort just in case... :-)

Modified Paths:
--------------
    scummvm/trunk/test/common/algorithm.h

Modified: scummvm/trunk/test/common/algorithm.h
===================================================================
--- scummvm/trunk/test/common/algorithm.h	2009-12-27 11:12:05 UTC (rev 46621)
+++ scummvm/trunk/test/common/algorithm.h	2009-12-27 11:12:26 UTC (rev 46622)
@@ -34,6 +34,17 @@
 		}
 	};
 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 };


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list