10using namespace Microsoft::VisualStudio::CppUnitTestFramework;
13#pragma GCC diagnostic push
14#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
26 stdex::str2wstr(
"This is a test.", stdex::charset_id::utf8).c_str());
28 L
"Th\u00ed\u0161 i\u22c5 a te\u0073\u0304t. 😀😅",
29 stdex::str2wstr(
"Thíš i⋅ a tes̄t. 😀😅", stdex::charset_id::utf8).c_str());
32 for (
size_t i = 0; i < 2000; i++) {
36 Assert::AreEqual(dst.c_str(), stdex::str2wstr(src, stdex::charset_id::utf8).c_str());
39 stdex::str2wstr(
"test", 0, stdex::charset_id::utf8).c_str());
42 stdex::str2wstr(
nullptr, 0, stdex::charset_id::utf8).c_str());
49 stdex::wstr2str(L
"This is a test.", stdex::charset_id::utf8).c_str());
51 "Th\xc3\xad\xc5\xa1 i\xe2\x8b\x85 a tes\xcc\x84t. \xf0\x9f\x98\x80\xf0\x9f\x98\x85",
52 stdex::wstr2str(L
"Thíš i⋅ a tes̄t. 😀😅", stdex::charset_id::utf8).c_str());
55 for (
size_t i = 0; i < 2000; i++) {
59 Assert::AreEqual(dst.c_str(), stdex::wstr2str(src, stdex::charset_id::utf8).c_str());
62 stdex::wstr2str(L
"test", 0, stdex::charset_id::utf8).c_str());
65 stdex::wstr2str(
nullptr, 0, stdex::charset_id::utf8).c_str());
68 TEST_METHOD(charset_encoder)
74 win1250_to_utf8.convert(
"This is a test.").c_str());
77 win1250_to_utf8.convert(
"Th\xed\x9a i\xb7 a te\xbat.").c_str());
79 for (
size_t i = 0; i < 1000; i++) {
80 src +=
"V ko\x9eu\x9a\xe8ku zlobnega mizarja stopiclja fant in kli\xe8" "e 0123456789.\r\n";
81 dst +=
"V kožuščku zlobnega mizarja stopiclja fant in kliče 0123456789.\r\n";
83 Assert::AreEqual(dst.c_str(), win1250_to_utf8.convert(src).c_str());
86 win1250_to_utf8.convert(
"test", 0).c_str());
89 win1250_to_utf8.convert(
nullptr, 0).c_str());
92 TEST_METHOD(normalize)
97 stdex::normalize(L
"tést").c_str());
100 stdex::normalize(
nullptr, 0).c_str());
107#pragma GCC diagnostic pop
Encoding converter context.
Definition unicode.hpp:137