30using boost::system::error_code;
31using boost::system::system_category;
32using boost::system::system_error;
34#if (BOOST_VERSION/100) >= 1044
35# define SYSTEMCATEGORY system_category()
37# define SYSTEMCATEGORY system_category
44# define REL ".\\relative"
49# define REL "./relative"
57 return bal::replace_all_copy(path,
"%SD%",
systemDrive);
63 ABS "pwiz_foofoo_test",
"root file",
64 ABS "pwiz_foo_test",
"",
65 ABS "pwiz_foo_test" A "this file",
"has content",
66 ABS "pwiz_foo_test" A "this dir has",
"",
67 ABS "pwiz_foo_test" A "this dir has" A "a test file",
"with content",
68 ABS "pwiz_bar_test",
"",
69 ABS "pwiz_bar_test" A "some file",
"12345",
70 ABS "pwiz_bar_test" A "some dir",
"",
72 REL "pwiz_foofoo_test",
"root file",
73 REL "pwiz_foo_test",
"",
74 REL "pwiz_foo_test" A "this file",
"has content",
75 REL "pwiz_foo_test" A "this dir has",
"",
76 REL "pwiz_foo_test" A "this dir has" A "a test file",
"with content",
77 REL "pwiz_bar_test",
"",
78 REL "pwiz_bar_test" A "some file",
"12345",
79 REL "pwiz_bar_test" A "some dir",
""
95 {
ABS "pwiz_f??f??_test",
ABS "pwiz_foofoo_test" },
96 {
ABS "pwiz_???_test",
ABS "pwiz_foo_test" D ABS "pwiz_bar_test" },
97 {
ABS "pwiz_f*o_test",
ABS "pwiz_foo_test" D ABS "pwiz_foofoo_test" },
98 {
ABS "pwiz_foobar_test",
"" },
99 {
ABS "pwiz_foo_test" A "no*hit",
"" },
100 {
ABS "pwiz_foo_test" A "*",
ABS "pwiz_foo_test" A "this file" D ABS "pwiz_foo_test" A "this dir has" },
101 {
ABS"pwiz_foo_test" A "this *",
ABS "pwiz_foo_test" A "this file" D ABS "pwiz_foo_test" A "this dir has" },
103 {
REL "pwiz_f??f??_test",
REL "pwiz_foofoo_test" },
104 {
REL "pwiz_???_test",
REL "pwiz_foo_test" D REL "pwiz_bar_test" },
105 {
REL "pwiz_f*o_test",
REL "pwiz_foo_test" D REL "pwiz_foofoo_test" },
106 {
REL "pwiz_foobar_test",
"" },
107 {
REL "pwiz_foo_test" A "no*hit",
"" },
108 {
REL "pwiz_foo_test" A "*",
REL "pwiz_foo_test" A "this file" D REL "pwiz_foo_test" A "this dir has" },
109 {
REL "pwiz_foo_test" A "this *",
REL "pwiz_foo_test" A "this file" D REL "pwiz_foo_test" A "this dir has" }
118 ofstream f(ph.string().c_str());
120 throw bfs::filesystem_error(
"create_file", ph, error_code(errno,
SYSTEMCATEGORY));
121 if (!contents.empty()) f << contents;
135 bfs::create_directory(testPath);
144 cerr <<
"Test on \"" << testPath <<
"\" skipped; requires administrator permissions." << endl;
165 set<bfs::path> pathSet;
166 vector<string> tokens;
167 bal::split(tokens, pathArray, bal::is_any_of(
D));
168 if (!tokens.empty() && !tokens[0].empty())
169 for (
size_t i=0; i < tokens.size(); ++i)
177 char* systemDriveEnv = ::getenv(
"SystemDrive");
190 vector<bfs::path> matchingPaths;
194 unit_assert(matchingPaths.size() == targetPathSet.size());
196 set<bfs::path> matchingPathSet(matchingPaths.begin(), matchingPaths.end());
197 vector<bfs::path> xorSet;
198 std::set_symmetric_difference(targetPathSet.begin(), targetPathSet.end(),
199 matchingPathSet.begin(), matchingPathSet.end(),
220 vector<bfs::path> matchingPaths;
260int main(
int argc,
char* argv[])
const int testPathContentPairArraySize
int main(int argc, char *argv[])
void testAbbreviateByteSize()
string setSystemDrive(const string &path)
void testExpandPathmask()
const int testPathmaskArraySize
set< bfs::path > parsePathArray(const string &pathArray)
const char * testPathContentPairArray[]
const TestPathmask testPathmaskArray[]
void create_file(const bfs::path &ph, const string &contents)
PWIZ_API_DECL int expand_pathmask(const bfs::path &pathmask, vector< bfs::path > &matchingPaths)
expands (aka globs) a pathmask to zero or more matching paths and returns the number of matching path...
PWIZ_API_DECL std::string abbreviate_byte_size(boost::uintmax_t byteSize, ByteSizeAbbreviation abbreviationType=ByteSizeAbbreviation_SI)
abbreviates a byte size (file or RAM) as a readable string, using the specified notation
@ ByteSizeAbbreviation_JEDEC
sizes are treated as multiples of 2; abbreviations are: GB (Gigabyte), MB (Megabyte),...
@ ByteSizeAbbreviation_IEC
sizes are treated as multiples of 2; abbreviations are: GiB (Gibibyte), MiB (Mebibyte),...
const char * pathnameArray
#define unit_assert_operator_equal(expected, actual)
#define TEST_PROLOG(argc, argv)