]>
Commit | Line | Data |
---|---|---|
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(wxT("tar cf %s *")); | |
48 | AddUnArchiver(wxT("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 | { | |
63 | return new ArchiveTestCase<wxArchiveClassFactory>( | |
64 | descr, new wxTarClassFactory, | |
65 | options, archiver, unarchiver); | |
66 | } | |
67 | ||
68 | return new ArchiveTestCase<wxTarClassFactory>( | |
69 | descr, new wxTarClassFactory, | |
70 | options, archiver, unarchiver); | |
71 | } | |
72 | ||
73 | CPPUNIT_TEST_SUITE_REGISTRATION(tartest); | |
74 | CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(tartest, "archive"); | |
75 | CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(tartest, "archive/tar"); | |
76 | ||
77 | #endif // wxUSE_STREAMS |