diff options
Diffstat (limited to 'test/common')
-rw-r--r-- | test/common/memoryreadstream.h | 16 |
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()); + } }; |