Ejemplo n.º 1
0
void TestDirectory::TestGetFilesWithMask()
{
	typedef std::vector<std::tstring> StringCollection;
	StringCollection fileNames = Workshare::System::IO::Directory::GetFiles(TEST_FOLDER + _T("\\TestGetFiles"), _T("*.doc"));
	assertEquals(2, (long)fileNames.size());

	// make all fileNames lowercase, so we can find them.
	std::for_each(fileNames.begin(), fileNames.end(), MakeFileNameLowerCase);

	StringCollection::iterator fileName = std::find(fileNames.begin(), fileNames.end(), tolower(TEST_FOLDER + _T("\\testgetfiles\\filea.doc")));
	assertMessage(fileName != fileNames.end(), _T("Expected to find [") + TEST_FOLDER + _T("\\testgetfiles\\filea.doc] in the returned list"));

	fileName = std::find(fileNames.begin(), fileNames.end(), tolower(TEST_FOLDER + _T("\\testgetfiles\\fileb.doc")));
	assertMessage(fileName != fileNames.end(), _T("Expected to find [") + TEST_FOLDER + _T("\\testgetfiles\\fileb.doc] in the returned list"));
}
//    namespace 
//    {
        static void PrintStringCollection(StringCollection const & coll, wstring const & header)
        {
            Trace.WriteInfo(TraceType, "{0}:", header);
            for_each(coll.begin(), coll.end(), [](wstring const & elem) { Trace.WriteInfo(TraceType, "\t\"{0}\"", elem); });
        }
 static void CheckStringCollectionsEquality(StringCollection & coll1, StringCollection & coll2)
 {
     sort(coll1.begin(), coll1.end());
     sort(coll2.begin(), coll2.end());
     BOOST_REQUIRE(coll1 == coll2);
 }
Ejemplo n.º 4
0
		StringCollection::StringCollection(const StringCollection &sc){
#ifdef USE_EMBEDDED_CLASSNAMES
			setClassName(__xvr2_Util_StringCollection);
#endif
			insert(begin(), sc.begin(), sc.end());
		}