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

Method TestGetNumOfUTF8Chars

util/charset/wide_ut.cpp:590–607  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

588}
589
590void TConversionTest::TestGetNumOfUTF8Chars() {
591 size_t n = 0;
592 bool result = GetNumberOfUTF8Chars(Utf8Text_.c_str(), Utf8Text_.size(), n);
593 UNIT_ASSERT(result);
594 UNIT_ASSERT(n == 256);
595
596 n = 0;
597 result = GetNumberOfUTF8Chars(utext, 5, n);
598 UNIT_ASSERT(!result);
599 UNIT_ASSERT(n == 2);
600
601 n = 0;
602 result = GetNumberOfUTF8Chars(utext, 1, n);
603 UNIT_ASSERT(!result);
604 UNIT_ASSERT(n == 0);
605
606 UNIT_ASSERT_EQUAL(GetNumberOfUTF8Chars("привет!"), 7);
607}
608
609void TConversionTest::TestSubstrUTF8() {
610 TStringBuf utextBuf(utext, sizeof(utext));

Callers

nothing calls this directly

Calls 3

GetNumberOfUTF8CharsFunction · 0.85
c_strMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected