10using namespace Microsoft::VisualStudio::CppUnitTestFramework;
12#pragma GCC diagnostic push
13#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
25 stdex::str2wstr(
"This is a test.", stdex::charset_id::utf8).c_str());
27 L
"Th\u00ed\u0161 i\u22c5 a te\u0073\u0304t. 😀😅",
28 stdex::str2wstr(
"Thíš i⋅ a tes̄t. 😀😅", stdex::charset_id::utf8).c_str());
31 for (
size_t i = 0; i < 2000; i++) {
35 Assert::AreEqual(dst.c_str(), stdex::str2wstr(src, stdex::charset_id::utf8).c_str());
38 stdex::str2wstr(
"test", 0, stdex::charset_id::utf8).c_str());
41 stdex::str2wstr(
nullptr, 0, stdex::charset_id::utf8).c_str());
48 stdex::wstr2str(L
"This is a test.", stdex::charset_id::utf8).c_str());
50 "Th\xc3\xad\xc5\xa1 i\xe2\x8b\x85 a tes\xcc\x84t. \xf0\x9f\x98\x80\xf0\x9f\x98\x85",
51 stdex::wstr2str(L
"Thíš i⋅ a tes̄t. 😀😅", stdex::charset_id::utf8).c_str());
54 for (
size_t i = 0; i < 2000; i++) {
58 Assert::AreEqual(dst.c_str(), stdex::wstr2str(src, stdex::charset_id::utf8).c_str());
61 stdex::wstr2str(L
"test", 0, stdex::charset_id::utf8).c_str());
64 stdex::wstr2str(
nullptr, 0, stdex::charset_id::utf8).c_str());
67 TEST_METHOD(charset_encoder)
73 win1250_to_utf8.convert(
"This is a test.").c_str());
76 win1250_to_utf8.convert(
"Th\xed\x9a i\xb7 a te\xbat.").c_str());
78 for (
size_t i = 0; i < 1000; i++) {
79 src +=
"V ko\x9eu\x9a\xe8ku zlobnega mizarja stopiclja fant in kli\xe8" "e 0123456789.\r\n";
80 dst +=
"V kožuščku zlobnega mizarja stopiclja fant in kliče 0123456789.\r\n";
82 Assert::AreEqual(dst.c_str(), win1250_to_utf8.convert(src).c_str());
85 win1250_to_utf8.convert(
"test", 0).c_str());
88 win1250_to_utf8.convert(
nullptr, 0).c_str());
91 TEST_METHOD(normalize)
96 stdex::normalize(L
"tést").c_str());
99 stdex::normalize(
nullptr, 0).c_str());
106#pragma GCC diagnostic pop
Encoding converter context.
Definition unicode.hpp:137