mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Add tests for str_utf8_to_skeleton
This commit is contained in:
parent
dab6bbf4fd
commit
0bf31c671e
|
@ -73,6 +73,34 @@ TEST(Str, Utf8CompConfusables)
|
|||
EXPECT_TRUE(str_utf8_comp_confusable("aceiou", "ąçęįǫų") == 0);
|
||||
}
|
||||
|
||||
TEST(Str, Utf8ToSkeleton)
|
||||
{
|
||||
int aBuf[32];
|
||||
EXPECT_EQ(str_utf8_to_skeleton("abc", aBuf, 0), 0);
|
||||
EXPECT_EQ(str_utf8_to_skeleton("", aBuf, std::size(aBuf)), 0);
|
||||
EXPECT_EQ(str_utf8_to_skeleton("abc", aBuf, std::size(aBuf)), 3);
|
||||
EXPECT_EQ(aBuf[0], 'a');
|
||||
EXPECT_EQ(aBuf[1], 'b');
|
||||
EXPECT_EQ(aBuf[2], 'c');
|
||||
EXPECT_EQ(str_utf8_to_skeleton("m", aBuf, std::size(aBuf)), 2);
|
||||
EXPECT_EQ(aBuf[0], 'r');
|
||||
EXPECT_EQ(aBuf[1], 'n');
|
||||
EXPECT_EQ(str_utf8_to_skeleton("rn", aBuf, std::size(aBuf)), 2);
|
||||
EXPECT_EQ(aBuf[0], 'r');
|
||||
EXPECT_EQ(aBuf[1], 'n');
|
||||
EXPECT_EQ(str_utf8_to_skeleton("ӏ", aBuf, std::size(aBuf)), 1); // CYRILLIC SMALL LETTER PALOCHKA
|
||||
EXPECT_EQ(aBuf[0], 'i');
|
||||
EXPECT_EQ(str_utf8_to_skeleton("¡", aBuf, std::size(aBuf)), 1); // INVERTED EXCLAMATION MARK
|
||||
EXPECT_EQ(aBuf[0], 'i');
|
||||
EXPECT_EQ(str_utf8_to_skeleton("ąçęįǫų", aBuf, std::size(aBuf)), 6);
|
||||
EXPECT_EQ(aBuf[0], 'a');
|
||||
EXPECT_EQ(aBuf[1], 'c');
|
||||
EXPECT_EQ(aBuf[2], 'e');
|
||||
EXPECT_EQ(aBuf[3], 'i');
|
||||
EXPECT_EQ(aBuf[4], 'o');
|
||||
EXPECT_EQ(aBuf[5], 'u');
|
||||
}
|
||||
|
||||
TEST(Str, Utf8ToLower)
|
||||
{
|
||||
EXPECT_TRUE(str_utf8_tolower('A') == 'a');
|
||||
|
|
Loading…
Reference in a new issue