Add tar stream tests.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42512 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Michael Wetherell 2006-10-27 10:11:46 +00:00
parent 46d69234ce
commit cdd7933f3d
9 changed files with 105 additions and 0 deletions

View File

@ -48,6 +48,7 @@ TEST_OBJECTS = \
test_test.o \
test_archivetest.o \
test_ziptest.o \
test_tartest.o \
test_arrays.o \
test_datetimetest.o \
test_fileconftest.o \
@ -296,6 +297,9 @@ test_archivetest.o: $(srcdir)/archive/archivetest.cpp $(TEST_ODEP)
test_ziptest.o: $(srcdir)/archive/ziptest.cpp $(TEST_ODEP)
$(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/archive/ziptest.cpp
test_tartest.o: $(srcdir)/archive/tartest.cpp $(TEST_ODEP)
$(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/archive/tartest.cpp
test_arrays.o: $(srcdir)/arrays/arrays.cpp $(TEST_ODEP)
$(CXXC) -c -o $@ $(TEST_CXXFLAGS) $(srcdir)/arrays/arrays.cpp

View File

@ -1407,4 +1407,9 @@ template class ArchiveTestCase<wxArchiveClassFactory>;
template class ArchiveTestCase<wxZipClassFactory>;
#endif
#if wxUSE_TARSTREAM
#include "wx/tarstrm.h"
template class ArchiveTestCase<wxTarClassFactory>;
#endif
#endif // wxUSE_STREAMS && wxUSE_ARCHIVE_STREAMS

75
tests/archive/tartest.cpp Normal file
View File

@ -0,0 +1,75 @@
///////////////////////////////////////////////////////////////////////////////
// Name: tests/tartest.cpp
// Purpose: Test the tar classes
// Author: Mike Wetherell
// RCS-ID: $Id$
// Copyright: (c) 2004 Mike Wetherell
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#include "testprec.h"
#ifdef __BORLANDC__
# pragma hdrstop
#endif
#ifndef WX_PRECOMP
# include "wx/wx.h"
#endif
#if wxUSE_STREAMS
#include "archivetest.h"
#include "wx/tarstrm.h"
using std::string;
///////////////////////////////////////////////////////////////////////////////
// Tar suite
class tartest : public ArchiveTestSuite
{
public:
tartest();
static CppUnit::Test *suite() { return (new tartest)->makeSuite(); }
protected:
CppUnit::Test *makeTest(string descr, int options,
bool genericInterface,
const wxString& archiver,
const wxString& unarchiver);
};
tartest::tartest()
: ArchiveTestSuite("tar")
{
AddArchiver(_T("tar cf %s *"));
AddUnArchiver(_T("tar xf %s"));
}
CppUnit::Test *tartest::makeTest(
string descr,
int options,
bool genericInterface,
const wxString& archiver,
const wxString& unarchiver)
{
if ((options & Stub) && (options & PipeIn) == 0)
return NULL;
if (genericInterface)
return new ArchiveTestCase<wxArchiveClassFactory>(
descr, new wxTarClassFactory,
options, archiver, unarchiver);
else
return new ArchiveTestCase<wxTarClassFactory>(
descr, new wxTarClassFactory,
options, archiver, unarchiver);
}
CPPUNIT_TEST_SUITE_REGISTRATION(tartest);
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(tartest, "archive");
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(tartest, "archive/tar");
#endif // wxUSE_STREAMS

View File

@ -39,6 +39,7 @@ TEST_OBJECTS = \
$(OBJS)\test_test.obj \
$(OBJS)\test_archivetest.obj \
$(OBJS)\test_ziptest.obj \
$(OBJS)\test_tartest.obj \
$(OBJS)\test_arrays.obj \
$(OBJS)\test_datetimetest.obj \
$(OBJS)\test_fileconftest.obj \
@ -335,6 +336,9 @@ $(OBJS)\test_archivetest.obj: .\archive\archivetest.cpp
$(OBJS)\test_ziptest.obj: .\archive\ziptest.cpp
$(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) $**
$(OBJS)\test_tartest.obj: .\archive\tartest.cpp
$(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) $**
$(OBJS)\test_arrays.obj: .\arrays\arrays.cpp
$(CXX) -q -c -P -o$@ $(TEST_CXXFLAGS) $**

View File

@ -31,6 +31,7 @@ TEST_OBJECTS = \
$(OBJS)\test_test.o \
$(OBJS)\test_archivetest.o \
$(OBJS)\test_ziptest.o \
$(OBJS)\test_tartest.o \
$(OBJS)\test_arrays.o \
$(OBJS)\test_datetimetest.o \
$(OBJS)\test_fileconftest.o \
@ -313,6 +314,9 @@ $(OBJS)\test_archivetest.o: ./archive/archivetest.cpp
$(OBJS)\test_ziptest.o: ./archive/ziptest.cpp
$(CXX) -c -o $@ $(TEST_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\test_tartest.o: ./archive/tartest.cpp
$(CXX) -c -o $@ $(TEST_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\test_arrays.o: ./arrays/arrays.cpp
$(CXX) -c -o $@ $(TEST_CXXFLAGS) $(CPPDEPS) $<

View File

@ -31,6 +31,7 @@ TEST_OBJECTS = \
$(OBJS)\test_test.obj \
$(OBJS)\test_archivetest.obj \
$(OBJS)\test_ziptest.obj \
$(OBJS)\test_tartest.obj \
$(OBJS)\test_arrays.obj \
$(OBJS)\test_datetimetest.obj \
$(OBJS)\test_fileconftest.obj \
@ -419,6 +420,9 @@ $(OBJS)\test_archivetest.obj: .\archive\archivetest.cpp
$(OBJS)\test_ziptest.obj: .\archive\ziptest.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) $**
$(OBJS)\test_tartest.obj: .\archive\tartest.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) $**
$(OBJS)\test_arrays.obj: .\arrays\arrays.cpp
$(CXX) /c /nologo /TP /Fo$@ $(TEST_CXXFLAGS) $**

View File

@ -236,6 +236,7 @@ TEST_OBJECTS = &
$(OBJS)\test_test.obj &
$(OBJS)\test_archivetest.obj &
$(OBJS)\test_ziptest.obj &
$(OBJS)\test_tartest.obj &
$(OBJS)\test_arrays.obj &
$(OBJS)\test_datetimetest.obj &
$(OBJS)\test_fileconftest.obj &
@ -368,6 +369,9 @@ $(OBJS)\test_archivetest.obj : .AUTODEPEND .\archive\archivetest.cpp
$(OBJS)\test_ziptest.obj : .AUTODEPEND .\archive\ziptest.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_CXXFLAGS) $<
$(OBJS)\test_tartest.obj : .AUTODEPEND .\archive\tartest.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_CXXFLAGS) $<
$(OBJS)\test_arrays.obj : .AUTODEPEND .\arrays\arrays.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(TEST_CXXFLAGS) $<

View File

@ -26,6 +26,7 @@
test.cpp
archive/archivetest.cpp
archive/ziptest.cpp
archive/tartest.cpp
arrays/arrays.cpp
datetime/datetimetest.cpp
fileconf/fileconftest.cpp

View File

@ -549,6 +549,10 @@ SOURCE=.\strings\strings.cpp
# End Source File
# Begin Source File
SOURCE=.\archive\tartest.cpp
# End Source File
# Begin Source File
SOURCE=.\streams\tempfile.cpp
# End Source File
# Begin Source File