| 906 | // test_codecvt_argument -----------------------------------------------------------// |
| 907 | |
| 908 | void test_codecvt_argument() |
| 909 | { |
| 910 | std::cout << "testing codecvt arguments..." << std::endl; |
| 911 | |
| 912 | const char* c1 = "a1"; |
| 913 | const std::string s1(c1); |
| 914 | const std::wstring ws1(L"b2"); // off-by-one mimics test_codecvt |
| 915 | const std::string s2("y8"); |
| 916 | const std::wstring ws2(L"z9"); |
| 917 | |
| 918 | test_codecvt cvt; // produces off-by-one values that will always differ from |
| 919 | // the system's default locale codecvt facet |
| 920 | |
| 921 | int t = 0; |
| 922 | |
| 923 | // constructors |
| 924 | std::cout << " constructors test " << ++t << std::endl; |
| 925 | path p(c1, cvt); |
| 926 | NATIVE_IS(p, s1, ws1); |
| 927 | |
| 928 | std::cout << " test " << ++t << std::endl; |
| 929 | path p1(s1.begin(), s1.end(), cvt); |
| 930 | NATIVE_IS(p1, s1, ws1); |
| 931 | |
| 932 | std::cout << " test " << ++t << std::endl; |
| 933 | path p2(ws2, cvt); |
| 934 | NATIVE_IS(p2, s2, ws2); |
| 935 | |
| 936 | std::cout << " test " << ++t << std::endl; |
| 937 | path p3(ws2.begin(), ws2.end(), cvt); |
| 938 | NATIVE_IS(p3, s2, ws2); |
| 939 | |
| 940 | // path p2(p1, cvt); // fails to compile, and that is OK |
| 941 | |
| 942 | // assigns |
| 943 | p1.clear(); |
| 944 | std::cout << " assigns test " << ++t << std::endl; |
| 945 | p1.assign(s1, cvt); |
| 946 | NATIVE_IS(p1, s1, ws1); |
| 947 | p1.clear(); |
| 948 | std::cout << " test " << ++t << std::endl; |
| 949 | p1.assign(s1.begin(), s1.end(), cvt); |
| 950 | NATIVE_IS(p1, s1, ws1); |
| 951 | // p1.assign(p, cvt); // fails to compile, and that is OK |
| 952 | |
| 953 | // appends |
| 954 | p1.clear(); |
| 955 | std::cout << " appends test " << ++t << std::endl; |
| 956 | p1.append(s1, cvt); |
| 957 | NATIVE_IS(p1, s1, ws1); |
| 958 | p1.clear(); |
| 959 | std::cout << " test " << ++t << std::endl; |
| 960 | p1.append(s1.begin(), s1.end(), cvt); |
| 961 | NATIVE_IS(p1, s1, ws1); |
| 962 | // p1.append(p, cvt); // fails to compile, and that is OK |
| 963 | |
| 964 | // native observers |
| 965 | std::cout << " native observers test " << ++t << std::endl; |
no test coverage detected