Kaydet (Commit) 56321c27 authored tarafından Caolán McNamara's avatar Caolán McNamara

add a test for a nasty suspicion I have

üst 5958f74e
...@@ -68,7 +68,7 @@ namespace ...@@ -68,7 +68,7 @@ namespace
aMemStream.Seek(STREAM_SEEK_TO_END); aMemStream.Seek(STREAM_SEEK_TO_END);
//seeking to end doesn't set eof, reading past eof does //seeking to end doesn't set eof, reading past eof does
CPPUNIT_ASSERT(!aMemStream.IsEof()); CPPUNIT_ASSERT(!aMemStream.eof());
CPPUNIT_ASSERT(aMemStream.good()); CPPUNIT_ASSERT(aMemStream.good());
std_a = 78; std_a = 78;
...@@ -86,7 +86,7 @@ namespace ...@@ -86,7 +86,7 @@ namespace
tools_a = 78; tools_a = 78;
aMemStream >> tools_a; aMemStream >> tools_a;
//so, now eof is set //so, now eof is set
CPPUNIT_ASSERT(aMemStream.IsEof()); CPPUNIT_ASSERT(aMemStream.eof());
//a failed read doesn't change the data, it remains unchanged //a failed read doesn't change the data, it remains unchanged
CPPUNIT_ASSERT(tools_a == 78); CPPUNIT_ASSERT(tools_a == 78);
//nothing wrong with the stream, so not bad //nothing wrong with the stream, so not bad
...@@ -94,6 +94,15 @@ namespace ...@@ -94,6 +94,15 @@ namespace
//yet, the read didn't succeed //yet, the read didn't succeed
CPPUNIT_ASSERT(!aMemStream.good()); CPPUNIT_ASSERT(!aMemStream.good());
sal_uInt16 tools_b = 0x1122;
aMemStream.SeekRel(-1);
CPPUNIT_ASSERT(!aMemStream.eof());
CPPUNIT_ASSERT(aMemStream.good());
aMemStream >> tools_b;
CPPUNIT_ASSERT(!aMemStream.good());
CPPUNIT_ASSERT(aMemStream.eof());
// CPPUNIT_ASSERT(tools_b == 0x1122); //nasty, real nasty
iss.clear(); iss.clear();
iss.seekg(0); iss.seekg(0);
CPPUNIT_ASSERT(iss.good()); CPPUNIT_ASSERT(iss.good());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment