Tests: Add Unicode tests for CharacterType block properties

This commit is contained in:
thankyouverycool 2022-02-13 13:44:51 -05:00 committed by Tim Flynn
parent 0505e031f1
commit 5658524aa3
Notes: sideshowbarker 2024-07-17 18:45:43 +09:00

View File

@ -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) TEST_CASE(script_extension)
{ {
auto script = [](StringView name) { auto script = [](StringView name) {