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

wjpalenstijn at users.sourceforge.net wjpalenstijn at users.sourceforge.net
Wed Aug 25 13:46:51 CEST 2010


Revision: 52382
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52382&view=rev
Author:   wjpalenstijn
Date:     2010-08-25 11:46:50 +0000 (Wed, 25 Aug 2010)

Log Message:
-----------
COMMON: Add test for BufferedReadStream's eos

This test is currently failing.

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

Modified: scummvm/trunk/test/common/bufferedreadstream.h
===================================================================
--- scummvm/trunk/test/common/bufferedreadstream.h	2010-08-25 11:28:27 UTC (rev 52381)
+++ scummvm/trunk/test/common/bufferedreadstream.h	2010-08-25 11:46:50 UTC (rev 52382)
@@ -27,4 +27,29 @@
 
 		TS_ASSERT(srs.eos());
 	}
+
+	void test_traverse2() {
+		byte contents[9] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
+		Common::MemoryReadStream ms(contents, 9);
+
+		Common::BufferedReadStream brs(&ms, 4);
+
+		// Traverse the stream with reads of 2 bytes. The size is not
+		// a multiple of 2, so we can test the final partial read.
+
+		byte i, b[2];
+		for (i = 0; i < 4; ++i) {
+			TS_ASSERT(!brs.eos());
+
+			int n = brs.read(b, 2);
+			TS_ASSERT_EQUALS(n, 2);
+		}
+
+		TS_ASSERT(!brs.eos());
+
+		int n = brs.read(b, 2);
+		TS_ASSERT_EQUALS(n, 1);
+
+		TS_ASSERT(brs.eos());
+	}
 };


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