aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohannes Schickel2012-03-11 01:19:49 +0100
committerJohannes Schickel2012-03-11 01:22:39 +0100
commit22c5dadb41b03657c39685f52f547a25ef17ded6 (patch)
tree79193348259ecde4767405556cb3adb8bb154801 /test
parentd7ba69ca274b59365d06ad162670bddd2a3faae6 (diff)
downloadscummvm-rg350-22c5dadb41b03657c39685f52f547a25ef17ded6.tar.gz
scummvm-rg350-22c5dadb41b03657c39685f52f547a25ef17ded6.tar.bz2
scummvm-rg350-22c5dadb41b03657c39685f52f547a25ef17ded6.zip
TEST: Add a test case for MemoryReadStream::eos handling.
Diffstat (limited to 'test')
-rw-r--r--test/common/memoryreadstream.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/common/memoryreadstream.h b/test/common/memoryreadstream.h
index a476f12a2f..adef861a5e 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());
+ }
};