From: Jarkko Hietaniemi Date: Mon, 3 Dec 2001 22:02:52 +0000 (+0000) Subject: Test::Morify UCD.t X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f5c9f3dbd8338a2e17750f09d0bb2f9d0feebecc;p=p5sagit%2Fp5-mst-13.2.git Test::Morify UCD.t p4raw-id: //depot/perl@13444 --- diff --git a/lib/Unicode/UCD.t b/lib/Unicode/UCD.t index 1bed138..5b1f36e 100644 --- a/lib/Unicode/UCD.t +++ b/lib/Unicode/UCD.t @@ -9,7 +9,7 @@ BEGIN { use strict; use Unicode::UCD; -use Test; +use Test::More; BEGIN { plan tests => 162 }; @@ -19,223 +19,223 @@ my $charinfo; $charinfo = charinfo(0x41); -ok($charinfo->{code}, '0041'); -ok($charinfo->{name}, 'LATIN CAPITAL LETTER A'); -ok($charinfo->{category}, 'Lu'); -ok($charinfo->{combining}, '0'); -ok($charinfo->{bidi}, 'L'); -ok($charinfo->{decomposition}, ''); -ok($charinfo->{decimal}, ''); -ok($charinfo->{digit}, ''); -ok($charinfo->{numeric}, ''); -ok($charinfo->{mirrored}, 'N'); -ok($charinfo->{unicode10}, ''); -ok($charinfo->{comment}, ''); -ok($charinfo->{upper}, ''); -ok($charinfo->{lower}, '0061'); -ok($charinfo->{title}, ''); -ok($charinfo->{block}, 'Basic Latin'); -ok($charinfo->{script}, 'Latin'); +is($charinfo->{code}, '0041', 'LATIN CAPITAL LETTER A'); +is($charinfo->{name}, 'LATIN CAPITAL LETTER A'); +is($charinfo->{category}, 'Lu'); +is($charinfo->{combining}, '0'); +is($charinfo->{bidi}, 'L'); +is($charinfo->{decomposition}, ''); +is($charinfo->{decimal}, ''); +is($charinfo->{digit}, ''); +is($charinfo->{numeric}, ''); +is($charinfo->{mirrored}, 'N'); +is($charinfo->{unicode10}, ''); +is($charinfo->{comment}, ''); +is($charinfo->{upper}, ''); +is($charinfo->{lower}, '0061'); +is($charinfo->{title}, ''); +is($charinfo->{block}, 'Basic Latin'); +is($charinfo->{script}, 'Latin'); $charinfo = charinfo(0x100); -ok($charinfo->{code}, '0100'); -ok($charinfo->{name}, 'LATIN CAPITAL LETTER A WITH MACRON'); -ok($charinfo->{category}, 'Lu'); -ok($charinfo->{combining}, '0'); -ok($charinfo->{bidi}, 'L'); -ok($charinfo->{decomposition}, '0041 0304'); -ok($charinfo->{decimal}, ''); -ok($charinfo->{digit}, ''); -ok($charinfo->{numeric}, ''); -ok($charinfo->{mirrored}, 'N'); -ok($charinfo->{unicode10}, 'LATIN CAPITAL LETTER A MACRON'); -ok($charinfo->{comment}, ''); -ok($charinfo->{upper}, ''); -ok($charinfo->{lower}, '0101'); -ok($charinfo->{title}, ''); -ok($charinfo->{block}, 'Latin Extended-A'); -ok($charinfo->{script}, 'Latin'); +is($charinfo->{code}, '0100', 'LATIN CAPITAL LETTER A WITH MACRON'); +is($charinfo->{name}, 'LATIN CAPITAL LETTER A WITH MACRON'); +is($charinfo->{category}, 'Lu'); +is($charinfo->{combining}, '0'); +is($charinfo->{bidi}, 'L'); +is($charinfo->{decomposition}, '0041 0304'); +is($charinfo->{decimal}, ''); +is($charinfo->{digit}, ''); +is($charinfo->{numeric}, ''); +is($charinfo->{mirrored}, 'N'); +is($charinfo->{unicode10}, 'LATIN CAPITAL LETTER A MACRON'); +is($charinfo->{comment}, ''); +is($charinfo->{upper}, ''); +is($charinfo->{lower}, '0101'); +is($charinfo->{title}, ''); +is($charinfo->{block}, 'Latin Extended-A'); +is($charinfo->{script}, 'Latin'); # 0x0590 is in the Hebrew block but unused. $charinfo = charinfo(0x590); -ok($charinfo->{code}, undef); -ok($charinfo->{name}, undef); -ok($charinfo->{category}, undef); -ok($charinfo->{combining}, undef); -ok($charinfo->{bidi}, undef); -ok($charinfo->{decomposition}, undef); -ok($charinfo->{decimal}, undef); -ok($charinfo->{digit}, undef); -ok($charinfo->{numeric}, undef); -ok($charinfo->{mirrored}, undef); -ok($charinfo->{unicode10}, undef); -ok($charinfo->{comment}, undef); -ok($charinfo->{upper}, undef); -ok($charinfo->{lower}, undef); -ok($charinfo->{title}, undef); -ok($charinfo->{block}, undef); -ok($charinfo->{script}, undef); +is($charinfo->{code}, undef, '0x0590 - unused Hebrew'); +is($charinfo->{name}, undef); +is($charinfo->{category}, undef); +is($charinfo->{combining}, undef); +is($charinfo->{bidi}, undef); +is($charinfo->{decomposition}, undef); +is($charinfo->{decimal}, undef); +is($charinfo->{digit}, undef); +is($charinfo->{numeric}, undef); +is($charinfo->{mirrored}, undef); +is($charinfo->{unicode10}, undef); +is($charinfo->{comment}, undef); +is($charinfo->{upper}, undef); +is($charinfo->{lower}, undef); +is($charinfo->{title}, undef); +is($charinfo->{block}, undef); +is($charinfo->{script}, undef); # 0x05d0 is in the Hebrew block and used. $charinfo = charinfo(0x5d0); -ok($charinfo->{code}, '05D0'); -ok($charinfo->{name}, 'HEBREW LETTER ALEF'); -ok($charinfo->{category}, 'Lo'); -ok($charinfo->{combining}, '0'); -ok($charinfo->{bidi}, 'R'); -ok($charinfo->{decomposition}, ''); -ok($charinfo->{decimal}, ''); -ok($charinfo->{digit}, ''); -ok($charinfo->{numeric}, ''); -ok($charinfo->{mirrored}, 'N'); -ok($charinfo->{unicode10}, ''); -ok($charinfo->{comment}, ''); -ok($charinfo->{upper}, ''); -ok($charinfo->{lower}, ''); -ok($charinfo->{title}, ''); -ok($charinfo->{block}, 'Hebrew'); -ok($charinfo->{script}, 'Hebrew'); +is($charinfo->{code}, '05D0', '05D0 - used Hebrew'); +is($charinfo->{name}, 'HEBREW LETTER ALEF'); +is($charinfo->{category}, 'Lo'); +is($charinfo->{combining}, '0'); +is($charinfo->{bidi}, 'R'); +is($charinfo->{decomposition}, ''); +is($charinfo->{decimal}, ''); +is($charinfo->{digit}, ''); +is($charinfo->{numeric}, ''); +is($charinfo->{mirrored}, 'N'); +is($charinfo->{unicode10}, ''); +is($charinfo->{comment}, ''); +is($charinfo->{upper}, ''); +is($charinfo->{lower}, ''); +is($charinfo->{title}, ''); +is($charinfo->{block}, 'Hebrew'); +is($charinfo->{script}, 'Hebrew'); # An open syllable in Hangul. $charinfo = charinfo(0xAC00); -ok($charinfo->{code}, 'AC00'); -ok($charinfo->{name}, 'HANGUL SYLLABLE-AC00'); -ok($charinfo->{category}, 'Lo'); -ok($charinfo->{combining}, '0'); -ok($charinfo->{bidi}, 'L'); -ok($charinfo->{decomposition}, undef); -ok($charinfo->{decimal}, ''); -ok($charinfo->{digit}, ''); -ok($charinfo->{numeric}, ''); -ok($charinfo->{mirrored}, 'N'); -ok($charinfo->{unicode10}, ''); -ok($charinfo->{comment}, ''); -ok($charinfo->{upper}, ''); -ok($charinfo->{lower}, ''); -ok($charinfo->{title}, ''); -ok($charinfo->{block}, 'Hangul Syllables'); -ok($charinfo->{script}, 'Hangul'); +is($charinfo->{code}, 'AC00', 'HANGUL SYLLABLE-AC00'); +is($charinfo->{name}, 'HANGUL SYLLABLE-AC00'); +is($charinfo->{category}, 'Lo'); +is($charinfo->{combining}, '0'); +is($charinfo->{bidi}, 'L'); +is($charinfo->{decomposition}, undef); +is($charinfo->{decimal}, ''); +is($charinfo->{digit}, ''); +is($charinfo->{numeric}, ''); +is($charinfo->{mirrored}, 'N'); +is($charinfo->{unicode10}, ''); +is($charinfo->{comment}, ''); +is($charinfo->{upper}, ''); +is($charinfo->{lower}, ''); +is($charinfo->{title}, ''); +is($charinfo->{block}, 'Hangul Syllables'); +is($charinfo->{script}, 'Hangul'); # A closed syllable in Hangul. $charinfo = charinfo(0xAE00); -ok($charinfo->{code}, 'AE00'); -ok($charinfo->{name}, 'HANGUL SYLLABLE-AE00'); -ok($charinfo->{category}, 'Lo'); -ok($charinfo->{combining}, '0'); -ok($charinfo->{bidi}, 'L'); -ok($charinfo->{decomposition}, undef); -ok($charinfo->{decimal}, ''); -ok($charinfo->{digit}, ''); -ok($charinfo->{numeric}, ''); -ok($charinfo->{mirrored}, 'N'); -ok($charinfo->{unicode10}, ''); -ok($charinfo->{comment}, ''); -ok($charinfo->{upper}, ''); -ok($charinfo->{lower}, ''); -ok($charinfo->{title}, ''); -ok($charinfo->{block}, 'Hangul Syllables'); -ok($charinfo->{script}, 'Hangul'); +is($charinfo->{code}, 'AE00', 'HANGUL SYLLABLE-AE00'); +is($charinfo->{name}, 'HANGUL SYLLABLE-AE00'); +is($charinfo->{category}, 'Lo'); +is($charinfo->{combining}, '0'); +is($charinfo->{bidi}, 'L'); +is($charinfo->{decomposition}, undef); +is($charinfo->{decimal}, ''); +is($charinfo->{digit}, ''); +is($charinfo->{numeric}, ''); +is($charinfo->{mirrored}, 'N'); +is($charinfo->{unicode10}, ''); +is($charinfo->{comment}, ''); +is($charinfo->{upper}, ''); +is($charinfo->{lower}, ''); +is($charinfo->{title}, ''); +is($charinfo->{block}, 'Hangul Syllables'); +is($charinfo->{script}, 'Hangul'); $charinfo = charinfo(0x1D400); -ok($charinfo->{code}, '1D400'); -ok($charinfo->{name}, 'MATHEMATICAL BOLD CAPITAL A'); -ok($charinfo->{category}, 'Lu'); -ok($charinfo->{combining}, '0'); -ok($charinfo->{bidi}, 'L'); -ok($charinfo->{decomposition}, ' 0041'); -ok($charinfo->{decimal}, ''); -ok($charinfo->{digit}, ''); -ok($charinfo->{numeric}, ''); -ok($charinfo->{mirrored}, 'N'); -ok($charinfo->{unicode10}, ''); -ok($charinfo->{comment}, ''); -ok($charinfo->{upper}, ''); -ok($charinfo->{lower}, ''); -ok($charinfo->{title}, ''); -ok($charinfo->{block}, 'Mathematical Alphanumeric Symbols'); -ok($charinfo->{script}, undef); +is($charinfo->{code}, '1D400', 'MATHEMATICAL BOLD CAPITAL A'); +is($charinfo->{name}, 'MATHEMATICAL BOLD CAPITAL A'); +is($charinfo->{category}, 'Lu'); +is($charinfo->{combining}, '0'); +is($charinfo->{bidi}, 'L'); +is($charinfo->{decomposition}, ' 0041'); +is($charinfo->{decimal}, ''); +is($charinfo->{digit}, ''); +is($charinfo->{numeric}, ''); +is($charinfo->{mirrored}, 'N'); +is($charinfo->{unicode10}, ''); +is($charinfo->{comment}, ''); +is($charinfo->{upper}, ''); +is($charinfo->{lower}, ''); +is($charinfo->{title}, ''); +is($charinfo->{block}, 'Mathematical Alphanumeric Symbols'); +is($charinfo->{script}, undef); use Unicode::UCD qw(charblock charscript); # 0x0590 is in the Hebrew block but unused. -ok(charblock(0x590), 'Hebrew'); -ok(charscript(0x590), undef); +is(charblock(0x590), 'Hebrew', '0x0590 - Hebrew unused charblock'); +is(charscript(0x590), undef, '0x0590 - Hebrew unused charscript'); $charinfo = charinfo(0xbe); -ok($charinfo->{code}, '00BE'); -ok($charinfo->{name}, 'VULGAR FRACTION THREE QUARTERS'); -ok($charinfo->{category}, 'No'); -ok($charinfo->{combining}, '0'); -ok($charinfo->{bidi}, 'ON'); -ok($charinfo->{decomposition}, ' 0033 2044 0034'); -ok($charinfo->{decimal}, ''); -ok($charinfo->{digit}, ''); -ok($charinfo->{numeric}, '3/4'); -ok($charinfo->{mirrored}, 'N'); -ok($charinfo->{unicode10}, 'FRACTION THREE QUARTERS'); -ok($charinfo->{comment}, ''); -ok($charinfo->{upper}, ''); -ok($charinfo->{lower}, ''); -ok($charinfo->{title}, ''); -ok($charinfo->{block}, 'Latin-1 Supplement'); -ok($charinfo->{script}, undef); +is($charinfo->{code}, '00BE', 'VULGAR FRACTION THREE QUARTERS'); +is($charinfo->{name}, 'VULGAR FRACTION THREE QUARTERS'); +is($charinfo->{category}, 'No'); +is($charinfo->{combining}, '0'); +is($charinfo->{bidi}, 'ON'); +is($charinfo->{decomposition}, ' 0033 2044 0034'); +is($charinfo->{decimal}, ''); +is($charinfo->{digit}, ''); +is($charinfo->{numeric}, '3/4'); +is($charinfo->{mirrored}, 'N'); +is($charinfo->{unicode10}, 'FRACTION THREE QUARTERS'); +is($charinfo->{comment}, ''); +is($charinfo->{upper}, ''); +is($charinfo->{lower}, ''); +is($charinfo->{title}, ''); +is($charinfo->{block}, 'Latin-1 Supplement'); +is($charinfo->{script}, undef); use Unicode::UCD qw(charblocks charscripts); my $charblocks = charblocks(); -ok(exists $charblocks->{Thai}); -ok($charblocks->{Thai}->[0]->[0], hex('0e00')); -ok(!exists $charblocks->{PigLatin}); +ok(exists $charblocks->{Thai}, 'Thai charblock exists'); +is($charblocks->{Thai}->[0]->[0], hex('0e00')); +ok(!exists $charblocks->{PigLatin}, 'PigLatin charblock does not exist'); my $charscripts = charscripts(); -ok(exists $charscripts->{Armenian}); -ok($charscripts->{Armenian}->[0]->[0], hex('0531')); -ok(!exists $charscripts->{PigLatin}); +ok(exists $charscripts->{Armenian}, 'Armenian charscript exists'); +is($charscripts->{Armenian}->[0]->[0], hex('0531')); +ok(!exists $charscripts->{PigLatin}, 'PigLatin charscript does not exist'); my $charscript; $charscript = charscript("12ab"); -ok($charscript, 'Ethiopic'); +is($charscript, 'Ethiopic', 'Ethiopic charscript'); $charscript = charscript("0x12ab"); -ok($charscript, 'Ethiopic'); +is($charscript, 'Ethiopic'); $charscript = charscript("U+12ab"); -ok($charscript, 'Ethiopic'); +is($charscript, 'Ethiopic'); my $ranges; $ranges = charscript('Ogham'); -ok($ranges->[0]->[0], hex('1681')); -ok($ranges->[0]->[1], hex('169a')); +is($ranges->[0]->[0], hex('1681'), 'Ogham charscript'); +is($ranges->[0]->[1], hex('169a')); use Unicode::UCD qw(charinrange); $ranges = charscript('Cherokee'); -ok(!charinrange($ranges, "139f")); +ok(!charinrange($ranges, "139f"), 'Cherokee charscript'); ok( charinrange($ranges, "13a0")); ok( charinrange($ranges, "13f4")); ok(!charinrange($ranges, "13f5")); -ok(Unicode::UCD::UnicodeVersion, '3.1.1'); +is(Unicode::UCD::UnicodeVersion, '3.1.1', 'UnicodeVersion'); use Unicode::UCD qw(compexcl); -ok(!compexcl(0x0100)); +ok(!compexcl(0x0100), 'compexcl'); ok( compexcl(0x0958)); use Unicode::UCD qw(casefold); @@ -246,13 +246,13 @@ $casefold = casefold(0x41); ok($casefold->{code} eq '0041' && $casefold->{status} eq 'C' && - $casefold->{mapping} eq '0061'); + $casefold->{mapping} eq '0061', 'casefold 0x41'); $casefold = casefold(0xdf); ok($casefold->{code} eq '00DF' && $casefold->{status} eq 'F' && - $casefold->{mapping} eq '0073 0073'); + $casefold->{mapping} eq '0073 0073', 'casefold 0xDF'); ok(!casefold(0x20)); @@ -268,7 +268,7 @@ ok($casespec->{code} eq '00DF' && $casespec->{lower} eq '00DF' && $casespec->{title} eq '0053 0073' && $casespec->{upper} eq '0053 0053' && - $casespec->{condition} eq undef); + $casespec->{condition} eq undef, 'casespec 0xDF'); $casespec = casespec(0x307); @@ -276,4 +276,5 @@ ok($casespec->{az}->{code} eq '0307' && $casespec->{az}->{lower} eq '' && $casespec->{az}->{title} eq '0307' && $casespec->{az}->{upper} eq '0307' && - $casespec->{az}->{condition} eq 'az AFTER_i NOT_MORE_ABOVE'); + $casespec->{az}->{condition} eq 'az AFTER_i NOT_MORE_ABOVE', + 'casespec 0x307');