diff --git a/tests/streams/bstream.h b/tests/streams/bstream.h index b1fe8aa326..51a27966c6 100644 --- a/tests/streams/bstream.h +++ b/tests/streams/bstream.h @@ -81,11 +81,18 @@ protected: CPPUNIT_ASSERT(!stream_in.Eof()); // Size should be greater than zero. - // Note: streams not supporting this should register this test - // with CPPUNIT_TEST_FAIL instead of CPPUNIT_TEST. CPPUNIT_ASSERT(stream_in.GetSize() != 0); } + // The variant for non-seekable streams. + void Input_GetSizeFail() + { + CleanupHelper cleanup(this); + const TStreamIn &stream_in = CreateInStream(); + + CPPUNIT_ASSERT(stream_in.GetSize() == 0); + } + // Just try to perform a GetC() on the input stream. void Input_GetC() { @@ -199,8 +206,6 @@ protected: CPPUNIT_ASSERT(!stream_in.Eof()); // Try to Seek in the stream... - // Note: streams not supporting this should register this test - // with CPPUNIT_TEST_FAIL instead of CPPUNIT_TEST. CPPUNIT_ASSERT_EQUAL(2, stream_in.SeekI(2, wxFromStart)); CPPUNIT_ASSERT_EQUAL(4, stream_in.SeekI(2, wxFromCurrent)); // Not sure the following line is correct, so test it differently. @@ -210,6 +215,14 @@ protected: CPPUNIT_ASSERT((stream_in.SeekI(10, wxFromCurrent) == wxInvalidOffset) == m_bSeekInvalidBeyondEnd); } + void Input_SeekIFail() + { + CleanupHelper cleanup(this); + TStreamIn &stream_in = CreateInStream(); + + CPPUNIT_ASSERT( !stream_in.IsSeekable() ); + } + // Just try to perform a TellI() on the input stream. void Input_TellI() { @@ -340,8 +353,6 @@ protected: (void)stream_out.Write(buf, 10); // Try to Seek in the stream... - // Note: streams not supporting this should register this test - // with CPPUNIT_TEST_FAIL instead of CPPUNIT_TEST. CPPUNIT_ASSERT_EQUAL(2, stream_out.SeekO(2, wxFromStart)); CPPUNIT_ASSERT_EQUAL(4, stream_out.SeekO(2, wxFromCurrent)); // Not sure the following line is correct, so test it differently. @@ -351,6 +362,14 @@ protected: CPPUNIT_ASSERT((stream_out.SeekO(10, wxFromCurrent) == wxInvalidOffset) == m_bSeekInvalidBeyondEnd); } + void Output_SeekOFail() + { + CleanupHelper cleanup(this); + TStreamOut &stream_out = CreateOutStream(); + + CPPUNIT_ASSERT( !stream_out.IsSeekable() ); + } + // Just try to perform a TellO() on the output stream. void Output_TellO() { diff --git a/tests/streams/zlibstream.cpp b/tests/streams/zlibstream.cpp index d11f1809d3..bc0275afa2 100644 --- a/tests/streams/zlibstream.cpp +++ b/tests/streams/zlibstream.cpp @@ -46,13 +46,13 @@ public: CPPUNIT_TEST_SUITE(zlibStream); // Base class stream tests the zlibstream supports. - CPPUNIT_TEST_FAIL(Input_GetSize); + CPPUNIT_TEST(Input_GetSizeFail); CPPUNIT_TEST(Input_GetC); CPPUNIT_TEST(Input_Read); CPPUNIT_TEST(Input_Eof); CPPUNIT_TEST(Input_LastRead); CPPUNIT_TEST(Input_CanRead); - CPPUNIT_TEST_FAIL(Input_SeekI); + CPPUNIT_TEST(Input_SeekIFail); CPPUNIT_TEST(Input_TellI); CPPUNIT_TEST(Input_Peek); CPPUNIT_TEST(Input_Ungetch); @@ -60,7 +60,7 @@ public: CPPUNIT_TEST(Output_PutC); CPPUNIT_TEST(Output_Write); CPPUNIT_TEST(Output_LastWrite); - CPPUNIT_TEST_FAIL(Output_SeekO); + CPPUNIT_TEST(Output_SeekOFail); CPPUNIT_TEST(Output_TellO); // Other test specific for zlib stream test case.