diff options
author | kerzum <kerzum@yandex-team.ru> | 2022-02-10 16:49:33 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:33 +0300 |
commit | 9a7232babfd763ccfe827bc70e82e0f50cfd8276 (patch) | |
tree | a39808b7482c4711a80f799a7281adb36d76a13a /library/cpp/charset/codepage_ut.cpp | |
parent | 0e68ae909d3b76a5a001a07880eb0010dec6b2ea (diff) | |
download | ydb-9a7232babfd763ccfe827bc70e82e0f50cfd8276.tar.gz |
Restoring authorship annotation for <kerzum@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/charset/codepage_ut.cpp')
-rw-r--r-- | library/cpp/charset/codepage_ut.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/library/cpp/charset/codepage_ut.cpp b/library/cpp/charset/codepage_ut.cpp index c3ac3ac478..5b700bd14a 100644 --- a/library/cpp/charset/codepage_ut.cpp +++ b/library/cpp/charset/codepage_ut.cpp @@ -56,7 +56,7 @@ public: void TestCanEncode(); inline void TestUpperLower() { - const CodePage* cp = CodePageByCharset(CODES_ASCII); + const CodePage* cp = CodePageByCharset(CODES_ASCII); char tmp[100]; TStringBuf s = "abcde"; @@ -161,13 +161,13 @@ void TCodepageTest::TestUTF() { } void TCodepageTest::TestBrokenMultibyte() { - const ECharset cp = CODES_EUC_JP; - + const ECharset cp = CODES_EUC_JP; + const char sampletext[] = {'\xe3'}; wchar32 recodeResult[100]; - - size_t nwritten = 0; - size_t nread = 0; + + size_t nwritten = 0; + size_t nread = 0; RECODE_RESULT res = RecodeToUnicode(cp, sampletext, recodeResult, Y_ARRAY_SIZE(sampletext), Y_ARRAY_SIZE(recodeResult), nread, nwritten); UNIT_ASSERT(res == RECODE_OK); @@ -178,8 +178,8 @@ void TCodepageTest::TestBrokenMultibyte() { res = RecodeToUnicode(cp, bigSample, recodeResult, Y_ARRAY_SIZE(bigSample), Y_ARRAY_SIZE(recodeResult), nread, nwritten); UNIT_ASSERT(res == RECODE_OK); UNIT_ASSERT(nread == Y_ARRAY_SIZE(bigSample)); -} - +} + void TCodepageTest::TestUTFFromUnknownPlane() { static const wchar32 sampletext[] = {0x61, 0x62, 0x63, 0x20, 0x430, 0x431, 0x432, 0x20, @@ -250,21 +250,21 @@ void TCodepageTest::TestUTFFromUnknownPlane() { } UNIT_ASSERT(0x1234 == charbuffer[samplelen]); UNIT_ASSERT(0x5678 == charbuffer[2 * samplelen + 1]); - - // test TChar version - // bytebuffer of len writtenbytes contains sampletext of len samplelen chars in utf8 + + // test TChar version + // bytebuffer of len writtenbytes contains sampletext of len samplelen chars in utf8 TUtf16String wtr = CharToWide(TStringBuf(bytebuffer, writtenbytes), CODES_UNKNOWNPLANE); TChar* strend = wtr.begin() + wtr.size(); - DecodeUnknownPlane(wtr.begin(), strend, CODES_UTF8); + DecodeUnknownPlane(wtr.begin(), strend, CODES_UTF8); wtr.resize(strend - wtr.data(), 'Q'); UNIT_ASSERT_VALUES_EQUAL(wtr.size(), samplelen); for (size_t i = 0; i < wtr.size(); ++i) { - if (sampletext[i] >= 0x10000) { - UNIT_ASSERT_VALUES_EQUAL(wtr[i], ' '); + if (sampletext[i] >= 0x10000) { + UNIT_ASSERT_VALUES_EQUAL(wtr[i], ' '); } else { - UNIT_ASSERT_VALUES_EQUAL(wtr[i], sampletext[i]); - } - } + UNIT_ASSERT_VALUES_EQUAL(wtr[i], sampletext[i]); + } + } } static void TestSurrogates(const char* str, const wchar16* wide, size_t wideSize) { |