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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sun May 3 11:00:16 CEST 2009


Revision: 40261
          http://scummvm.svn.sourceforge.net/scummvm/?rev=40261&view=rev
Author:   fingolfin
Date:     2009-05-03 09:00:13 +0000 (Sun, 03 May 2009)

Log Message:
-----------
Added unit test for Common::Array::resize()

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

Modified: scummvm/trunk/test/common/array.h
===================================================================
--- scummvm/trunk/test/common/array.h	2009-05-03 07:33:59 UTC (rev 40260)
+++ scummvm/trunk/test/common/array.h	2009-05-03 09:00:13 UTC (rev 40261)
@@ -184,4 +184,28 @@
 		TS_ASSERT_EQUALS(container.back(),  -17);
 	}
 
+	void test_resize() {
+		Common::Array<int> array;
+
+		array.resize(3);
+		TS_ASSERT_EQUALS( array.size(), (unsigned int)3 );
+
+		array[0] = -3;
+		array[1] = 163;
+		array[2] = 17;
+
+		array.resize(100);
+		TS_ASSERT_EQUALS( array.size(), (unsigned int)100 );
+		TS_ASSERT_EQUALS( array[0], -3 );
+		TS_ASSERT_EQUALS( array[1], 163 );
+		TS_ASSERT_EQUALS( array[2], 17 );
+
+		TS_ASSERT_EQUALS( array[99], 0 );
+
+		array.resize(2);
+		TS_ASSERT_EQUALS( array.size(), (unsigned int)2 );
+		TS_ASSERT_EQUALS( array[0], -3 );
+		TS_ASSERT_EQUALS( array[1], 163 );
+	}
+
 };


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