[Scummvm-cvs-logs] scummvm master -> a5f4ff36ffc386d48f2da49387a9655ce9295a4d
lordhoto
lordhoto at gmail.com
Sun Mar 11 01:24:59 CET 2012
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
22c5dadb41 TEST: Add a test case for MemoryReadStream::eos handling.
a5f4ff36ff TEST: Add a test case for SafeSeekableSubReadStream::eos handling.
Commit: 22c5dadb41b03657c39685f52f547a25ef17ded6
https://github.com/scummvm/scummvm/commit/22c5dadb41b03657c39685f52f547a25ef17ded6
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-03-10T16:22:39-08:00
Commit Message:
TEST: Add a test case for MemoryReadStream::eos handling.
Changed paths:
test/common/memoryreadstream.h
diff --git a/test/common/memoryreadstream.h b/test/common/memoryreadstream.h
index a476f12..adef861 100644
--- a/test/common/memoryreadstream.h
+++ b/test/common/memoryreadstream.h
@@ -84,4 +84,20 @@ class MemoryReadStreamTestSuite : public CxxTest::TestSuite {
TS_ASSERT_EQUALS(ms.pos(), 7);
TS_ASSERT(!ms.eos());
}
+
+ void test_eos() {
+ byte contents[] = { 1, 2, 3, 4, 5, 6, 7 };
+ Common::MemoryReadStream ms(contents, sizeof(contents));
+
+ // Read after the end of the stream
+ for (int32 i = 0; i <= ms.size(); ++i)
+ ms.readByte();
+
+ // The eos flag should be set here
+ TS_ASSERT(ms.eos());
+
+ // Seeking should reset the eos flag
+ ms.seek(0, SEEK_SET);
+ TS_ASSERT(!ms.eos());
+ }
};
Commit: a5f4ff36ffc386d48f2da49387a9655ce9295a4d
https://github.com/scummvm/scummvm/commit/a5f4ff36ffc386d48f2da49387a9655ce9295a4d
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2012-03-10T16:23:57-08:00
Commit Message:
TEST: Add a test case for SafeSeekableSubReadStream::eos handling.
Changed paths:
test/common/subreadstream.h
diff --git a/test/common/subreadstream.h b/test/common/subreadstream.h
index 463f49e..32e6f93 100644
--- a/test/common/subreadstream.h
+++ b/test/common/subreadstream.h
@@ -26,4 +26,22 @@ class SubReadStreamTestSuite : public CxxTest::TestSuite {
b = srs.readByte();
TS_ASSERT(srs.eos());
}
+
+ void test_safe_eos() {
+ byte contents[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+ Common::MemoryReadStream ms(contents, sizeof(contents));
+
+ Common::SafeSeekableSubReadStream ssrs1(&ms, 0, sizeof(contents));
+ Common::SafeSeekableSubReadStream ssrs2(&ms, 0, sizeof(contents));
+
+ // Read after the end of the stream of the first sub stream
+ for (int32 i = 0; i <= ssrs1.size(); ++i)
+ ssrs1.readByte();
+
+ // eos should be set for the first sub stream
+ TS_ASSERT(ssrs1.eos());
+
+ // eos should not be set for the second sub stream
+ TS_ASSERT(!ssrs2.eos());
+ }
};
More information about the Scummvm-git-logs
mailing list