void ArchiveTestCase<ClassFactoryT>::TestSmartPairIterator(wxInputStream& in) { #if defined _MSC_VER && defined _MSC_VER < 1200 // With VC++ 5.0 the '=' operator of std::pair breaks when the second // type is Ptr<EntryT>, so this iterator can't be made to work. (void)in; #else typedef std::map<wxString, Ptr<EntryT> > ArchiveCatalog; typedef typename ArchiveCatalog::iterator CatalogIter; typedef wxArchiveIterator<InputStreamT, std::pair<wxString, Ptr<EntryT> > > PairIter; auto_ptr<InputStreamT> arc(m_factory->NewStream(in)); #ifdef WXARC_MEMBER_TEMPLATES ArchiveCatalog cat((PairIter)*arc, PairIter()); #else ArchiveCatalog cat; for (PairIter i(*arc); i != PairIter(); ++i) cat.insert(*i); #endif CPPUNIT_ASSERT(m_testEntries.size() == cat.size()); for (CatalogIter it = cat.begin(); it != cat.end(); ++it) CPPUNIT_ASSERT(m_testEntries.count(it->second->GetName(wxPATH_UNIX))); #endif }
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>::TestPairIterator(wxInputStream& in) { typedef std::map<wxString, 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((PairIterT)*arc, PairIterT()); #else ArchiveCatalog cat; for (PairIterT i(*arc); i != PairIterT(); ++i) cat.insert(*i); #endif for (CatalogIter it = cat.begin(); it != cat.end(); ++it) { auto_ptr<EntryT> entry(it->second); count += m_testEntries.count(entry->GetName(wxPATH_UNIX)); } CPPUNIT_ASSERT(m_testEntries.size() == cat.size()); CPPUNIT_ASSERT(count == cat.size()); }
void ArchiveTestCase<ClassFactoryT>::TestIterator(wxInputStream& in) { typedef std::list<EntryT*> ArchiveCatalog; typedef typename ArchiveCatalog::iterator CatalogIter; wxScopedPtr<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) { wxScopedPtr<EntryT> entry(*it); count += m_testEntries.count(entry->GetName(wxPATH_UNIX)); } CPPUNIT_ASSERT(m_testEntries.size() == cat.size()); CPPUNIT_ASSERT(count == cat.size()); }