aboutsummaryrefslogtreecommitdiff
path: root/test/common/bufferedreadstream.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/common/bufferedreadstream.h')
-rw-r--r--test/common/bufferedreadstream.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/common/bufferedreadstream.h b/test/common/bufferedreadstream.h
index 0b2cda696c..c10fbf4b1d 100644
--- a/test/common/bufferedreadstream.h
+++ b/test/common/bufferedreadstream.h
@@ -1,6 +1,7 @@
#include <cxxtest/TestSuite.h>
-#include "common/stream.h"
+#include "common/memstream.h"
+#include "common/bufferedstream.h"
class BufferedReadStreamTestSuite : public CxxTest::TestSuite {
public:
@@ -11,7 +12,7 @@ class BufferedReadStreamTestSuite : public CxxTest::TestSuite {
// Use a buffer size of 4 -- note that 10 % 4 != 0,
// so we test what happens if the cache can't be completely
// refilled.
- Common::BufferedReadStream srs(&ms, 4);
+ Common::ReadStream &srs = *Common::wrapBufferedReadStream(&ms, 4, DisposeAfterUse::NO);
byte i, b;
for (i = 0; i < 10; ++i) {
@@ -26,13 +27,15 @@ class BufferedReadStreamTestSuite : public CxxTest::TestSuite {
b = srs.readByte();
TS_ASSERT(srs.eos());
+
+ delete &srs;
}
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);
+ Common::ReadStream &brs = *Common::wrapBufferedReadStream(&ms, 4, DisposeAfterUse::NO);
// Traverse the stream with reads of 2 bytes. The size is not
// a multiple of 2, so we can test the final partial read.
@@ -51,5 +54,7 @@ class BufferedReadStreamTestSuite : public CxxTest::TestSuite {
TS_ASSERT_EQUALS(n, 1);
TS_ASSERT(brs.eos());
+
+ delete &brs;
}
};