diff options
author | Max Horn | 2010-11-23 22:27:00 +0000 |
---|---|---|
committer | Max Horn | 2010-11-23 22:27:00 +0000 |
commit | 5d791cb090a6ead8594b956316f3735382703e8d (patch) | |
tree | 359416760b9894901eaf10fe20376b23a020d3da /test/common/memoryreadstream.h | |
parent | b485d0ee49f305bcb241447988309eac9c38c4c7 (diff) | |
download | scummvm-rg350-5d791cb090a6ead8594b956316f3735382703e8d.tar.gz scummvm-rg350-5d791cb090a6ead8594b956316f3735382703e8d.tar.bz2 scummvm-rg350-5d791cb090a6ead8594b956316f3735382703e8d.zip |
TEST: Add/extend MemoryReadStream(Endian) test cases
svn-id: r54440
Diffstat (limited to 'test/common/memoryreadstream.h')
-rw-r--r-- | test/common/memoryreadstream.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/common/memoryreadstream.h b/test/common/memoryreadstream.h index f7a144d730..a476f12a2f 100644 --- a/test/common/memoryreadstream.h +++ b/test/common/memoryreadstream.h @@ -58,4 +58,30 @@ class MemoryReadStreamTestSuite : public CxxTest::TestSuite { TS_ASSERT_EQUALS(ms.pos(), 0); TS_ASSERT(!ms.eos()); } + + void test_seek_read_le() { + byte contents[] = { 1, 2, 3, 4, 5, 6, 7 }; + Common::MemoryReadStream ms(contents, sizeof(contents)); + + TS_ASSERT_EQUALS(ms.readUint16LE(), 0x0201UL); + TS_ASSERT_EQUALS(ms.pos(), 2); + TS_ASSERT_EQUALS(ms.readUint32LE(), 0x06050403UL); + TS_ASSERT_EQUALS(ms.pos(), 6); + TS_ASSERT_EQUALS(ms.readByte(), 0x07); + TS_ASSERT_EQUALS(ms.pos(), 7); + TS_ASSERT(!ms.eos()); + } + + void test_seek_read_be() { + byte contents[] = { 1, 2, 3, 4, 5, 6, 7 }; + Common::MemoryReadStream ms(contents, sizeof(contents)); + + TS_ASSERT_EQUALS(ms.readUint16BE(), 0x0102UL); + TS_ASSERT_EQUALS(ms.pos(), 2); + TS_ASSERT_EQUALS(ms.readUint32BE(), 0x03040506UL); + TS_ASSERT_EQUALS(ms.pos(), 6); + TS_ASSERT_EQUALS(ms.readByte(), 0x07); + TS_ASSERT_EQUALS(ms.pos(), 7); + TS_ASSERT(!ms.eos()); + } }; |