X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e6477b92b7d51a6ec7a26cf7bae1e8c7637995e4..d02d8b4c273719771761425453bc6c4a438b364d:/tests/archive/archivetest.h?ds=sidebyside diff --git a/tests/archive/archivetest.h b/tests/archive/archivetest.h index 3799e3cd59..69dbd9520f 100644 --- a/tests/archive/archivetest.h +++ b/tests/archive/archivetest.h @@ -38,6 +38,7 @@ public: int GetOptions() const { return m_options; } wxFileOffset GetLength() const { return m_size; } + bool IsSeekable() const { return (m_options & PipeOut) == 0; } // gives away the data, this stream is then empty, and can be reused void GetData(char*& data, size_t& size); @@ -59,14 +60,23 @@ private: class TestInputStream : public wxInputStream { public: + // various streams have implemented eof differently, so check the archive + // stream works with all the possibilities (bit flags that can be ORed) + enum EofTypes { + AtLast = 0x01, // eof before an attempt to read past the last byte + WithError = 0x02 // give an error instead of eof + }; + // ctor takes the data from the output stream, which is then empty - TestInputStream(TestOutputStream& out) : m_data(NULL) { SetData(out); } + TestInputStream(TestOutputStream& out, int eoftype) + : m_data(NULL), m_eoftype(eoftype) { SetData(out); } // this ctor 'dups' TestInputStream(const TestInputStream& in); ~TestInputStream() { delete [] m_data; } void Rewind(); wxFileOffset GetLength() const { return m_size; } + bool IsSeekable() const { return (m_options & PipeIn) == 0; } void SetData(TestOutputStream& out); private: @@ -78,6 +88,7 @@ private: size_t m_pos; size_t m_size; char *m_data; + int m_eoftype; }; @@ -135,7 +146,6 @@ class ArchiveTestCase : public CppUnit::TestCase { public: ArchiveTestCase(std::string name, - int id, ClassFactoryT *factory, int options, const wxString& archiver = wxEmptyString, @@ -207,6 +217,22 @@ protected: }; +/////////////////////////////////////////////////////////////////////////////// +// Make ids + +class TestId +{ +public: + // make a new id and return it as a string + static std::string MakeId(); + // get the current id + static int GetId() { return m_seed; } +private: + // seed for generating the ids + static int m_seed; +}; + + /////////////////////////////////////////////////////////////////////////////// // Base class for the archive test suites @@ -216,12 +242,9 @@ public: ArchiveTestSuite(std::string name); protected: - int m_id; - virtual ArchiveTestSuite *makeSuite(); virtual CppUnit::Test *makeTest(std::string descr, - int id, int options, bool genericInterface, const wxString& archiver,