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