tartest.cpp 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. #include "testprec.h"
  9. #ifdef __BORLANDC__
  10. # pragma hdrstop
  11. #endif
  12. #ifndef WX_PRECOMP
  13. # include "wx/wx.h"
  14. #endif
  15. #if wxUSE_STREAMS
  16. #include "archivetest.h"
  17. #include "wx/tarstrm.h"
  18. using std::string;
  19. ///////////////////////////////////////////////////////////////////////////////
  20. // Tar suite
  21. class tartest : public ArchiveTestSuite
  22. {
  23. public:
  24. tartest();
  25. static CppUnit::Test *suite() { return (new tartest)->makeSuite(); }
  26. protected:
  27. CppUnit::Test *makeTest(string descr, int options,
  28. bool genericInterface,
  29. const wxString& archiver,
  30. const wxString& unarchiver);
  31. };
  32. tartest::tartest()
  33. : ArchiveTestSuite("tar")
  34. {
  35. AddArchiver(wxT("tar cf %s *"));
  36. AddUnArchiver(wxT("tar xf %s"));
  37. }
  38. CppUnit::Test *tartest::makeTest(
  39. string descr,
  40. int options,
  41. bool genericInterface,
  42. const wxString& archiver,
  43. const wxString& unarchiver)
  44. {
  45. if ((options & Stub) && (options & PipeIn) == 0)
  46. return NULL;
  47. if (genericInterface)
  48. {
  49. return new ArchiveTestCase<wxArchiveClassFactory>(
  50. descr, new wxTarClassFactory,
  51. options, archiver, unarchiver);
  52. }
  53. return new ArchiveTestCase<wxTarClassFactory>(
  54. descr, new wxTarClassFactory,
  55. options, archiver, unarchiver);
  56. }
  57. CPPUNIT_TEST_SUITE_REGISTRATION(tartest);
  58. CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(tartest, "archive");
  59. CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(tartest, "archive/tar");
  60. #endif // wxUSE_STREAMS