[Scummvm-cvs-logs] SF.net SVN: scummvm:[49322] scummvm/trunk/test/common/str.h
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Sun May 30 15:10:23 CEST 2010
Revision: 49322
http://scummvm.svn.sourceforge.net/scummvm/?rev=49322&view=rev
Author: lordhoto
Date: 2010-05-30 13:10:23 +0000 (Sun, 30 May 2010)
Log Message:
-----------
Add a (currently) failing test for reference logic in Common::String. (Taken from an example by fuzzie)
Modified Paths:
--------------
scummvm/trunk/test/common/str.h
Modified: scummvm/trunk/test/common/str.h
===================================================================
--- scummvm/trunk/test/common/str.h 2010-05-30 12:44:59 UTC (rev 49321)
+++ scummvm/trunk/test/common/str.h 2010-05-30 13:10:23 UTC (rev 49322)
@@ -118,6 +118,28 @@
TS_ASSERT_EQUALS(foo3, "fooasdkadklasdjklasdjlkasjdlkasjdklasjdlkjasdasd""fooasdkadklasdjklasdjlkasjdlkasjdklasjdlkjasdasd");
}
+ void test_refCount5() {
+ // Test for allocated storage
+ Common::String foo1("HelloHelloHelloHelloAndHi");
+ Common::String foo2(foo1);
+
+ for (Common::String::iterator i = foo2.begin(); i != foo2.end(); ++i)
+ *i = 'h';
+
+ TS_ASSERT_EQUALS(foo1, "HelloHelloHelloHelloAndHi");
+ TS_ASSERT_EQUALS(foo2, "hhhhhhhhhhhhhhhhhhhhhhhhh");
+
+ // Test for builtin storage
+ Common::String foo3("Hello");
+ Common::String foo4(foo3);
+
+ for (Common::String::iterator i = foo4.begin(); i != foo4.end(); ++i)
+ *i = 'h';
+
+ TS_ASSERT_EQUALS(foo3, "Hello");
+ TS_ASSERT_EQUALS(foo4, "hhhhh");
+ }
+
void test_self_asignment() {
Common::String foo1("12345678901234567890123456789012");
foo1 = foo1.c_str() + 2;
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