summaryrefslogtreecommitdiff
path: root/tools/qa/cppunit
diff options
context:
space:
mode:
Diffstat (limited to 'tools/qa/cppunit')
-rw-r--r--tools/qa/cppunit/test_stream.cxx (renamed from tools/qa/cppunit/test_streamstate.cxx)22
1 files changed, 22 insertions, 0 deletions
diff --git a/tools/qa/cppunit/test_streamstate.cxx b/tools/qa/cppunit/test_stream.cxx
index 182ad6c45561..ae098e5b836d 100644
--- a/tools/qa/cppunit/test_streamstate.cxx
+++ b/tools/qa/cppunit/test_stream.cxx
@@ -41,9 +41,11 @@ namespace
{
public:
void test_stdstream();
+ void test_fastostring();
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(test_stdstream);
+ CPPUNIT_TEST(test_fastostring);
CPPUNIT_TEST_SUITE_END();
};
@@ -120,6 +122,26 @@ namespace
//failbit is rather subtle wrt e.g seeks
}
+ void Test::test_fastostring()
+ {
+ char foo[] = "foobar";
+ SvMemoryStream aMemStream(RTL_CONSTASCII_STRINGPARAM(foo), STREAM_READ);
+
+ rtl::OString aOne = readBytesAsOString(aMemStream, 3);
+ CPPUNIT_ASSERT(aOne.equalsL(RTL_CONSTASCII_STRINGPARAM("foo")));
+
+ rtl::OString aTwo = readBytesAsOString(aMemStream, 3);
+ CPPUNIT_ASSERT(aTwo.equalsL(RTL_CONSTASCII_STRINGPARAM("bar")));
+
+ rtl::OString aThree = readBytesAsOString(aMemStream, 3);
+ CPPUNIT_ASSERT(!aThree.getLength());
+
+ aMemStream.Seek(0);
+
+ rtl::OString aFour = readBytesAsOString(aMemStream, 100);
+ CPPUNIT_ASSERT(aFour.equalsL(RTL_CONSTASCII_STRINGPARAM(foo)));
+ }
+
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
}