diff options
author | Timothy Flynn <trflynn89@pm.me> | 2023-01-16 10:33:15 -0500 |
---|---|---|
committer | Tim Flynn <trflynn89@pm.me> | 2023-01-16 18:33:44 -0500 |
commit | b562348d316cbd3a646f33490809c356c591265d (patch) | |
tree | 48a366057f2108859fa6d0da93b9729ee84b331d /Tests | |
parent | 6d710eeb431d4fc729e4692ac8db4270183cd039 (diff) | |
download | serenity-b562348d316cbd3a646f33490809c356c591265d.zip |
LibUnicode: Generate simple case folding mappings for titlecase
Note we already generate the special case foldings for titlecase.
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/LibUnicode/TestUnicodeCharacterTypes.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Tests/LibUnicode/TestUnicodeCharacterTypes.cpp b/Tests/LibUnicode/TestUnicodeCharacterTypes.cpp index d6eb43e103..dd6f5c4654 100644 --- a/Tests/LibUnicode/TestUnicodeCharacterTypes.cpp +++ b/Tests/LibUnicode/TestUnicodeCharacterTypes.cpp @@ -48,6 +48,32 @@ TEST_CASE(to_unicode_uppercase) EXPECT_EQ(Unicode::to_unicode_uppercase(0x3401u), 0x3401u); EXPECT_EQ(Unicode::to_unicode_uppercase(0x3402u), 0x3402u); EXPECT_EQ(Unicode::to_unicode_uppercase(0x4dbfu), 0x4dbfu); + + // Code points whose uppercase and titlecase mappings actually differ. + EXPECT_EQ(Unicode::to_unicode_uppercase(0x01c6u), 0x01c4u); // "dž" to "DŽ" + EXPECT_EQ(Unicode::to_unicode_uppercase(0x01c9u), 0x01c7u); // "lj" to "LJ" + EXPECT_EQ(Unicode::to_unicode_uppercase(0x01ccu), 0x01cau); // "nj" to "NJ" + EXPECT_EQ(Unicode::to_unicode_uppercase(0x01f3u), 0x01f1u); // "dz" to "DZ" +} + +TEST_CASE(to_unicode_titlecase) +{ + compare_to_ascii(toupper, Unicode::to_unicode_titlecase); + + EXPECT_EQ(Unicode::to_unicode_titlecase(0x03c9u), 0x03a9u); // "ω" to "Ω" + EXPECT_EQ(Unicode::to_unicode_titlecase(0x03a9u), 0x03a9u); // "Ω" to "Ω" + + // Code points encoded by ranges in UnicodeData.txt + EXPECT_EQ(Unicode::to_unicode_titlecase(0x3400u), 0x3400u); + EXPECT_EQ(Unicode::to_unicode_titlecase(0x3401u), 0x3401u); + EXPECT_EQ(Unicode::to_unicode_titlecase(0x3402u), 0x3402u); + EXPECT_EQ(Unicode::to_unicode_titlecase(0x4dbfu), 0x4dbfu); + + // Code points whose uppercase and titlecase mappings actually differ. + EXPECT_EQ(Unicode::to_unicode_titlecase(0x01c6u), 0x01c5u); // "dž" to "Dž" + EXPECT_EQ(Unicode::to_unicode_titlecase(0x01c9u), 0x01c8u); // "lj" to "Lj" + EXPECT_EQ(Unicode::to_unicode_titlecase(0x01ccu), 0x01cbu); // "nj" to "Nj" + EXPECT_EQ(Unicode::to_unicode_titlecase(0x01f3u), 0x01f2u); // "dz" to "Dz" } TEST_CASE(to_unicode_lowercase_unconditional_special_casing) |