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; }
bool IsSeekable() const { return (m_options & PipeIn) == 0; }
void SetData(TestOutputStream& out);
+ void Chop(size_t size) { m_size = size; }
+ char& operator [](size_t pos) { return m_data[pos]; }
+
private:
wxFileOffset OnSysSeek(wxFileOffset pos, wxSeekMode mode);
wxFileOffset OnSysTell() const;
size_t m_pos;
size_t m_size;
char *m_data;
+ int m_eoftype;
};
{
public:
ArchiveTestCase(std::string name,
- int id,
ClassFactoryT *factory,
int options,
const wxString& archiver = wxEmptyString,
};
+///////////////////////////////////////////////////////////////////////////////
+// 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
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,