[Scummvm-cvs-logs] CVS: scummvm/test/common str.h,1.1,1.2

Max Horn fingolfin at users.sourceforge.net
Sun Feb 6 11:03:16 CET 2005


Update of /cvsroot/scummvm/scummvm/test/common
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15646

Modified Files:
	str.h 
Log Message:
Add testcases for String::hasSuffix and hasPrefix

Index: str.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/test/common/str.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- str.h	24 Dec 2003 16:16:00 -0000	1.1
+++ str.h	6 Feb 2005 19:01:23 -0000	1.2
@@ -47,6 +47,24 @@
 		TS_ASSERT_EQUALS( str, "fooX" );
 	}
 
+	void test_hasPrefix( void )
+	{
+		Common::String str("this/is/a/test, haha");
+		TS_ASSERT_EQUALS( str.hasPrefix(""), true );
+		TS_ASSERT_EQUALS( str.hasPrefix("this"), true );
+		TS_ASSERT_EQUALS( str.hasPrefix("thit"), false );
+		TS_ASSERT_EQUALS( str.hasPrefix("foo"), false );
+	}
+
+	void test_hasSuffix( void )
+	{
+		Common::String str("this/is/a/test, haha");
+		TS_ASSERT_EQUALS( str.hasSuffix(""), true );
+		TS_ASSERT_EQUALS( str.hasSuffix("haha"), true );
+		TS_ASSERT_EQUALS( str.hasSuffix("hahb"), false );
+		TS_ASSERT_EQUALS( str.hasSuffix("hahah"), false );
+	}
+
 	void test_toLowercase( void )
 	{
 		Common::String str("Test it, NOW! 42");





More information about the Scummvm-git-logs mailing list