MCPcopy Create free account
hub / github.com/boostorg/filesystem / test_codecvt_argument

Function test_codecvt_argument

test/path_unit_test.cpp:744–821  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

742 // test_codecvt_argument -----------------------------------------------------------//
743
744 void test_codecvt_argument()
745 {
746 std::cout << "testing codecvt arguments..." << std::endl;
747
748 const char * c1 = "a1";
749 const std::string s1(c1);
750 const std::wstring ws1(L"b2"); // off-by-one mimics test_codecvt
751 const std::string s2("y8");
752 const std::wstring ws2(L"z9");
753
754 test_codecvt cvt; // produces off-by-one values that will always differ from
755 // the system's default locale codecvt facet
756
757 int t = 0;
758
759 // constructors
760 std::cout << " constructors test " << ++t << std::endl;
761 path p(c1, cvt);
762 NATIVE_IS(p, s1, ws1);
763
764 std::cout << " test " << ++t << std::endl;
765 path p1(s1.begin(), s1.end(), cvt);
766 NATIVE_IS(p1, s1, ws1);
767
768 std::cout << " test " << ++t << std::endl;
769 path p2(ws2, cvt);
770 NATIVE_IS(p2, s2, ws2);
771
772 std::cout << " test " << ++t << std::endl;
773 path p3(ws2.begin(), ws2.end(), cvt);
774 NATIVE_IS(p3, s2, ws2);
775
776 // path p2(p1, cvt); // fails to compile, and that is OK
777
778 // assigns
779 p1.clear();
780 std::cout << " assigns test " << ++t << std::endl;
781 p1.assign(s1,cvt);
782 NATIVE_IS(p1, s1, ws1);
783 p1.clear();
784 std::cout << " test " << ++t << std::endl;
785 p1.assign(s1.begin(), s1.end(), cvt);
786 NATIVE_IS(p1, s1, ws1);
787 // p1.assign(p, cvt); // fails to compile, and that is OK
788
789 // appends
790 p1.clear();
791 std::cout << " appends test " << ++t << std::endl;
792 p1.append(s1,cvt);
793 NATIVE_IS(p1, s1, ws1);
794 p1.clear();
795 std::cout << " test " << ++t << std::endl;
796 p1.append(s1.begin(), s1.end(), cvt);
797 NATIVE_IS(p1, s1, ws1);
798 // p1.append(p, cvt); // fails to compile, and that is OK
799
800 // native observers
801 std::cout << " native observers test " << ++t << std::endl;

Callers 1

cpp_mainFunction · 0.85

Calls 4

beginMethod · 0.80
endMethod · 0.80
generic_stringMethod · 0.80
generic_wstringMethod · 0.80

Tested by

no test coverage detected