| 1504 | } |
| 1505 | |
| 1506 | void append_tests() |
| 1507 | { |
| 1508 | std::cout << "append_tests..." << std::endl; |
| 1509 | |
| 1510 | // There are many control paths to be exercised, since empty paths and arguments, |
| 1511 | // paths with trailing separators, arguments with leading separators, with or without |
| 1512 | // other characters being present, are all separate cases that need to be tested. |
| 1513 | // Furthermore, some of the code to be tested is specific to argument categories, |
| 1514 | // so that results in further permutations to be tested. |
| 1515 | |
| 1516 | //// code to generate test cases |
| 1517 | //// |
| 1518 | //// expected results must be checked by hand |
| 1519 | //// "foo\bar" expected result must be edited by hand and moved for Windows/POSIX |
| 1520 | //// |
| 1521 | //const char* x[] = { "", "/", "foo", "foo/" }; |
| 1522 | //const char* y[] = { "", "/", "bar", "/bar" }; |
| 1523 | |
| 1524 | //for (int i = 0; i < sizeof(x)/sizeof(char*); ++i) |
| 1525 | // for (int j = 0; j < sizeof(y)/sizeof(char*); ++j) |
| 1526 | // { |
| 1527 | // std::cout << "\n PATH_TEST_EQ(path(\"" << x[i] << "\") / \"" << y[j] << "\", \"" |
| 1528 | // << path(x[i]) / y[j] << "\");\n"; |
| 1529 | // std::cout << " append_test_aux(\"" << x[i] << "\", \"" << y[j] << "\", \"" |
| 1530 | // << path(x[i]) / y[j] << "\");\n"; |
| 1531 | // } |
| 1532 | |
| 1533 | PATH_TEST_EQ(path("") / "", ""); |
| 1534 | append_test_aux("", "", ""); |
| 1535 | |
| 1536 | PATH_TEST_EQ(path("") / "/", "/"); |
| 1537 | append_test_aux("", "/", "/"); |
| 1538 | |
| 1539 | PATH_TEST_EQ(path("") / "bar", "bar"); |
| 1540 | append_test_aux("", "bar", "bar"); |
| 1541 | |
| 1542 | PATH_TEST_EQ(path("") / "/bar", "/bar"); |
| 1543 | append_test_aux("", "/bar", "/bar"); |
| 1544 | |
| 1545 | PATH_TEST_EQ(path("/") / "", "/"); |
| 1546 | append_test_aux("/", "", "/"); |
| 1547 | |
| 1548 | PATH_TEST_EQ(path("/") / "/", "//"); |
| 1549 | append_test_aux("/", "/", "//"); |
| 1550 | |
| 1551 | PATH_TEST_EQ(path("/") / "bar", "/bar"); |
| 1552 | append_test_aux("/", "bar", "/bar"); |
| 1553 | |
| 1554 | PATH_TEST_EQ(path("/") / "/bar", "//bar"); |
| 1555 | append_test_aux("/", "/bar", "//bar"); |
| 1556 | |
| 1557 | PATH_TEST_EQ(path("foo") / "", "foo"); |
| 1558 | append_test_aux("foo", "", "foo"); |
| 1559 | |
| 1560 | PATH_TEST_EQ(path("foo") / "/", "foo/"); |
| 1561 | append_test_aux("foo", "/", "foo/"); |
| 1562 | |
| 1563 | PATH_TEST_EQ(path("foo") / "/bar", "foo/bar"); |
no test coverage detected