summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2021-09-05 15:09:03 -0400
committerLinus Groh <mail@linusgroh.de>2021-09-06 15:24:27 +0100
commit50158abaf196e23e5996646bfc1b42f8ca0d3764 (patch)
tree47bc7311afc1d10dfc3f473a249d8102e59abdb8 /Tests
parent436faf9fd97c4d595bb1dc7a47585cc876b19da8 (diff)
downloadserenity-50158abaf196e23e5996646bfc1b42f8ca0d3764.zip
LibUnicode: Implement locale-aware BEFORE_DOT special casing
Note that the algorithm in the Unicode spec is for checking that a code point precedes U+0307, but the special casing condition NotBeforeDot is interested in the inverse of this rule.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/LibUnicode/TestUnicodeCharacterTypes.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/Tests/LibUnicode/TestUnicodeCharacterTypes.cpp b/Tests/LibUnicode/TestUnicodeCharacterTypes.cpp
index e53b951945..c20f0e4849 100644
--- a/Tests/LibUnicode/TestUnicodeCharacterTypes.cpp
+++ b/Tests/LibUnicode/TestUnicodeCharacterTypes.cpp
@@ -243,6 +243,29 @@ TEST_CASE(to_unicode_lowercase_special_casing_more_above)
EXPECT_EQ(result, "\u012f\u0307\u0300"sv);
}
+TEST_CASE(to_unicode_lowercase_special_casing_not_before_dot)
+{
+ // LATIN CAPITAL LETTER I
+ auto result = Unicode::to_unicode_lowercase_full("I"sv, "en"sv);
+ EXPECT_EQ(result, "i"sv);
+
+ result = Unicode::to_unicode_lowercase_full("I"sv, "az"sv);
+ EXPECT_EQ(result, "\u0131"sv);
+
+ result = Unicode::to_unicode_lowercase_full("I"sv, "tr"sv);
+ EXPECT_EQ(result, "\u0131"sv);
+
+ // LATIN CAPITAL LETTER I followed by COMBINING DOT ABOVE
+ result = Unicode::to_unicode_lowercase_full("I\u0307"sv, "en"sv);
+ EXPECT_EQ(result, "i\u0307"sv);
+
+ result = Unicode::to_unicode_lowercase_full("I\u0307"sv, "az"sv);
+ EXPECT_EQ(result, "i"sv);
+
+ result = Unicode::to_unicode_lowercase_full("I\u0307"sv, "tr"sv);
+ EXPECT_EQ(result, "i"sv);
+}
+
TEST_CASE(to_unicode_uppercase_unconditional_special_casing)
{
// LATIN SMALL LETTER SHARP S