diff options
author | Stephen Kennedy | 2008-07-30 14:40:54 +0000 |
---|---|---|
committer | Stephen Kennedy | 2008-07-30 14:40:54 +0000 |
commit | a4ac44875e6bdb9fd0a5f5e69d6fc8cff0bd461c (patch) | |
tree | 29a0a9e87a6e195529f2b0c3dc3dc3f3434e5eb4 /test/common/bufferedreadstream.h | |
parent | e2a2a672f591f36fb596bb6cb849978c70611c3e (diff) | |
parent | 81cb4931582f5839cca2958a634525ffb81a1714 (diff) | |
download | scummvm-rg350-a4ac44875e6bdb9fd0a5f5e69d6fc8cff0bd461c.tar.gz scummvm-rg350-a4ac44875e6bdb9fd0a5f5e69d6fc8cff0bd461c.tar.bz2 scummvm-rg350-a4ac44875e6bdb9fd0a5f5e69d6fc8cff0bd461c.zip |
Merged revisions 33188-33189,33191-33193,33196,33198,33202-33203,33206,33210,33212,33218-33220,33222,33224-33226,33229-33243,33246,33248-33250,33252,33258-33261,33263,33266,33270,33272-33283,33285,33287-33290,33295-33298,33321,33325-33330,33332-33335,33337-33340,33342,33345,33347,33349-33350,33352-33357,33359-33367,33369-33371,33373,33375-33377,33379-33380,33383-33385,33387-33389,33392-33394,33400-33402,33404-33405,33407-33410,33412-33416,33418-33419,33425-33427,33432,33436-33438,33444,33446 via svnmerge from
https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk
svn-id: r33450
Diffstat (limited to 'test/common/bufferedreadstream.h')
-rw-r--r-- | test/common/bufferedreadstream.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/common/bufferedreadstream.h b/test/common/bufferedreadstream.h new file mode 100644 index 0000000000..7733949d9a --- /dev/null +++ b/test/common/bufferedreadstream.h @@ -0,0 +1,27 @@ +#include <cxxtest/TestSuite.h> + +#include "common/stream.h" + +class BufferedReadStreamTestSuite : public CxxTest::TestSuite { + public: + void test_traverse(void) { + byte contents[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; + Common::MemoryReadStream ms(contents, 10); + + // Use a buffer size of 4 -- note that 10 % 4 != 0, + // so we test what happens if the cache can't be completly + // refilled. + Common::BufferedReadStream srs(&ms, 4); + + int i; + byte b; + for (i = 0; i < 10; ++i) { + TS_ASSERT( !srs.eos() ); + + b = srs.readByte(); + TS_ASSERT_EQUALS( i, b ); + } + + TS_ASSERT( srs.eos() ); + } +}; |