| 2282 | } |
| 2283 | |
| 2284 | void append_tests() |
| 2285 | { |
| 2286 | std::cout << "append_tests..." << std::endl; |
| 2287 | |
| 2288 | // There are many control paths to be exercised, since empty paths and arguments, |
| 2289 | // paths with trailing separators, arguments with leading separators, with or without |
| 2290 | // other characters being present, are all separate cases that need to be tested. |
| 2291 | // Furthermore, some of the code to be tested is specific to argument categories, |
| 2292 | // so that results in further permutations to be tested. |
| 2293 | |
| 2294 | //// code to generate test cases |
| 2295 | //// |
| 2296 | //// expected results must be checked by hand |
| 2297 | //// "foo\bar" expected result must be edited by hand and moved for Windows/POSIX |
| 2298 | //// |
| 2299 | //const char* x[] = { "", "/", "foo", "foo/" }; |
| 2300 | //const char* y[] = { "", "/", "bar", "/bar" }; |
| 2301 | |
| 2302 | //for (int i = 0; i < sizeof(x)/sizeof(char*); ++i) |
| 2303 | // for (int j = 0; j < sizeof(y)/sizeof(char*); ++j) |
| 2304 | // { |
| 2305 | // std::cout << " APPEND_TEST(\"" << x[i] << "\", \"" << y[j] << "\", \"" |
| 2306 | // << path(x[i]) / y[j] << "\");\n"; |
| 2307 | // } |
| 2308 | |
| 2309 | APPEND_TEST("", "", ""); |
| 2310 | APPEND_TEST("", "/", "/"); |
| 2311 | APPEND_TEST("", "bar", "bar"); |
| 2312 | APPEND_TEST("", "/bar", "/bar"); |
| 2313 | |
| 2314 | APPEND_TEST("/", "", "/"); |
| 2315 | #if BOOST_FILESYSTEM_VERSION == 3 |
| 2316 | APPEND_TEST("/", "/", "//"); |
| 2317 | #else |
| 2318 | APPEND_TEST("/", "/", "/"); |
| 2319 | #endif |
| 2320 | APPEND_TEST("/", "bar", "/bar"); |
| 2321 | #if BOOST_FILESYSTEM_VERSION == 3 |
| 2322 | APPEND_TEST("/", "/bar", "//bar"); |
| 2323 | #else |
| 2324 | APPEND_TEST("/", "/bar", "/bar"); |
| 2325 | #endif |
| 2326 | |
| 2327 | #if BOOST_FILESYSTEM_VERSION == 3 |
| 2328 | APPEND_TEST("foo", "/", "foo/"); |
| 2329 | #else |
| 2330 | APPEND_TEST("foo", "/", "/"); |
| 2331 | #endif |
| 2332 | #if BOOST_FILESYSTEM_VERSION == 3 |
| 2333 | APPEND_TEST("foo", "/bar", "foo/bar"); |
| 2334 | #else |
| 2335 | APPEND_TEST("foo", "/bar", "/bar"); |
| 2336 | #endif |
| 2337 | |
| 2338 | APPEND_TEST("foo/", "", "foo/"); |
| 2339 | #if BOOST_FILESYSTEM_VERSION == 3 |
| 2340 | APPEND_TEST("foo/", "/", "foo//"); |
| 2341 | #else |