mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-20 19:21:46 +00:00
TEST: Add a test case for MemoryReadStream::eos handling.
This commit is contained in:
parent
d7ba69ca27
commit
22c5dadb41
@ -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());
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user