mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 05:38:56 +00:00
2b32ba7cb3
svn-id: r40722
29 lines
518 B
C++
29 lines
518 B
C++
#include <cxxtest/TestSuite.h>
|
|
|
|
#include "common/stream.h"
|
|
|
|
class SubReadStreamTestSuite : public CxxTest::TestSuite {
|
|
public:
|
|
void test_traverse() {
|
|
byte contents[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
|
Common::MemoryReadStream ms(contents, 10);
|
|
|
|
int end = 5;
|
|
|
|
Common::SubReadStream srs(&ms, end);
|
|
|
|
int i;
|
|
byte b;
|
|
for (i = 0; i < end; ++i) {
|
|
TS_ASSERT(!srs.eos());
|
|
|
|
b = srs.readByte();
|
|
TS_ASSERT_EQUALS(i, b);
|
|
}
|
|
|
|
TS_ASSERT(!srs.eos());
|
|
b = srs.readByte();
|
|
TS_ASSERT(srs.eos());
|
|
}
|
|
};
|