Add more tests for str_utf8_comp_confusable

Also check first string being shorter than second string. And check strings with equal and unequal prefix and suffix.
This commit is contained in:
Robert Müller 2022-10-30 11:43:10 +01:00
parent ab42651dc7
commit dab6bbf4fd

View file

@ -58,6 +58,15 @@ TEST(Str, Utf8CompConfusables)
{
EXPECT_TRUE(str_utf8_comp_confusable("abc", "abc") == 0);
EXPECT_TRUE(str_utf8_comp_confusable("rn", "m") == 0);
EXPECT_TRUE(str_utf8_comp_confusable("m", "rn") == 0);
EXPECT_TRUE(str_utf8_comp_confusable("rna", "ma") == 0);
EXPECT_TRUE(str_utf8_comp_confusable("ma", "rna") == 0);
EXPECT_FALSE(str_utf8_comp_confusable("mA", "rna") == 0);
EXPECT_FALSE(str_utf8_comp_confusable("ma", "rnA") == 0);
EXPECT_TRUE(str_utf8_comp_confusable("arn", "am") == 0);
EXPECT_TRUE(str_utf8_comp_confusable("am", "arn") == 0);
EXPECT_FALSE(str_utf8_comp_confusable("Am", "arn") == 0);
EXPECT_FALSE(str_utf8_comp_confusable("am", "Arn") == 0);
EXPECT_TRUE(str_utf8_comp_confusable("l", "ӏ") == 0); // CYRILLIC SMALL LETTER PALOCHKA
EXPECT_TRUE(str_utf8_comp_confusable("i", "¡") == 0); // INVERTED EXCLAMATION MARK
EXPECT_FALSE(str_utf8_comp_confusable("o", "x") == 0);