MCPcopy Create free account
hub / github.com/catboost/catboost / TestWideString

Method TestWideString

util/charset/wide_ut.cpp:936–974  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

934 }
935
936 void TestWideString() {
937 const TUtf16String original = UTF32ToWide(WideStringTestData[0], CaseTestDataSize);
938 const TUtf16String lower = UTF32ToWide(WideStringTestData[1], CaseTestDataSize);
939 const TUtf16String upper = UTF32ToWide(WideStringTestData[2], CaseTestDataSize);
940 const TUtf16String title = UTF32ToWide(WideStringTestData[3], CaseTestDataSize);
941 TUtf16String temp;
942
943 temp = original;
944 temp.to_lower();
945 UNIT_ASSERT(temp == lower);
946
947 temp = original;
948 ToLower(temp.begin(), temp.size());
949 UNIT_ASSERT(temp == lower);
950
951 temp = original;
952 temp.to_upper();
953 UNIT_ASSERT(temp == upper);
954
955 temp = original;
956 ToUpper(temp.begin(), temp.size());
957 UNIT_ASSERT(temp == upper);
958
959 temp = original;
960 temp.to_title();
961 UNIT_ASSERT(temp == title);
962
963 temp = original;
964 ToTitle(temp.begin(), temp.size());
965 UNIT_ASSERT(temp == title);
966
967 TVector<wchar32> buffer(WideStringTestData[0], WideStringTestData[0] + CaseTestDataSize);
968 std::reverse(buffer.begin(), buffer.end());
969 const TUtf16String reversed = UTF32ToWide(buffer.data(), buffer.size());
970
971 temp = original;
972 ReverseInPlace(temp);
973 UNIT_ASSERT(temp == reversed);
974 }
975
976 void TestCountWideChars() {
977 UNIT_ASSERT_EQUAL(CountWideChars(UTF8ToWide("привет!")), 7);

Callers

nothing calls this directly

Calls 13

UTF32ToWideFunction · 0.85
ToLowerFunction · 0.70
ToUpperFunction · 0.70
ToTitleFunction · 0.70
reverseFunction · 0.50
ReverseInPlaceFunction · 0.50
to_lowerMethod · 0.45
beginMethod · 0.45
sizeMethod · 0.45
to_upperMethod · 0.45
to_titleMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected