Remove all lines containing cvs/svn "$Id$" keyword.
[wxWidgets.git] / tests / archive / tartest.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/tartest.cpp
3 // Purpose: Test the tar classes
4 // Author: Mike Wetherell
5 // Copyright: (c) 2004 Mike Wetherell
6 // Licence: wxWindows licence
7 ///////////////////////////////////////////////////////////////////////////////
8
9 #include "testprec.h"
10
11 #ifdef __BORLANDC__
12 # pragma hdrstop
13 #endif
14
15 #ifndef WX_PRECOMP
16 # include "wx/wx.h"
17 #endif
18
19 #if wxUSE_STREAMS
20
21 #include "archivetest.h"
22 #include "wx/tarstrm.h"
23
24 using std::string;
25
26
27 ///////////////////////////////////////////////////////////////////////////////
28 // Tar suite
29
30 class tartest : public ArchiveTestSuite
31 {
32 public:
33 tartest();
34 static CppUnit::Test *suite() { return (new tartest)->makeSuite(); }
35
36 protected:
37 CppUnit::Test *makeTest(string descr, int options,
38 bool genericInterface,
39 const wxString& archiver,
40 const wxString& unarchiver);
41 };
42
43 tartest::tartest()
44 : ArchiveTestSuite("tar")
45 {
46 AddArchiver(wxT("tar cf %s *"));
47 AddUnArchiver(wxT("tar xf %s"));
48 }
49
50 CppUnit::Test *tartest::makeTest(
51 string descr,
52 int options,
53 bool genericInterface,
54 const wxString& archiver,
55 const wxString& unarchiver)
56 {
57 if ((options & Stub) && (options & PipeIn) == 0)
58 return NULL;
59
60 if (genericInterface)
61 {
62 return new ArchiveTestCase<wxArchiveClassFactory>(
63 descr, new wxTarClassFactory,
64 options, archiver, unarchiver);
65 }
66
67 return new ArchiveTestCase<wxTarClassFactory>(
68 descr, new wxTarClassFactory,
69 options, archiver, unarchiver);
70 }
71
72 CPPUNIT_TEST_SUITE_REGISTRATION(tartest);
73 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(tartest, "archive");
74 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(tartest, "archive/tar");
75
76 #endif // wxUSE_STREAMS