| 904 | } |
| 905 | |
| 906 | bool testNonMemberFunctions() |
| 907 | { |
| 908 | std::cout << "testNonMemberFunctions()"; |
| 909 | |
| 910 | bool result = true; |
| 911 | |
| 912 | { |
| 913 | fs::path p1("/a/b/"); |
| 914 | fs::path p2("/c/d"); |
| 915 | fs::swap(p1, p2); |
| 916 | if (p1.string() != "/c/d" || p2.string() != "/a/b/") |
| 917 | result = false; |
| 918 | } |
| 919 | { |
| 920 | auto h1 = fs::hash_value(fs::path("/a//b//")); |
| 921 | auto h2 = fs::hash_value(fs::path("/a/b/")); |
| 922 | if (h1 != h2) |
| 923 | result = false; |
| 924 | } |
| 925 | { |
| 926 | fs::path p1("/a/b/"); |
| 927 | fs::path p2("/c/d"); |
| 928 | if (p1 == p2) |
| 929 | result = false; |
| 930 | p1 = "/a//b//"; |
| 931 | p2 = "/a/b/"; |
| 932 | if (p1 != p2) |
| 933 | result = false; |
| 934 | } |
| 935 | { |
| 936 | fs::path p = "/a"; |
| 937 | p = p / "b" / "c"; |
| 938 | if (p.generic_string() != "/a/b/c") { |
| 939 | result = false; |
| 940 | } |
| 941 | fs::path::string_type ref; |
| 942 | ref += fs::path::value_type('/'); |
| 943 | ref += fs::path::value_type('a'); |
| 944 | ref += fs::path::preferred_separator; |
| 945 | ref += fs::path::value_type('b'); |
| 946 | ref += fs::path::preferred_separator; |
| 947 | ref += fs::path::value_type('c'); |
| 948 | if (p.native() != ref) { |
| 949 | result = false; |
| 950 | } |
| 951 | } |
| 952 | { |
| 953 | fs::path p("/a b\\c/"); |
| 954 | std::ostringstream oss; |
| 955 | oss << p; |
| 956 | if (oss.str() != "\"/a b\\\\c/\"") { |
| 957 | result = false; |
| 958 | } |
| 959 | std::istringstream iss(oss.str()); |
| 960 | fs::path p2; |
| 961 | iss >> p2; |
| 962 | if (p2 != p) { |
| 963 | result = false; |
nothing calls this directly
no test coverage detected
searching dependent graphs…