summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Tests/LibUnicode/TestUnicodeCharacterTypes.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/Tests/LibUnicode/TestUnicodeCharacterTypes.cpp b/Tests/LibUnicode/TestUnicodeCharacterTypes.cpp
index 3214acc237..20499d425f 100644
--- a/Tests/LibUnicode/TestUnicodeCharacterTypes.cpp
+++ b/Tests/LibUnicode/TestUnicodeCharacterTypes.cpp
@@ -579,6 +579,43 @@ TEST_CASE(script)
}
}
+TEST_CASE(block)
+{
+ auto block = [](StringView name) {
+ auto block = Unicode::block_from_string(name);
+ VERIFY(block.has_value());
+ return *block;
+ };
+
+ auto no_block = block("No_Block"sv);
+ auto block_nb = block("NB"sv);
+ EXPECT_EQ(no_block, block_nb);
+
+ auto block_basic_latin = block("Basic_Latin"sv);
+ auto block_ascii = block("ASCII"sv);
+ EXPECT_EQ(block_basic_latin, block_ascii);
+
+ auto block_greek_coptic = block("Greek_And_Coptic"sv);
+ auto block_greek = block("Greek"sv);
+ EXPECT_EQ(block_greek_coptic, block_greek);
+
+ auto block_variation = block("Variation_Selectors_Supplement"sv);
+ auto block_vs_sup = block("VS_Sup"sv);
+ EXPECT_EQ(block_variation, block_vs_sup);
+
+ for (u32 code_point = 0x0000; code_point <= 0x007F; ++code_point)
+ EXPECT(Unicode::code_point_has_block(code_point, block_basic_latin));
+
+ for (u32 code_point = 0xE0100; code_point <= 0xE01EF; ++code_point)
+ EXPECT(Unicode::code_point_has_block(code_point, block_variation));
+
+ for (u32 code_point = 0x0000; code_point <= 0x007F; ++code_point)
+ EXPECT_EQ("Basic Latin"sv, Unicode::code_point_block_display_name(code_point).value());
+
+ for (u32 code_point = 0x0370; code_point <= 0x03FF; ++code_point)
+ EXPECT_EQ("Greek and Coptic"sv, Unicode::code_point_block_display_name(code_point).value());
+}
+
TEST_CASE(script_extension)
{
auto script = [](StringView name) {