void ArchiveTestCase<ClassFactoryT>::TestSmartIterator(wxInputStream& in) { typedef std::list<Ptr<EntryT> > ArchiveCatalog; typedef typename ArchiveCatalog::iterator CatalogIter; typedef wxArchiveIterator<InputStreamT, Ptr<EntryT> > Iter; auto_ptr<InputStreamT> arc(m_factory->NewStream(in)); #ifdef WXARC_MEMBER_TEMPLATES ArchiveCatalog cat((Iter)*arc, Iter()); #else ArchiveCatalog cat; for (Iter i(*arc); i != Iter(); ++i) cat.push_back(*i); #endif CPPUNIT_ASSERT(m_testEntries.size() == cat.size()); for (CatalogIter it = cat.begin(); it != cat.end(); ++it) CPPUNIT_ASSERT(m_testEntries.count((*it)->GetName(wxPATH_UNIX))); }
void ArchiveTestCase<ClassFactoryT>::TestIterator(wxInputStream& in) { typedef std::list<EntryT*> ArchiveCatalog; typedef typename ArchiveCatalog::iterator CatalogIter; auto_ptr<InputStreamT> arc(m_factory->NewStream(in)); size_t count = 0; #ifdef WXARC_MEMBER_TEMPLATES ArchiveCatalog cat((IterT)*arc, IterT()); #else ArchiveCatalog cat; for (IterT i(*arc); i != IterT(); ++i) cat.push_back(*i); #endif for (CatalogIter it = cat.begin(); it != cat.end(); ++it) { auto_ptr<EntryT> entry(*it); count += m_testEntries.count(entry->GetName(wxPATH_UNIX)); } CPPUNIT_ASSERT(m_testEntries.size() == cat.size()); CPPUNIT_ASSERT(count == cat.size()); }