mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-24 05:01:43 +00:00
COMMON: Add test for BufferedReadStream's eos
This test is currently failing. svn-id: r52382
This commit is contained in:
parent
3900aa96b6
commit
8cd0cfe5eb
@ -27,4 +27,29 @@ class BufferedReadStreamTestSuite : public CxxTest::TestSuite {
|
||||
|
||||
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());
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user