diff options
author | sobols <sobols@yandex-team.ru> | 2022-02-10 16:47:08 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:08 +0300 |
commit | 03335cb18337a0ef51966452a66a69b01abea218 (patch) | |
tree | b83306b6e37edeea782e9eed673d89286c4fef35 /util/stream/ios_ut.cpp | |
parent | 09961b69c61f471ddd594e0fd877df62a8021562 (diff) | |
download | ydb-03335cb18337a0ef51966452a66a69b01abea218.tar.gz |
Restoring authorship annotation for <sobols@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/stream/ios_ut.cpp')
-rw-r--r-- | util/stream/ios_ut.cpp | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/util/stream/ios_ut.cpp b/util/stream/ios_ut.cpp index 9600edf228..139f4296e5 100644 --- a/util/stream/ios_ut.cpp +++ b/util/stream/ios_ut.cpp @@ -27,9 +27,9 @@ class TStreamsTest: public TTestBase { UNIT_TEST(TestReadTo); UNIT_TEST(TestWtrokaOutput); UNIT_TEST(TestIStreamOperators); - UNIT_TEST(TestWchar16Output); - UNIT_TEST(TestWchar32Output); - UNIT_TEST(TestUtf16StingOutputByChars); + UNIT_TEST(TestWchar16Output); + UNIT_TEST(TestWchar32Output); + UNIT_TEST(TestUtf16StingOutputByChars); UNIT_TEST_SUITE_END(); public: @@ -45,9 +45,9 @@ public: void TestWtrokaOutput(); void TestIStreamOperators(); void TestReadTo(); - void TestWchar16Output(); - void TestWchar32Output(); - void TestUtf16StingOutputByChars(); + void TestWchar16Output(); + void TestWchar32Output(); + void TestUtf16StingOutputByChars(); }; UNIT_TEST_SUITE_REGISTRATION(TStreamsTest); @@ -450,48 +450,48 @@ void TStreamsTest::TestWtrokaOutput() { UNIT_ASSERT(s == Text); } - -void TStreamsTest::TestWchar16Output() { - TString s; - TStringOutput os(s); - os << wchar16(97); // latin a + +void TStreamsTest::TestWchar16Output() { + TString s; + TStringOutput os(s); + os << wchar16(97); // latin a os << u'\u044E'; // cyrillic ю - os << u'я'; - os << wchar16(0xD801); // high surrogate is printed as replacement character U+FFFD - os << u'b'; - + os << u'я'; + os << wchar16(0xD801); // high surrogate is printed as replacement character U+FFFD + os << u'b'; + UNIT_ASSERT_VALUES_EQUAL(s, "aюя" "\xEF\xBF\xBD" "b"); -} - -void TStreamsTest::TestWchar32Output() { - TString s; - TStringOutput os(s); - os << wchar32(97); // latin a +} + +void TStreamsTest::TestWchar32Output() { + TString s; + TStringOutput os(s); + os << wchar32(97); // latin a os << U'\u044E'; // cyrillic ю - os << U'я'; - os << U'\U0001F600'; // grinning face - os << u'b'; - + os << U'я'; + os << U'\U0001F600'; // grinning face + os << u'b'; + UNIT_ASSERT_VALUES_EQUAL(s, "aюя" "\xF0\x9F\x98\x80" "b"); -} - -void TStreamsTest::TestUtf16StingOutputByChars() { - TString s = "\xd1\x87\xd0\xb8\xd1\x81\xd1\x82\xd0\xb8\xd1\x87\xd0\xb8\xd1\x81\xd1\x82\xd0\xb8"; - TUtf16String w = UTF8ToWide(s); - - UNIT_ASSERT_VALUES_EQUAL(w.size(), 10); - - TStringStream stream0; - stream0 << w; - UNIT_ASSERT_VALUES_EQUAL(stream0.Str(), s); - - TStringStream stream1; - for (size_t i = 0; i < 10; i++) { - stream1 << w[i]; - } - UNIT_ASSERT_VALUES_EQUAL(stream1.Str(), s); -} +} + +void TStreamsTest::TestUtf16StingOutputByChars() { + TString s = "\xd1\x87\xd0\xb8\xd1\x81\xd1\x82\xd0\xb8\xd1\x87\xd0\xb8\xd1\x81\xd1\x82\xd0\xb8"; + TUtf16String w = UTF8ToWide(s); + + UNIT_ASSERT_VALUES_EQUAL(w.size(), 10); + + TStringStream stream0; + stream0 << w; + UNIT_ASSERT_VALUES_EQUAL(stream0.Str(), s); + + TStringStream stream1; + for (size_t i = 0; i < 10; i++) { + stream1 << w[i]; + } + UNIT_ASSERT_VALUES_EQUAL(stream1.Str(), s); +} |