| 1020 | // a decomposition function. |
| 1021 | |
| 1022 | void query_and_decomposition_tests() |
| 1023 | { |
| 1024 | std::cout << "query_and_decomposition_tests..." << std::endl; |
| 1025 | |
| 1026 | // these are the examples given in reference docs, so check they work |
| 1027 | BOOST_TEST(path("/foo/bar.txt").parent_path() == "/foo"); |
| 1028 | BOOST_TEST(path("/foo/bar").parent_path() == "/foo"); |
| 1029 | BOOST_TEST(path("/foo/bar/").parent_path() == "/foo/bar"); |
| 1030 | BOOST_TEST(path("/").parent_path() == ""); |
| 1031 | BOOST_TEST(path(".").parent_path() == ""); |
| 1032 | BOOST_TEST(path("..").parent_path() == ""); |
| 1033 | BOOST_TEST(path("/foo/bar.txt").filename() == "bar.txt"); |
| 1034 | BOOST_TEST(path("/foo/bar").filename() == "bar"); |
| 1035 | BOOST_TEST(path("/foo/bar/").filename() == BOOST_FILESYSTEM_V3_TRAILING_DOT); |
| 1036 | #if BOOST_FILESYSTEM_VERSION == 3 |
| 1037 | BOOST_TEST(path("/").filename() == "/"); |
| 1038 | #else |
| 1039 | BOOST_TEST(path("/").filename() == ""); |
| 1040 | #endif |
| 1041 | BOOST_TEST(path(".").filename() == "."); |
| 1042 | BOOST_TEST(path("..").filename() == ".."); |
| 1043 | |
| 1044 | // stem() tests not otherwise covered |
| 1045 | BOOST_TEST(path(".").stem() == "."); |
| 1046 | BOOST_TEST(path("..").stem() == ".."); |
| 1047 | #if BOOST_FILESYSTEM_VERSION == 3 |
| 1048 | BOOST_TEST(path(".a").stem() == ""); |
| 1049 | #else |
| 1050 | BOOST_TEST(path(".a").stem() == ".a"); |
| 1051 | #endif |
| 1052 | BOOST_TEST(path("b").stem() == "b"); |
| 1053 | BOOST_TEST(path("a/b.txt").stem() == "b"); |
| 1054 | BOOST_TEST(path("a/b.").stem() == "b"); |
| 1055 | BOOST_TEST(path("a.b.c").stem() == "a.b"); |
| 1056 | BOOST_TEST(path("a.b.c.").stem() == "a.b.c"); |
| 1057 | |
| 1058 | // extension() tests not otherwise covered |
| 1059 | BOOST_TEST(path(".").extension() == ""); |
| 1060 | BOOST_TEST(path("..").extension() == ""); |
| 1061 | #if BOOST_FILESYSTEM_VERSION == 3 |
| 1062 | BOOST_TEST(path(".a").extension() == ".a"); |
| 1063 | #else |
| 1064 | BOOST_TEST(path(".a").extension() == ""); |
| 1065 | #endif |
| 1066 | BOOST_TEST(path("a/b").extension() == ""); |
| 1067 | BOOST_TEST(path("a.b/c").extension() == ""); |
| 1068 | BOOST_TEST(path("a/b.txt").extension() == ".txt"); |
| 1069 | BOOST_TEST(path("a/b.").extension() == "."); |
| 1070 | BOOST_TEST(path("a.b.c").extension() == ".c"); |
| 1071 | BOOST_TEST(path("a.b.c.").extension() == "."); |
| 1072 | BOOST_TEST(path("a/").extension() == ""); |
| 1073 | |
| 1074 | // main q & d test sequence |
| 1075 | path p; |
| 1076 | path q; |
| 1077 | |
| 1078 | p = q = ""; |
| 1079 | BOOST_TEST(p.relative_path().string() == ""); |
no test coverage detected