Tests: Add Unicode tests for CharacterType block properties
This commit is contained in:
parent
0505e031f1
commit
5658524aa3
Notes:
sideshowbarker
2024-07-17 18:45:43 +09:00
Author: https://github.com/thankyouverycool Commit: https://github.com/SerenityOS/serenity/commit/5658524aa3 Pull-request: https://github.com/SerenityOS/serenity/pull/12504 Reviewed-by: https://github.com/trflynn89 ✅
1 changed files with 37 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue