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

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Mar 28 07:17:02 CEST 2006


Revision: 21481
Author:   fingolfin
Date:     2006-03-28 07:16:04 -0800 (Tue, 28 Mar 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=21481&view=rev

Log Message:
-----------
Adapted unit tests to current situation

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

Added Paths:
-----------
    scummvm/trunk/test/common/hashmap.h
Added: scummvm/trunk/test/common/hashmap.h
===================================================================
--- scummvm/trunk/test/common/hashmap.h	                        (rev 0)
+++ scummvm/trunk/test/common/hashmap.h	2006-03-28 15:16:04 UTC (rev 21481)
@@ -0,0 +1,43 @@
+#include <cxxtest/TestSuite.h>
+
+#include "common/stdafx.h"
+#include "common/hashmap.h"
+
+class HashMapTestSuite : public CxxTest::TestSuite
+{
+	public:
+	void test_empty_clear( void )
+	{
+		Common::HashMap<int, int> map;
+		TS_ASSERT( map.empty() );
+		map[0] = 17;
+		map[1] = 33;
+		TS_ASSERT( !map.empty() );
+		map.clear();
+		TS_ASSERT( map.empty() );
+	}
+	void test_contains( void )
+	{
+		Common::HashMap<int, int> map;
+		map[0] = 17;
+		map[1] = 33;
+		TS_ASSERT( map.contains(0) );
+		TS_ASSERT( map.contains(1) );
+		TS_ASSERT( !map.contains(17) );
+		TS_ASSERT( !map.contains(-1) );
+	}
+
+	void test_add_remove( void )
+	{
+		Common::HashMap<int, int> map;
+		map[0] = 17;
+		map[1] = 33;
+		TS_ASSERT( map.contains(1) );
+		map.erase(1);
+		TS_ASSERT( !map.contains(1) );
+		map[1] = 42;
+		TS_ASSERT( map.contains(1) );
+	}
+
+	// TODO: Add test cases for iterators, find, ...
+};


Property changes on: scummvm/trunk/test/common/hashmap.h
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + "Date Rev Author URL Id"
Name: svn:eol-style
   + native

Modified: scummvm/trunk/test/common/map.h
===================================================================
--- scummvm/trunk/test/common/map.h	2006-03-28 15:15:45 UTC (rev 21480)
+++ scummvm/trunk/test/common/map.h	2006-03-28 15:16:04 UTC (rev 21481)
@@ -33,9 +33,9 @@
 		map[0] = 17;
 		map[1] = 33;
 		TS_ASSERT( map.contains(1) );
-		map.remove(1);
+		map.erase(1);
 		TS_ASSERT( !map.contains(1) );
-		map.addKey(1);
+		map[1] = 42;
 		TS_ASSERT( map.contains(1) );
 	}
 
@@ -61,4 +61,6 @@
 		TS_ASSERT_EQUALS( mapA[3], 12 );
 		TS_ASSERT_EQUALS( mapA[4], 96 );
 	}
+
+	// TODO: Add test cases for iterators, find, ...
 };


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