diff options
author | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2010-11-23 19:12:21 +0000 |
---|---|---|
committer | Chris 'BinGOs' Williams <chris@bingosnet.co.uk> | 2010-11-23 19:14:22 +0000 |
commit | 68adb2b0c592afeb71b5a6a4f15af308d54a0db4 (patch) | |
tree | efad211919b5983309ef8c9beff5be20d6eea0cb /cpan/Unicode-Collate | |
parent | 0f8e99e6b6437e33cba24699aefea8b17ce0bfc6 (diff) | |
download | perl-68adb2b0c592afeb71b5a6a4f15af308d54a0db4.tar.gz |
Update Unicode-Collate to CPAN version 0.68
[DELTA]
0.68 Tue Nov 23 20:17:22 2010
- doc: clarified about (backwards => [ ]) and (backwards => undef).
- separated t/backwds.t from t/test.t.
- added cjk_b5.t, cjk_gb.t, cjk_ja.t, cjk_ko.t, cjk_py.t, cjk_st.t in t
for CJK/*.pm without Locale.pm.
Diffstat (limited to 'cpan/Unicode-Collate')
90 files changed, 2362 insertions, 780 deletions
diff --git a/cpan/Unicode-Collate/Changes b/cpan/Unicode-Collate/Changes index 329bcda838..ca9be54809 100644 --- a/cpan/Unicode-Collate/Changes +++ b/cpan/Unicode-Collate/Changes @@ -1,5 +1,11 @@ Revision history for Perl module Unicode::Collate. +0.68 Tue Nov 23 20:17:22 2010 + - doc: clarified about (backwards => [ ]) and (backwards => undef). + - separated t/backwds.t from t/test.t. + - added cjk_b5.t, cjk_gb.t, cjk_ja.t, cjk_ko.t, cjk_py.t, cjk_st.t in t + for CJK/*.pm without Locale.pm. + 0.67 Sun Nov 14 11:38:59 2010 - supported UCA_Version 22 for Unicode 6.0.0. * 2B740..2B81D are new CJK unified ideographs. diff --git a/cpan/Unicode-Collate/Collate.pm b/cpan/Unicode-Collate/Collate.pm index 058c1a4593..b0814d2b4b 100644 --- a/cpan/Unicode-Collate/Collate.pm +++ b/cpan/Unicode-Collate/Collate.pm @@ -14,7 +14,7 @@ use File::Spec; no warnings 'utf8'; -our $VERSION = '0.67'; +our $VERSION = '0.68'; our $PACKAGE = __PACKAGE__; my @Path = qw(Unicode Collate); @@ -1350,7 +1350,8 @@ as an alias for C<variable>. backwards => $levelNumber or \@levelNumbers Weights in reverse order; ex. level 2 (diacritic ordering) in French. -If omitted, forwards at all the levels. +If omitted (or C<$levelNumber> is C<undef> or C<\@levelNumbers> is C<[]>), +forwards at all the levels. =item entry @@ -1955,6 +1956,8 @@ e.g. =item C<%old_tailoring = $Collator-E<gt>change(%new_tailoring)> +=item C<$modified_collator = $Collator-E<gt>change(%new_tailoring)> + Change the value of specified keys and returns the changed part. $Collator = Unicode::Collate->new(level => 4); diff --git a/cpan/Unicode-Collate/Collate/Locale.pm b/cpan/Unicode-Collate/Collate/Locale.pm index a9eea97990..5dddfb82a7 100644 --- a/cpan/Unicode-Collate/Collate/Locale.pm +++ b/cpan/Unicode-Collate/Collate/Locale.pm @@ -4,7 +4,7 @@ use strict; use Carp; use base qw(Unicode::Collate); -our $VERSION = '0.67'; +our $VERSION = '0.68'; use File::Spec; @@ -120,7 +120,7 @@ taking advantage of C<Unicode::Collate>. The C<new> method returns a collator object. A parameter list for the constructor is a hash, which can include -a special key C<'locale'> and its value (case-insensitive) standing +a special key C<locale> and its value (case-insensitive) standing for a two-letter language code (ISO-639) like C<'en'> for English. For example, C<Unicode::Collate::Locale-E<gt>new(locale =E<gt> 'FR')> returns a collator tailored for French. @@ -139,10 +139,9 @@ fallback is selected in the following order: 4. language 5. default -Tailoring tags provided by C<Unicode::Collate> are allowed -as long as they are not used for C<'locale'> support. -Esp. the C<table> tag is always untailorable -since it is reserved for DUCET. +Tailoring tags provided by C<Unicode::Collate> are allowed as long as +they are not used for C<locale> support. Esp. the C<table> tag +is always untailorable since it is reserved for DUCET. E.g. a collator for French, which ignores diacritics and case difference (i.e. level 1), with reversed case ordering and no normalization. @@ -154,6 +153,21 @@ E.g. a collator for French, which ignores diacritics and case difference normalization => undef ) +Overriding a behavior already tailored by C<locale> is disallowed +if such a tailoring is passed to C<new()>. + + Unicode::Collate::Locale->new( + locale => 'da', + upper_before_lower => 0, # causes error as reserved by 'da' + ) + +However C<change()> inherited from C<Unicode::Collate> allows +such a tailoring that is reserved by C<locale>. Examples: + + new(locale => 'ca')->change(backwards => undef) + new(locale => 'da')->change(upper_before_lower => 0) + new(locale => 'ja')->change(overrideCJK => undef) + =head2 Methods C<Unicode::Collate::Locale> is a subclass of C<Unicode::Collate> diff --git a/cpan/Unicode-Collate/README b/cpan/Unicode-Collate/README index 76e9fa0047..16bf8c4aa7 100644 --- a/cpan/Unicode-Collate/README +++ b/cpan/Unicode-Collate/README @@ -1,4 +1,4 @@ -Unicode/Collate version 0.67 +Unicode/Collate version 0.68 =============================== NAME diff --git a/cpan/Unicode-Collate/t/backwds.t b/cpan/Unicode-Collate/t/backwds.t new file mode 100644 index 0000000000..0f60deb192 --- /dev/null +++ b/cpan/Unicode-Collate/t/backwds.t @@ -0,0 +1,115 @@ + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 36 }; + +use strict; +use warnings; +use Unicode::Collate; + +ok(1); + +# 2..12 +{ + my $backLevel1 = Unicode::Collate->new( + table => "keys.txt", + normalization => undef, + backwards => [ 1 ], + ); + + ok($backLevel1->gt("a\x{300}a", "aa\x{300}")); + ok($backLevel1->lt("Ca\x{300}ca\x{302}", "ca\x{302}ca\x{300}")); + ok($backLevel1->lt("ca\x{300}ca\x{302}", "Ca\x{302}ca\x{300}")); + + # all strings are reversed at level 1. + ok($backLevel1->gt("AB", "BA")); + ok($backLevel1->gt("\x{3042}\x{3044}", "\x{3044}\x{3042}")); + + $backLevel1->change(backwards => []); + ok($backLevel1->lt("AB", "BA")); + ok($backLevel1->lt("\x{3042}\x{3044}", "\x{3044}\x{3042}")); + + $backLevel1->change(backwards => 1); + ok($backLevel1->gt("AB", "BA")); + ok($backLevel1->gt("\x{3042}\x{3044}", "\x{3044}\x{3042}")); + + $backLevel1->change(backwards => undef); + ok($backLevel1->lt("AB", "BA")); + ok($backLevel1->lt("\x{3042}\x{3044}", "\x{3044}\x{3042}")); +} + +# 13..26 +{ + my $backLevel2 = Unicode::Collate->new( + table => "keys.txt", + normalization => undef, + backwards => 2, + ); + + ok($backLevel2->lt("AB", "BA")); + ok($backLevel2->lt("\x{3042}\x{3044}", "\x{3044}\x{3042}")); + + # all strings are reversed at level 2. + ok($backLevel2->lt("a\x{300}a", "aa\x{300}")); + ok($backLevel2->gt("Ca\x{300}ca\x{302}", "ca\x{302}ca\x{300}")); + ok($backLevel2->gt("ca\x{300}ca\x{302}", "Ca\x{302}ca\x{300}")); + + $backLevel2->change(backwards => undef); + ok($backLevel2->gt("a\x{300}a", "aa\x{300}")); + ok($backLevel2->lt("Ca\x{300}ca\x{302}", "ca\x{302}ca\x{300}")); + ok($backLevel2->lt("ca\x{300}ca\x{302}", "Ca\x{302}ca\x{300}")); + + $backLevel2->change(backwards => [2]); + ok($backLevel2->lt("a\x{300}a", "aa\x{300}")); + ok($backLevel2->gt("Ca\x{300}ca\x{302}", "ca\x{302}ca\x{300}")); + ok($backLevel2->gt("ca\x{300}ca\x{302}", "Ca\x{302}ca\x{300}")); + + $backLevel2->change(backwards => []); + ok($backLevel2->gt("a\x{300}a", "aa\x{300}")); + ok($backLevel2->lt("Ca\x{300}ca\x{302}", "ca\x{302}ca\x{300}")); + ok($backLevel2->lt("ca\x{300}ca\x{302}", "Ca\x{302}ca\x{300}")); +} + +# 27..31 +{ + my $undef = Unicode::Collate->new( + table => "keys.txt", + normalization => undef, + backwards => undef, + ); + + ok($undef->lt("AB", "BA")); + ok($undef->lt("\x{3042}\x{3044}", "\x{3044}\x{3042}")); + + ok($undef->gt("a\x{300}a", "aa\x{300}")); + ok($undef->lt("Ca\x{300}ca\x{302}", "ca\x{302}ca\x{300}")); + ok($undef->lt("ca\x{300}ca\x{302}", "Ca\x{302}ca\x{300}")); +} + +# 32..36 +{ + my $empty = Unicode::Collate->new( + table => "keys.txt", + normalization => undef, + backwards => [ ], + ); + + ok($empty->lt("AB", "BA")); + ok($empty->lt("\x{3042}\x{3044}", "\x{3044}\x{3042}")); + + ok($empty->gt("a\x{300}a", "aa\x{300}")); + ok($empty->lt("Ca\x{300}ca\x{302}", "ca\x{302}ca\x{300}")); + ok($empty->lt("ca\x{300}ca\x{302}", "Ca\x{302}ca\x{300}")); +} + diff --git a/cpan/Unicode-Collate/t/cjk_b5.t b/cpan/Unicode-Collate/t/cjk_b5.t new file mode 100644 index 0000000000..7da07ea7df --- /dev/null +++ b/cpan/Unicode-Collate/t/cjk_b5.t @@ -0,0 +1,63 @@ + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 26 }; + +use strict; +use warnings; +use Unicode::Collate; + +ok(1); + +######################### + +use Unicode::Collate::CJK::Big5; + +my $collator = Unicode::Collate->new( + table => undef, + normalization => undef, + overrideCJK => \&Unicode::Collate::CJK::Big5::weightBig5 +); + +$collator->change(level => 1); + +ok($collator->lt("\x{5159}", "\x{515B}")); +ok($collator->lt("\x{515B}", "\x{515E}")); +ok($collator->lt("\x{515E}", "\x{515D}")); +ok($collator->lt("\x{515D}", "\x{5161}")); +ok($collator->lt("\x{5161}", "\x{5163}")); +ok($collator->lt("\x{5163}", "\x{55E7}")); +ok($collator->lt("\x{55E7}", "\x{74E9}")); +ok($collator->lt("\x{74E9}", "\x{7CCE}")); +ok($collator->lt("\x{7CCE}", "\x{4E00}")); +ok($collator->lt("\x{4E00}", "\x{4E59}")); +ok($collator->lt("\x{4E59}", "\x{4E01}")); +ok($collator->lt("\x{4E01}", "\x{4E03}")); +ok($collator->lt("\x{4E03}", "\x{4E43}")); +ok($collator->lt("\x{4E43}", "\x{4E5D}")); +ok($collator->lt("\x{4E5D}", "\x{4E86}")); + +ok($collator->lt("\x{7069}", "\x{706A}")); +ok($collator->lt("\x{706A}", "\x{9EA4}")); +ok($collator->lt("\x{9EA4}", "\x{9F7E}")); +ok($collator->lt("\x{9F7E}", "\x{9F49}")); +ok($collator->lt("\x{9F49}", "\x{9F98}")); + +# Ext.B +ok($collator->lt("\x{20000}", "\x{20001}")); +ok($collator->lt("\x{20001}", "\x{20002}")); +ok($collator->lt("\x{20002}", "\x{20003}")); +ok($collator->lt("\x{20003}", "\x{20004}")); +ok($collator->lt("\x{20004}", "\x{20005}")); + diff --git a/cpan/Unicode-Collate/t/cjk_gb.t b/cpan/Unicode-Collate/t/cjk_gb.t new file mode 100644 index 0000000000..389a4e8421 --- /dev/null +++ b/cpan/Unicode-Collate/t/cjk_gb.t @@ -0,0 +1,61 @@ + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 23 }; + +use strict; +use warnings; +use Unicode::Collate; + +ok(1); + +######################### + +use Unicode::Collate::CJK::GB2312; + +my $collator = Unicode::Collate->new( + table => undef, + normalization => undef, + overrideCJK => \&Unicode::Collate::CJK::GB2312::weightGB2312 +); + +$collator->change(level => 1); + +ok($collator->lt("\x{554A}", "\x{963F}")); +ok($collator->lt("\x{963F}", "\x{57C3}")); +ok($collator->lt("\x{57C3}", "\x{6328}")); +ok($collator->lt("\x{6328}", "\x{54CE}")); +ok($collator->lt("\x{54CE}", "\x{5509}")); +ok($collator->lt("\x{5509}", "\x{54C0}")); +ok($collator->lt("\x{54C0}", "\x{7691}")); +ok($collator->lt("\x{7691}", "\x{764C}")); +ok($collator->lt("\x{764C}", "\x{853C}")); +ok($collator->lt("\x{853C}", "\x{77EE}")); + +ok($collator->lt("\x{77EE}", "\x{4E00}")); +ok($collator->lt("\x{4E00}", "\x{9F2F}")); + +ok($collator->lt("\x{9F2F}", "\x{9F39}")); +ok($collator->lt("\x{9F39}", "\x{9F37}")); +ok($collator->lt("\x{9F37}", "\x{9F3D}")); +ok($collator->lt("\x{9F3D}", "\x{9F3E}")); +ok($collator->lt("\x{9F3E}", "\x{9F44}")); + +# Ext.B +ok($collator->lt("\x{20000}", "\x{20001}")); +ok($collator->lt("\x{20001}", "\x{20002}")); +ok($collator->lt("\x{20002}", "\x{20003}")); +ok($collator->lt("\x{20003}", "\x{20004}")); +ok($collator->lt("\x{20004}", "\x{20005}")); + diff --git a/cpan/Unicode-Collate/t/cjk_ja.t b/cpan/Unicode-Collate/t/cjk_ja.t new file mode 100644 index 0000000000..cc6853670d --- /dev/null +++ b/cpan/Unicode-Collate/t/cjk_ja.t @@ -0,0 +1,74 @@ + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 31 }; + +use strict; +use warnings; +use Unicode::Collate; + +ok(1); + +######################### + +use Unicode::Collate::CJK::JISX0208; + +my $collator = Unicode::Collate->new( + table => undef, + normalization => undef, + overrideCJK => \&Unicode::Collate::CJK::JISX0208::weightJISX0208 +); + +$collator->change(level => 1); + +# first ten kanji +ok($collator->lt("\x{4E9C}", "\x{5516}")); +ok($collator->lt("\x{5516}", "\x{5A03}")); +ok($collator->lt("\x{5A03}", "\x{963F}")); +ok($collator->lt("\x{963F}", "\x{54C0}")); +ok($collator->lt("\x{54C0}", "\x{611B}")); +ok($collator->lt("\x{611B}", "\x{6328}")); +ok($collator->lt("\x{6328}", "\x{59F6}")); +ok($collator->lt("\x{59F6}", "\x{9022}")); +ok($collator->lt("\x{9022}", "\x{8475}")); + +# last five kanji and undef +ok($collator->lt("\x{69C7}", "\x{9059}")); +ok($collator->lt("\x{9059}", "\x{7464}")); +ok($collator->lt("\x{7464}", "\x{51DC}")); +ok($collator->lt("\x{51DC}", "\x{7199}")); +ok($collator->lt("\x{7199}", "\x{4E02}")); # 4E02: UIdeo undef in JIS X 0208 +ok($collator->lt("\x{4E02}", "\x{3400}")); # 3400: Ext.A undef in JIS X 0208 + +# Ext.B +ok($collator->lt("\x{20000}", "\x{20001}")); +ok($collator->lt("\x{20001}", "\x{20002}")); +ok($collator->lt("\x{20002}", "\x{20003}")); +ok($collator->lt("\x{20003}", "\x{20004}")); +ok($collator->lt("\x{20004}", "\x{20005}")); + +$collator->change(overrideCJK => undef); + +ok($collator->lt("\x{4E00}", "\x{4E01}")); +ok($collator->lt("\x{4E01}", "\x{4E02}")); +ok($collator->lt("\x{4E02}", "\x{4E03}")); +ok($collator->lt("\x{4E03}", "\x{4E04}")); +ok($collator->lt("\x{4E04}", "\x{4E05}")); + +ok($collator->lt("\x{9F9B}", "\x{9F9C}")); +ok($collator->lt("\x{9F9C}", "\x{9F9D}")); +ok($collator->lt("\x{9F9D}", "\x{9F9E}")); +ok($collator->lt("\x{9F9E}", "\x{9F9F}")); +ok($collator->lt("\x{9F9F}", "\x{9FA0}")); + diff --git a/cpan/Unicode-Collate/t/cjk_ko.t b/cpan/Unicode-Collate/t/cjk_ko.t new file mode 100644 index 0000000000..69f4c7cc4c --- /dev/null +++ b/cpan/Unicode-Collate/t/cjk_ko.t @@ -0,0 +1,100 @@ + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 51 }; + +use strict; +use warnings; +use Unicode::Collate; + +ok(1); + +######################### + +use Unicode::Collate::CJK::Korean; + +my $collator = Unicode::Collate->new( + normalization => undef, + overrideCJK => \&Unicode::Collate::CJK::Korean::weightKorean +); + +$collator->change(level => 1); + +ok($collator->eq("\x{AC00}", "\x{4F3D}")); +ok($collator->eq("\x{4F3D}", "\x{4F73}")); +ok($collator->eq("\x{4F73}", "\x{5047}")); +ok($collator->eq("\x{5047}", "\x{50F9}")); +ok($collator->eq("\x{50F9}", "\x{52A0}")); +ok($collator->eq("\x{52A0}", "\x{53EF}")); +ok($collator->lt("\x{53EF}", "\x{AC01}")); + +ok($collator->eq("\x{AC1D}", "\x{5580}")); +ok($collator->eq("\x{5580}", "\x{5BA2}")); +ok($collator->lt("\x{5BA2}", "\x{AC31}")); + +ok($collator->eq("\x{C77C}", "\x{4E00}")); +ok($collator->eq("\x{4E00}", "\x{4F5A}")); +ok($collator->eq("\x{4F5A}", "\x{4F7E}")); + +ok($collator->lt("\x{993C}", "\x{D790}")); +ok($collator->eq("\x{D790}", "\x{8A70}")); +ok($collator->eq("\x{8A70}", "\x{72B5}")); +ok($collator->eq("\x{72B5}", "\x{7E88}")); +ok($collator->eq("\x{7E88}", "\x{896D}")); +ok($collator->eq("\x{896D}", "\x{9821}")); +ok($collator->eq("\x{9821}", "\x{9EE0}")); + +# Ext.B +ok($collator->lt("\x{20000}", "\x{20001}")); +ok($collator->lt("\x{20001}", "\x{20002}")); +ok($collator->lt("\x{20002}", "\x{20003}")); +ok($collator->lt("\x{20003}", "\x{20004}")); +ok($collator->lt("\x{20004}", "\x{20005}")); + +# 26 + +$collator->change(level => 2); + +ok($collator->lt("\x{AC00}", "\x{4F3D}")); +ok($collator->lt("\x{4F3D}", "\x{4F73}")); +ok($collator->lt("\x{4F73}", "\x{5047}")); +ok($collator->lt("\x{5047}", "\x{50F9}")); +ok($collator->lt("\x{50F9}", "\x{52A0}")); +ok($collator->lt("\x{52A0}", "\x{53EF}")); +ok($collator->lt("\x{53EF}", "\x{AC01}")); + +ok($collator->lt("\x{AC1D}", "\x{5580}")); +ok($collator->lt("\x{5580}", "\x{5BA2}")); +ok($collator->lt("\x{5BA2}", "\x{AC31}")); + +ok($collator->lt("\x{C77C}", "\x{4E00}")); +ok($collator->lt("\x{4E00}", "\x{4F5A}")); +ok($collator->lt("\x{4F5A}", "\x{4F7E}")); + +ok($collator->lt("\x{993C}", "\x{D790}")); +ok($collator->lt("\x{D790}", "\x{8A70}")); +ok($collator->lt("\x{8A70}", "\x{72B5}")); +ok($collator->lt("\x{72B5}", "\x{7E88}")); +ok($collator->lt("\x{7E88}", "\x{896D}")); +ok($collator->lt("\x{896D}", "\x{9821}")); +ok($collator->lt("\x{9821}", "\x{9EE0}")); + +# Ext.B +ok($collator->lt("\x{20000}", "\x{20001}")); +ok($collator->lt("\x{20001}", "\x{20002}")); +ok($collator->lt("\x{20002}", "\x{20003}")); +ok($collator->lt("\x{20003}", "\x{20004}")); +ok($collator->lt("\x{20004}", "\x{20005}")); + +# 51 diff --git a/cpan/Unicode-Collate/t/cjk_py.t b/cpan/Unicode-Collate/t/cjk_py.t new file mode 100644 index 0000000000..ec800abbc1 --- /dev/null +++ b/cpan/Unicode-Collate/t/cjk_py.t @@ -0,0 +1,63 @@ + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 25 }; + +use strict; +use warnings; +use Unicode::Collate; + +ok(1); + +######################### + +use Unicode::Collate::CJK::Pinyin; + +my $collator = Unicode::Collate->new( + table => undef, + normalization => undef, + overrideCJK => \&Unicode::Collate::CJK::Pinyin::weightPinyin +); + +$collator->change(level => 1); + +ok($collator->lt("\x{5416}", "\x{963F}")); +ok($collator->lt("\x{963F}", "\x{554A}")); +ok($collator->lt("\x{554A}", "\x{9515}")); +ok($collator->lt("\x{9515}", "\x{9312}")); +ok($collator->lt("\x{9312}", "\x{55C4}")); +ok($collator->lt("\x{55C4}", "\x{5391}")); +ok($collator->lt("\x{5391}", "\x{54CE}")); +ok($collator->lt("\x{54CE}", "\x{54C0}")); +ok($collator->lt("\x{54C0}", "\x{5509}")); +ok($collator->lt("\x{5509}", "\x{57C3}")); + +ok($collator->lt("\x{57C3}", "\x{4E00}")); +ok($collator->lt("\x{4E00}", "\x{8331}")); + +ok($collator->lt("\x{5EA7}", "\x{888F}")); +ok($collator->lt("\x{888F}", "\x{505A}")); +ok($collator->lt("\x{505A}", "\x{8444}")); +ok($collator->lt("\x{8444}", "\x{84D9}")); +ok($collator->lt("\x{84D9}", "\x{98F5}")); +ok($collator->lt("\x{98F5}", "\x{7CF3}")); +ok($collator->lt("\x{7CF3}", "\x{5497}")); + +# Ext.B +ok($collator->lt("\x{20000}", "\x{20001}")); +ok($collator->lt("\x{20001}", "\x{20002}")); +ok($collator->lt("\x{20002}", "\x{20003}")); +ok($collator->lt("\x{20003}", "\x{20004}")); +ok($collator->lt("\x{20004}", "\x{20005}")); + diff --git a/cpan/Unicode-Collate/t/cjk_st.t b/cpan/Unicode-Collate/t/cjk_st.t new file mode 100644 index 0000000000..4ebbdec2d3 --- /dev/null +++ b/cpan/Unicode-Collate/t/cjk_st.t @@ -0,0 +1,61 @@ + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 24 }; + +use strict; +use warnings; +use Unicode::Collate; + +ok(1); + +######################### + +use Unicode::Collate::CJK::Stroke; + +my $collator = Unicode::Collate->new( + table => undef, + normalization => undef, + overrideCJK => \&Unicode::Collate::CJK::Stroke::weightStroke +); + +$collator->change(level => 1); + +ok($collator->lt("\x{4E00}", "\x{4E59}")); +ok($collator->lt("\x{4E59}", "\x{4E01}")); +ok($collator->lt("\x{4E01}", "\x{4E03}")); +ok($collator->lt("\x{4E03}", "\x{4E43}")); +ok($collator->lt("\x{4E43}", "\x{4E5D}")); +ok($collator->lt("\x{4E5D}", "\x{4E86}")); +ok($collator->lt("\x{4E86}", "\x{4E8C}")); +ok($collator->lt("\x{4E8C}", "\x{4EBA}")); +ok($collator->lt("\x{4EBA}", "\x{513F}")); +ok($collator->lt("\x{513F}", "\x{5165}")); + +ok($collator->lt("\x{9E1D}", "\x{7069}")); +ok($collator->lt("\x{7069}", "\x{7C72}")); +ok($collator->lt("\x{7C72}", "\x{706A}")); +ok($collator->lt("\x{706A}", "\x{7229}")); +ok($collator->lt("\x{7229}", "\x{9EA4}")); +ok($collator->lt("\x{9EA4}", "\x{9F7E}")); +ok($collator->lt("\x{9F7E}", "\x{9F49}")); +ok($collator->lt("\x{9F49}", "\x{9F98}")); + +# Ext.B +ok($collator->lt("\x{20000}", "\x{20001}")); +ok($collator->lt("\x{20001}", "\x{20002}")); +ok($collator->lt("\x{20002}", "\x{20003}")); +ok($collator->lt("\x{20003}", "\x{20004}")); +ok($collator->lt("\x{20004}", "\x{20005}")); + diff --git a/cpan/Unicode-Collate/t/cjkrange.t b/cpan/Unicode-Collate/t/cjkrange.t index 83d92688eb..144d123d22 100644 --- a/cpan/Unicode-Collate/t/cjkrange.t +++ b/cpan/Unicode-Collate/t/cjkrange.t @@ -20,9 +20,11 @@ use Unicode::Collate; ok(1); -my $Collator = Unicode::Collate->new( - table => 'keys.txt', - normalization => undef, +######################### + +my $coll = Unicode::Collate->new( + table => 'keys.txt', + normalization => undef, ); # CJK UI Ext > CJK UI. @@ -41,59 +43,60 @@ my $Collator = Unicode::Collate->new( my @Versions = (8, 9, 11, 14, 16, 18, 20, 22); for my $v (@Versions) { -$Collator->change(UCA_Version => $v); - -# Ext.A > UI -ok($Collator->cmp("\x{3400}", "\x{4E00}") == ($v >= 9 ? 1 : -1)); # UI -ok($Collator->cmp("\x{3400}", "\x{9FA5}") == ($v >= 9 ? 1 : -1)); # UI -ok($Collator->cmp("\x{3400}", "\x{9FA6}") == ($v >= 14 ? 1 : -1)); # new -ok($Collator->cmp("\x{3400}", "\x{9FBB}") == ($v >= 14 ? 1 : -1)); # new -ok($Collator->cmp("\x{3400}", "\x{9FBC}") == ($v >= 18 ? 1 : -1)); # new -ok($Collator->cmp("\x{3400}", "\x{9FC3}") == ($v >= 18 ? 1 : -1)); # new -ok($Collator->cmp("\x{3400}", "\x{9FC4}") == ($v >= 20 ? 1 : -1)); # new -ok($Collator->cmp("\x{3400}", "\x{9FCB}") == ($v >= 20 ? 1 : -1)); # new -ok($Collator->cmp("\x{3400}", "\x{9FCC}") == -1); # na -ok($Collator->cmp("\x{3400}", "\x{9FFF}") == -1); # na - -# UI < UI -ok($Collator->cmp("\x{4E00}", "\x{9FA5}") == -1); # UI < UI -ok($Collator->cmp("\x{9FA5}", "\x{9FA6}") == -1); # UI < new -ok($Collator->cmp("\x{9FA6}", "\x{9FBB}") == -1); # new < new -ok($Collator->cmp("\x{9FBB}", "\x{9FBC}") == -1); # new < new -ok($Collator->cmp("\x{9FBC}", "\x{9FC3}") == -1); # new < new -ok($Collator->cmp("\x{9FC3}", "\x{9FC4}") == -1); # new < new -ok($Collator->cmp("\x{9FC4}", "\x{9FCB}") == -1); # new < new -ok($Collator->cmp("\x{9FCB}", "\x{9FCC}") == -1); # new < na -ok($Collator->cmp("\x{9FCC}", "\x{9FFF}") == -1); # na < na - -# Ext.A < Ext.B -ok($Collator->cmp("\x{3400}", "\x{20000}") == -1); - -# Ext.A -ok($Collator->cmp("\x{3400}", "\x{4DB5}") == -1); # A < A -ok($Collator->cmp("\x{2FFF}", "\x{3400}") == ($v >= 8 ? 1 : -1)); # na > A -ok($Collator->cmp("\x{2FFF}", "\x{4DB5}") == ($v >= 8 ? 1 : -1)); # na > A -ok($Collator->cmp("\x{2FFF}", "\x{4DB6}") == -1); # na < na -ok($Collator->cmp("\x{2FFF}", "\x{4DBF}") == -1); # na < na - -# Ext.B -ok($Collator->cmp("\x{20000}","\x{2A6D6}") == -1); # B < B -ok($Collator->cmp("\x{2FFF}", "\x{20000}") == ($v >= 9 ? 1 : -1)); # na > B -ok($Collator->cmp("\x{2FFF}", "\x{2A6D6}") == ($v >= 9 ? 1 : -1)); # na > B -ok($Collator->cmp("\x{2FFF}", "\x{2A6D7}") == -1); # na < na -ok($Collator->cmp("\x{2FFF}", "\x{2A6DF}") == -1); # na < na - -# Ext.C -ok($Collator->cmp("\x{2A700}","\x{2B734}") == -1); # C < C -ok($Collator->cmp("\x{2FFF}", "\x{2A700}") == ($v >= 20 ? 1 : -1)); # na > C -ok($Collator->cmp("\x{2FFF}", "\x{2B734}") == ($v >= 20 ? 1 : -1)); # na > C -ok($Collator->cmp("\x{2FFF}", "\x{2B735}") == -1); # na < na -ok($Collator->cmp("\x{2FFF}", "\x{2B73F}") == -1); # na < na - -# Ext.D -ok($Collator->cmp("\x{2B740}","\x{2B81D}") == -1); # D < D -ok($Collator->cmp("\x{2FFF}", "\x{2B740}") == ($v >= 22 ? 1 : -1)); # na > D -ok($Collator->cmp("\x{2FFF}", "\x{2B81D}") == ($v >= 22 ? 1 : -1)); # na > D -ok($Collator->cmp("\x{2FFF}", "\x{2B81E}") == -1); # na < na -ok($Collator->cmp("\x{2FFF}", "\x{2B81F}") == -1); # na < na + $coll->change(UCA_Version => $v); + + # Ext.A > UI + ok($coll->cmp("\x{3400}", "\x{4E00}") == ($v >= 9 ? 1 : -1)); # UI + ok($coll->cmp("\x{3400}", "\x{9FA5}") == ($v >= 9 ? 1 : -1)); # UI + ok($coll->cmp("\x{3400}", "\x{9FA6}") == ($v >= 14 ? 1 : -1)); # new + ok($coll->cmp("\x{3400}", "\x{9FBB}") == ($v >= 14 ? 1 : -1)); # new + ok($coll->cmp("\x{3400}", "\x{9FBC}") == ($v >= 18 ? 1 : -1)); # new + ok($coll->cmp("\x{3400}", "\x{9FC3}") == ($v >= 18 ? 1 : -1)); # new + ok($coll->cmp("\x{3400}", "\x{9FC4}") == ($v >= 20 ? 1 : -1)); # new + ok($coll->cmp("\x{3400}", "\x{9FCB}") == ($v >= 20 ? 1 : -1)); # new + ok($coll->cmp("\x{3400}", "\x{9FCC}") == -1); # na + ok($coll->cmp("\x{3400}", "\x{9FFF}") == -1); # na + + # UI < UI + ok($coll->cmp("\x{4E00}", "\x{9FA5}") == -1); # UI < UI + ok($coll->cmp("\x{9FA5}", "\x{9FA6}") == -1); # UI < new + ok($coll->cmp("\x{9FA6}", "\x{9FBB}") == -1); # new < new + ok($coll->cmp("\x{9FBB}", "\x{9FBC}") == -1); # new < new + ok($coll->cmp("\x{9FBC}", "\x{9FC3}") == -1); # new < new + ok($coll->cmp("\x{9FC3}", "\x{9FC4}") == -1); # new < new + ok($coll->cmp("\x{9FC4}", "\x{9FCB}") == -1); # new < new + ok($coll->cmp("\x{9FCB}", "\x{9FCC}") == -1); # new < na + ok($coll->cmp("\x{9FCC}", "\x{9FFF}") == -1); # na < na + + # Ext.A < Ext.B + ok($coll->cmp("\x{3400}", "\x{20000}") == -1); + + # Ext.A + ok($coll->cmp("\x{3400}", "\x{4DB5}") == -1); # A < A + ok($coll->cmp("\x{2FFF}", "\x{3400}") == ($v >= 8 ? 1 : -1)); # na > A + ok($coll->cmp("\x{2FFF}", "\x{4DB5}") == ($v >= 8 ? 1 : -1)); # na > A + ok($coll->cmp("\x{2FFF}", "\x{4DB6}") == -1); # na < na + ok($coll->cmp("\x{2FFF}", "\x{4DBF}") == -1); # na < na + + # Ext.B + ok($coll->cmp("\x{20000}","\x{2A6D6}") == -1); # B < B + ok($coll->cmp("\x{2FFF}", "\x{20000}") == ($v >= 9 ? 1 : -1)); # na > B + ok($coll->cmp("\x{2FFF}", "\x{2A6D6}") == ($v >= 9 ? 1 : -1)); # na > B + ok($coll->cmp("\x{2FFF}", "\x{2A6D7}") == -1); # na < na + ok($coll->cmp("\x{2FFF}", "\x{2A6DF}") == -1); # na < na + + # Ext.C + ok($coll->cmp("\x{2A700}","\x{2B734}") == -1); # C < C + ok($coll->cmp("\x{2FFF}", "\x{2A700}") == ($v >= 20 ? 1 : -1)); # na > C + ok($coll->cmp("\x{2FFF}", "\x{2B734}") == ($v >= 20 ? 1 : -1)); # na > C + ok($coll->cmp("\x{2FFF}", "\x{2B735}") == -1); # na < na + ok($coll->cmp("\x{2FFF}", "\x{2B73F}") == -1); # na < na + + # Ext.D + ok($coll->cmp("\x{2B740}","\x{2B81D}") == -1); # D < D + ok($coll->cmp("\x{2FFF}", "\x{2B740}") == ($v >= 22 ? 1 : -1)); # na > D + ok($coll->cmp("\x{2FFF}", "\x{2B81D}") == ($v >= 22 ? 1 : -1)); # na > D + ok($coll->cmp("\x{2FFF}", "\x{2B81E}") == -1); # na < na + ok($coll->cmp("\x{2FFF}", "\x{2B81F}") == -1); # na < na } + diff --git a/cpan/Unicode-Collate/t/compatui.t b/cpan/Unicode-Collate/t/compatui.t index 66a8735ab6..769debf2c6 100644 --- a/cpan/Unicode-Collate/t/compatui.t +++ b/cpan/Unicode-Collate/t/compatui.t @@ -20,96 +20,99 @@ use Unicode::Collate; ok(1); +######################### + my @Versions = (8, 9, 11, 14, 16, 18, 20, 22); # 12 compatibility ideographs are treated as unified ideographs: # FA0E, FA0F, FA11, FA13, FA14, FA1F, FA21, FA23, FA24, FA27, FA28, FA29. my $Collator = Unicode::Collate->new( - table => 'keys.txt', - normalization => undef, + table => 'keys.txt', + normalization => undef, ); for my $v (@Versions) { -$Collator->change(UCA_Version => $v); -ok($Collator->lt("\x{4E00}", "\x{1FFF}")); -ok($Collator->lt("\x{9FA5}", "\x{1FFF}")); -ok($Collator->gt("\x{FA00}", "\x{1FFF}")); -ok($Collator->gt("\x{FA0D}", "\x{1FFF}")); -ok($Collator->lt("\x{FA0E}", "\x{1FFF}")); -ok($Collator->lt("\x{FA0F}", "\x{1FFF}")); -ok($Collator->gt("\x{FA10}", "\x{1FFF}")); -ok($Collator->lt("\x{FA11}", "\x{1FFF}")); -ok($Collator->gt("\x{FA12}", "\x{1FFF}")); -ok($Collator->lt("\x{FA13}", "\x{1FFF}")); -ok($Collator->lt("\x{FA14}", "\x{1FFF}")); -ok($Collator->gt("\x{FA15}", "\x{1FFF}")); -ok($Collator->gt("\x{FA16}", "\x{1FFF}")); -ok($Collator->gt("\x{FA17}", "\x{1FFF}")); -ok($Collator->gt("\x{FA18}", "\x{1FFF}")); -ok($Collator->gt("\x{FA19}", "\x{1FFF}")); -ok($Collator->gt("\x{FA1A}", "\x{1FFF}")); -ok($Collator->gt("\x{FA1B}", "\x{1FFF}")); -ok($Collator->gt("\x{FA1C}", "\x{1FFF}")); -ok($Collator->gt("\x{FA1D}", "\x{1FFF}")); -ok($Collator->gt("\x{FA1E}", "\x{1FFF}")); -ok($Collator->lt("\x{FA1F}", "\x{1FFF}")); -ok($Collator->gt("\x{FA20}", "\x{1FFF}")); -ok($Collator->lt("\x{FA21}", "\x{1FFF}")); -ok($Collator->gt("\x{FA22}", "\x{1FFF}")); -ok($Collator->lt("\x{FA23}", "\x{1FFF}")); -ok($Collator->lt("\x{FA24}", "\x{1FFF}")); -ok($Collator->gt("\x{FA25}", "\x{1FFF}")); -ok($Collator->gt("\x{FA26}", "\x{1FFF}")); -ok($Collator->lt("\x{FA27}", "\x{1FFF}")); -ok($Collator->lt("\x{FA28}", "\x{1FFF}")); -ok($Collator->lt("\x{FA29}", "\x{1FFF}")); -ok($Collator->gt("\x{FA2A}", "\x{1FFF}")); -ok($Collator->gt("\x{FA30}", "\x{1FFF}")); -ok($Collator->gt("\x{FAFF}", "\x{1FFF}")); + $Collator->change(UCA_Version => $v); + ok($Collator->lt("\x{4E00}", "\x{1FFF}")); + ok($Collator->lt("\x{9FA5}", "\x{1FFF}")); + ok($Collator->gt("\x{FA00}", "\x{1FFF}")); + ok($Collator->gt("\x{FA0D}", "\x{1FFF}")); + ok($Collator->lt("\x{FA0E}", "\x{1FFF}")); + ok($Collator->lt("\x{FA0F}", "\x{1FFF}")); + ok($Collator->gt("\x{FA10}", "\x{1FFF}")); + ok($Collator->lt("\x{FA11}", "\x{1FFF}")); + ok($Collator->gt("\x{FA12}", "\x{1FFF}")); + ok($Collator->lt("\x{FA13}", "\x{1FFF}")); + ok($Collator->lt("\x{FA14}", "\x{1FFF}")); + ok($Collator->gt("\x{FA15}", "\x{1FFF}")); + ok($Collator->gt("\x{FA16}", "\x{1FFF}")); + ok($Collator->gt("\x{FA17}", "\x{1FFF}")); + ok($Collator->gt("\x{FA18}", "\x{1FFF}")); + ok($Collator->gt("\x{FA19}", "\x{1FFF}")); + ok($Collator->gt("\x{FA1A}", "\x{1FFF}")); + ok($Collator->gt("\x{FA1B}", "\x{1FFF}")); + ok($Collator->gt("\x{FA1C}", "\x{1FFF}")); + ok($Collator->gt("\x{FA1D}", "\x{1FFF}")); + ok($Collator->gt("\x{FA1E}", "\x{1FFF}")); + ok($Collator->lt("\x{FA1F}", "\x{1FFF}")); + ok($Collator->gt("\x{FA20}", "\x{1FFF}")); + ok($Collator->lt("\x{FA21}", "\x{1FFF}")); + ok($Collator->gt("\x{FA22}", "\x{1FFF}")); + ok($Collator->lt("\x{FA23}", "\x{1FFF}")); + ok($Collator->lt("\x{FA24}", "\x{1FFF}")); + ok($Collator->gt("\x{FA25}", "\x{1FFF}")); + ok($Collator->gt("\x{FA26}", "\x{1FFF}")); + ok($Collator->lt("\x{FA27}", "\x{1FFF}")); + ok($Collator->lt("\x{FA28}", "\x{1FFF}")); + ok($Collator->lt("\x{FA29}", "\x{1FFF}")); + ok($Collator->gt("\x{FA2A}", "\x{1FFF}")); + ok($Collator->gt("\x{FA30}", "\x{1FFF}")); + ok($Collator->gt("\x{FAFF}", "\x{1FFF}")); } my $IgnoreCJK = Unicode::Collate->new( - table => 'keys.txt', - normalization => undef, - overrideCJK => sub {()}, + table => 'keys.txt', + normalization => undef, + overrideCJK => sub {()}, ); for my $v (@Versions) { -$IgnoreCJK->change(UCA_Version => $v); -ok($IgnoreCJK->eq("\x{4E00}", "")); -ok($IgnoreCJK->eq("\x{9FA5}", "")); -ok($IgnoreCJK->gt("\x{FA00}", "\x{1FFF}")); -ok($IgnoreCJK->gt("\x{FA0D}", "\x{1FFF}")); -ok($IgnoreCJK->eq("\x{FA0E}", "")); -ok($IgnoreCJK->eq("\x{FA0F}", "")); -ok($IgnoreCJK->gt("\x{FA10}", "\x{1FFF}")); -ok($IgnoreCJK->eq("\x{FA11}", "")); -ok($IgnoreCJK->gt("\x{FA12}", "\x{1FFF}")); -ok($IgnoreCJK->eq("\x{FA13}", "")); -ok($IgnoreCJK->eq("\x{FA14}", "")); -ok($IgnoreCJK->gt("\x{FA15}", "\x{1FFF}")); -ok($IgnoreCJK->gt("\x{FA16}", "\x{1FFF}")); -ok($IgnoreCJK->gt("\x{FA17}", "\x{1FFF}")); -ok($IgnoreCJK->gt("\x{FA18}", "\x{1FFF}")); -ok($IgnoreCJK->gt("\x{FA19}", "\x{1FFF}")); -ok($IgnoreCJK->gt("\x{FA1A}", "\x{1FFF}")); -ok($IgnoreCJK->gt("\x{FA1B}", "\x{1FFF}")); -ok($IgnoreCJK->gt("\x{FA1C}", "\x{1FFF}")); -ok($IgnoreCJK->gt("\x{FA1D}", "\x{1FFF}")); -ok($IgnoreCJK->gt("\x{FA1E}", "\x{1FFF}")); -ok($IgnoreCJK->eq("\x{FA1F}", "")); -ok($IgnoreCJK->gt("\x{FA20}", "\x{1FFF}")); -ok($IgnoreCJK->eq("\x{FA21}", "")); -ok($IgnoreCJK->gt("\x{FA22}", "\x{1FFF}")); -ok($IgnoreCJK->eq("\x{FA23}", "")); -ok($IgnoreCJK->eq("\x{FA24}", "")); -ok($IgnoreCJK->gt("\x{FA25}", "\x{1FFF}")); -ok($IgnoreCJK->gt("\x{FA26}", "\x{1FFF}")); -ok($IgnoreCJK->eq("\x{FA27}", "")); -ok($IgnoreCJK->eq("\x{FA28}", "")); -ok($IgnoreCJK->eq("\x{FA29}", "")); -ok($IgnoreCJK->gt("\x{FA2A}", "\x{1FFF}")); -ok($IgnoreCJK->gt("\x{FA30}", "\x{1FFF}")); -ok($IgnoreCJK->gt("\x{FAFF}", "\x{1FFF}")); + $IgnoreCJK->change(UCA_Version => $v); + ok($IgnoreCJK->eq("\x{4E00}", "")); + ok($IgnoreCJK->eq("\x{9FA5}", "")); + ok($IgnoreCJK->gt("\x{FA00}", "\x{1FFF}")); + ok($IgnoreCJK->gt("\x{FA0D}", "\x{1FFF}")); + ok($IgnoreCJK->eq("\x{FA0E}", "")); + ok($IgnoreCJK->eq("\x{FA0F}", "")); + ok($IgnoreCJK->gt("\x{FA10}", "\x{1FFF}")); + ok($IgnoreCJK->eq("\x{FA11}", "")); + ok($IgnoreCJK->gt("\x{FA12}", "\x{1FFF}")); + ok($IgnoreCJK->eq("\x{FA13}", "")); + ok($IgnoreCJK->eq("\x{FA14}", "")); + ok($IgnoreCJK->gt("\x{FA15}", "\x{1FFF}")); + ok($IgnoreCJK->gt("\x{FA16}", "\x{1FFF}")); + ok($IgnoreCJK->gt("\x{FA17}", "\x{1FFF}")); + ok($IgnoreCJK->gt("\x{FA18}", "\x{1FFF}")); + ok($IgnoreCJK->gt("\x{FA19}", "\x{1FFF}")); + ok($IgnoreCJK->gt("\x{FA1A}", "\x{1FFF}")); + ok($IgnoreCJK->gt("\x{FA1B}", "\x{1FFF}")); + ok($IgnoreCJK->gt("\x{FA1C}", "\x{1FFF}")); + ok($IgnoreCJK->gt("\x{FA1D}", "\x{1FFF}")); + ok($IgnoreCJK->gt("\x{FA1E}", "\x{1FFF}")); + ok($IgnoreCJK->eq("\x{FA1F}", "")); + ok($IgnoreCJK->gt("\x{FA20}", "\x{1FFF}")); + ok($IgnoreCJK->eq("\x{FA21}", "")); + ok($IgnoreCJK->gt("\x{FA22}", "\x{1FFF}")); + ok($IgnoreCJK->eq("\x{FA23}", "")); + ok($IgnoreCJK->eq("\x{FA24}", "")); + ok($IgnoreCJK->gt("\x{FA25}", "\x{1FFF}")); + ok($IgnoreCJK->gt("\x{FA26}", "\x{1FFF}")); + ok($IgnoreCJK->eq("\x{FA27}", "")); + ok($IgnoreCJK->eq("\x{FA28}", "")); + ok($IgnoreCJK->eq("\x{FA29}", "")); + ok($IgnoreCJK->gt("\x{FA2A}", "\x{1FFF}")); + ok($IgnoreCJK->gt("\x{FA30}", "\x{1FFF}")); + ok($IgnoreCJK->gt("\x{FAFF}", "\x{1FFF}")); } + diff --git a/cpan/Unicode-Collate/t/contract.t b/cpan/Unicode-Collate/t/contract.t index 22a1086ca1..af141066a4 100644 --- a/cpan/Unicode-Collate/t/contract.t +++ b/cpan/Unicode-Collate/t/contract.t @@ -18,6 +18,10 @@ use strict; use warnings; use Unicode::Collate; +ok(1); + +######################### + our $kjeEntry = <<'ENTRIES'; 0301 ; [.0000.0032.0002.0301] # COMBINING ACUTE ACCENT 0334 ; [.0000.008B.0002.0334] # COMBINING TILDE OVERLAY @@ -46,8 +50,6 @@ ENTRIES ######################### -ok(1); - my $kjeNoN = Unicode::Collate->new( level => 1, table => undef, diff --git a/cpan/Unicode-Collate/t/default.t b/cpan/Unicode-Collate/t/default.t index 8c3e5cbe79..bb6732b247 100644 --- a/cpan/Unicode-Collate/t/default.t +++ b/cpan/Unicode-Collate/t/default.t @@ -20,6 +20,8 @@ use Unicode::Collate; ok(1); +######################### + sub _pack_U { Unicode::Collate::pack_U(@_) } sub _unpack_U { Unicode::Collate::unpack_U(@_) } @@ -134,3 +136,4 @@ ok( $Collator->cmp("abc", "ABC"), -1); ok( $Collator->le("abc", "ABC") ); ok( $Collator->cmp($hiragana, $katakana), -1); ok( $Collator->lt($hiragana, $katakana) ); + diff --git a/cpan/Unicode-Collate/t/hangtype.t b/cpan/Unicode-Collate/t/hangtype.t index 0d9c1fed65..6932854b20 100644 --- a/cpan/Unicode-Collate/t/hangtype.t +++ b/cpan/Unicode-Collate/t/hangtype.t @@ -1,3 +1,4 @@ + BEGIN { unless ("A" eq pack('U', 0x41)) { print "1..0 # Unicode::Collate " . @@ -11,7 +12,7 @@ BEGIN { } use Test; -BEGIN { plan tests => 70 }; +BEGIN { plan tests => 401 }; # 1 + 50 x @Versions use strict; use warnings; @@ -19,79 +20,60 @@ use Unicode::Collate; ok(1); -##### 2..35 -ok(Unicode::Collate::getHST(0x0000), ''); -ok(Unicode::Collate::getHST(0x0100), ''); -ok(Unicode::Collate::getHST(0x1000), ''); -ok(Unicode::Collate::getHST(0x10FF), ''); -ok(Unicode::Collate::getHST(0x1100), 'L'); -ok(Unicode::Collate::getHST(0x1101), 'L'); -ok(Unicode::Collate::getHST(0x1159), 'L'); -ok(Unicode::Collate::getHST(0x115A), ''); -ok(Unicode::Collate::getHST(0x115A, 18), ''); -ok(Unicode::Collate::getHST(0x115A, 20), 'L'); -ok(Unicode::Collate::getHST(0x115E), ''); -ok(Unicode::Collate::getHST(0x115E, 18), ''); -ok(Unicode::Collate::getHST(0x115E, 20), 'L'); -ok(Unicode::Collate::getHST(0x115F), 'L'); -ok(Unicode::Collate::getHST(0x1160), 'V'); -ok(Unicode::Collate::getHST(0x1161), 'V'); -ok(Unicode::Collate::getHST(0x11A0), 'V'); -ok(Unicode::Collate::getHST(0x11A2), 'V'); -ok(Unicode::Collate::getHST(0x11A3), ''); -ok(Unicode::Collate::getHST(0x11A3, 18), ''); -ok(Unicode::Collate::getHST(0x11A3, 20), 'V'); -ok(Unicode::Collate::getHST(0x11A7), ''); -ok(Unicode::Collate::getHST(0x11A7, 18), ''); -ok(Unicode::Collate::getHST(0x11A7, 20), 'V'); -ok(Unicode::Collate::getHST(0x11A8), 'T'); -ok(Unicode::Collate::getHST(0x11AF), 'T'); -ok(Unicode::Collate::getHST(0x11E0), 'T'); -ok(Unicode::Collate::getHST(0x11F9), 'T'); -ok(Unicode::Collate::getHST(0x11FA), ''); -ok(Unicode::Collate::getHST(0x11FA, 18), ''); -ok(Unicode::Collate::getHST(0x11FA, 20), 'T'); -ok(Unicode::Collate::getHST(0x11FF), ''); -ok(Unicode::Collate::getHST(0x11FF, 18), ''); -ok(Unicode::Collate::getHST(0x11FF, 20), 'T'); +######################### -##### 36..44 -ok(Unicode::Collate::getHST(0x3011), ''); -ok(Unicode::Collate::getHST(0xABFF), ''); -ok(Unicode::Collate::getHST(0xAC00), 'LV'); -ok(Unicode::Collate::getHST(0xAC01), 'LVT'); -ok(Unicode::Collate::getHST(0xAC1B), 'LVT'); -ok(Unicode::Collate::getHST(0xAC1C), 'LV'); -ok(Unicode::Collate::getHST(0xD7A3), 'LVT'); -ok(Unicode::Collate::getHST(0xD7A4), ''); -ok(Unicode::Collate::getHST(0xFFFF), ''); +my @Versions = (8, 9, 11, 14, 16, 18, 20, 22); -##### 45..57 -ok(Unicode::Collate::getHST(0xA960, 18), ''); -ok(Unicode::Collate::getHST(0xA961, 18), ''); -ok(Unicode::Collate::getHST(0xA97C, 18), ''); -ok(Unicode::Collate::getHST(0xD7B0, 18), ''); -ok(Unicode::Collate::getHST(0xD7C0, 18), ''); -ok(Unicode::Collate::getHST(0xD7C6, 18), ''); -ok(Unicode::Collate::getHST(0xD7C7, 18), ''); -ok(Unicode::Collate::getHST(0xD7CA, 18), ''); -ok(Unicode::Collate::getHST(0xD7CB, 18), ''); -ok(Unicode::Collate::getHST(0xD7DD, 18), ''); -ok(Unicode::Collate::getHST(0xD7FB, 18), ''); -ok(Unicode::Collate::getHST(0xD7FC, 18), ''); -ok(Unicode::Collate::getHST(0xD7FF, 18), ''); +for my $v (@Versions) { + ok(Unicode::Collate::getHST(0x0000, $v), ''); + ok(Unicode::Collate::getHST(0x0100, $v), ''); + ok(Unicode::Collate::getHST(0x1000, $v), ''); + ok(Unicode::Collate::getHST(0x10FF, $v), ''); + ok(Unicode::Collate::getHST(0x1100, $v), 'L'); + ok(Unicode::Collate::getHST(0x1101, $v), 'L'); + ok(Unicode::Collate::getHST(0x1159, $v), 'L'); + ok(Unicode::Collate::getHST(0x115A, $v), ($v >= 20 ? 'L' : '')); + ok(Unicode::Collate::getHST(0x115E, $v), ($v >= 20 ? 'L' : '')); + ok(Unicode::Collate::getHST(0x115F, $v), 'L'); + ok(Unicode::Collate::getHST(0x1160, $v), 'V'); + ok(Unicode::Collate::getHST(0x1161, $v), 'V'); + ok(Unicode::Collate::getHST(0x11A0, $v), 'V'); + ok(Unicode::Collate::getHST(0x11A2, $v), 'V'); + ok(Unicode::Collate::getHST(0x11A3, $v), ($v >= 20 ? 'V' : '')); + ok(Unicode::Collate::getHST(0x11A7, $v), ($v >= 20 ? 'V' : '')); + ok(Unicode::Collate::getHST(0x11A8, $v), 'T'); + ok(Unicode::Collate::getHST(0x11AF, $v), 'T'); + ok(Unicode::Collate::getHST(0x11E0, $v), 'T'); + ok(Unicode::Collate::getHST(0x11F9, $v), 'T'); + ok(Unicode::Collate::getHST(0x11FA, $v), ($v >= 20 ? 'T' : '')); + ok(Unicode::Collate::getHST(0x11FF, $v), ($v >= 20 ? 'T' : '')); + ok(Unicode::Collate::getHST(0x3011, $v), ''); + ok(Unicode::Collate::getHST(0xA960, $v), ($v >= 20 ? 'L' : '')); + ok(Unicode::Collate::getHST(0xA961, $v), ($v >= 20 ? 'L' : '')); + ok(Unicode::Collate::getHST(0xA97C, $v), ($v >= 20 ? 'L' : '')); + ok(Unicode::Collate::getHST(0xA97F, $v), ''); + ok(Unicode::Collate::getHST(0xABFF, $v), ''); + ok(Unicode::Collate::getHST(0xAC00, $v), 'LV'); + ok(Unicode::Collate::getHST(0xAC01, $v), 'LVT'); + ok(Unicode::Collate::getHST(0xAC1B, $v), 'LVT'); + ok(Unicode::Collate::getHST(0xAC1C, $v), 'LV'); + ok(Unicode::Collate::getHST(0xD7A3, $v), 'LVT'); + ok(Unicode::Collate::getHST(0xD7A4, $v), ''); + ok(Unicode::Collate::getHST(0xD7AF, $v), ''); + ok(Unicode::Collate::getHST(0xD7B0, $v), ($v >= 20 ? 'V' : '')); + ok(Unicode::Collate::getHST(0xD7C0, $v), ($v >= 20 ? 'V' : '')); + ok(Unicode::Collate::getHST(0xD7C6, $v), ($v >= 20 ? 'V' : '')); + ok(Unicode::Collate::getHST(0xD7C7, $v), ''); + ok(Unicode::Collate::getHST(0xD7CA, $v), ''); + ok(Unicode::Collate::getHST(0xD7CB, $v), ($v >= 20 ? 'T' : '')); + ok(Unicode::Collate::getHST(0xD7DD, $v), ($v >= 20 ? 'T' : '')); + ok(Unicode::Collate::getHST(0xD7FB, $v), ($v >= 20 ? 'T' : '')); + ok(Unicode::Collate::getHST(0xD7FC, $v), ''); + ok(Unicode::Collate::getHST(0xD7FF, $v), ''); + ok(Unicode::Collate::getHST(0xFFFF, $v), ''); + ok(Unicode::Collate::getHST(0x11100, $v), ''); + ok(Unicode::Collate::getHST(0x111FF, $v), ''); + ok(Unicode::Collate::getHST(0x2AC00, $v), ''); + ok(Unicode::Collate::getHST(0x10D7A3, $v), ''); +} -##### 58..70 -ok(Unicode::Collate::getHST(0xA960, 20), 'L'); -ok(Unicode::Collate::getHST(0xA961, 20), 'L'); -ok(Unicode::Collate::getHST(0xA97C, 20), 'L'); -ok(Unicode::Collate::getHST(0xD7B0, 20), 'V'); -ok(Unicode::Collate::getHST(0xD7C0, 20), 'V'); -ok(Unicode::Collate::getHST(0xD7C6, 20), 'V'); -ok(Unicode::Collate::getHST(0xD7C7, 20), ''); -ok(Unicode::Collate::getHST(0xD7CA, 20), ''); -ok(Unicode::Collate::getHST(0xD7CB, 20), 'T'); -ok(Unicode::Collate::getHST(0xD7DD, 20), 'T'); -ok(Unicode::Collate::getHST(0xD7FB, 20), 'T'); -ok(Unicode::Collate::getHST(0xD7FC, 20), ''); -ok(Unicode::Collate::getHST(0xD7FF, 20), ''); diff --git a/cpan/Unicode-Collate/t/hangul.t b/cpan/Unicode-Collate/t/hangul.t index d9f7db9b10..702f8f7564 100644 --- a/cpan/Unicode-Collate/t/hangul.t +++ b/cpan/Unicode-Collate/t/hangul.t @@ -1,3 +1,4 @@ + BEGIN { unless ("A" eq pack('U', 0x41)) { print "1..0 # Unicode::Collate " . @@ -17,10 +18,10 @@ use strict; use warnings; use Unicode::Collate; -######################### - ok(1); +######################### + # a standard collator (3.1.1) my $Collator = Unicode::Collate->new( table => 'keys.txt', diff --git a/cpan/Unicode-Collate/t/ignor.t b/cpan/Unicode-Collate/t/ignor.t index 4ee47c6f12..13defcc543 100644 --- a/cpan/Unicode-Collate/t/ignor.t +++ b/cpan/Unicode-Collate/t/ignor.t @@ -1,3 +1,4 @@ + BEGIN { unless ("A" eq pack('U', 0x41)) { print "1..0 # Unicode::Collate " . @@ -19,6 +20,8 @@ use Unicode::Collate; ok(1); +######################### + my $trad = Unicode::Collate->new( table => 'keys.txt', normalization => undef, diff --git a/cpan/Unicode-Collate/t/index.t b/cpan/Unicode-Collate/t/index.t index cfe89953c9..f829c5939c 100644 --- a/cpan/Unicode-Collate/t/index.t +++ b/cpan/Unicode-Collate/t/index.t @@ -18,11 +18,11 @@ use strict; use warnings; use Unicode::Collate; -our $IsEBCDIC = ord("A") != 0x41; +ok(1); ######################### -ok(1); +our $IsEBCDIC = ord("A") != 0x41; my $Collator = Unicode::Collate->new( table => 'keys.txt', diff --git a/cpan/Unicode-Collate/t/loc_af.t b/cpan/Unicode-Collate/t/loc_af.t index c3c9af85f0..32b11bf45b 100644 --- a/cpan/Unicode-Collate/t/loc_af.t +++ b/cpan/Unicode-Collate/t/loc_af.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 8 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 8; +ok(1); + +######################### my $objAf = Unicode::Collate::Locale-> new(locale => 'AF', normalization => undef); -ok(1); ok($objAf->getlocale, 'af'); $objAf->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_ar.t b/cpan/Unicode-Collate/t/loc_ar.t index 3e7777063e..089c30b899 100644 --- a/cpan/Unicode-Collate/t/loc_ar.t +++ b/cpan/Unicode-Collate/t/loc_ar.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 8 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 8; +ok(1); + +######################### my $objAr = Unicode::Collate::Locale-> new(locale => 'AR', normalization => undef); -ok(1); ok($objAr->getlocale, 'ar'); $objAr->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_az.t b/cpan/Unicode-Collate/t/loc_az.t index b8474e509f..a370a1ac51 100644 --- a/cpan/Unicode-Collate/t/loc_az.t +++ b/cpan/Unicode-Collate/t/loc_az.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 72 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 72; +ok(1); + +######################### my $objAz = Unicode::Collate::Locale-> new(locale => 'AZ', normalization => undef); -ok(1); ok($objAz->getlocale, 'az'); $objAz->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_be.t b/cpan/Unicode-Collate/t/loc_be.t index 90f93dbe1b..708b03d255 100644 --- a/cpan/Unicode-Collate/t/loc_be.t +++ b/cpan/Unicode-Collate/t/loc_be.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 130 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 130; +ok(1); + +######################### my $objBe = Unicode::Collate::Locale-> new(locale => 'BE', normalization => undef); -ok(1); ok($objBe->getlocale, 'be'); $objBe->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_bg.t b/cpan/Unicode-Collate/t/loc_bg.t index 59acb41589..9c706a3c55 100644 --- a/cpan/Unicode-Collate/t/loc_bg.t +++ b/cpan/Unicode-Collate/t/loc_bg.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 130 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 130; +ok(1); + +######################### my $objBg = Unicode::Collate::Locale-> new(locale => 'BG', normalization => undef); -ok(1); ok($objBg->getlocale, 'bg'); $objBg->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_ca.t b/cpan/Unicode-Collate/t/loc_ca.t index 2149194b34..092d75d0e8 100644 --- a/cpan/Unicode-Collate/t/loc_ca.t +++ b/cpan/Unicode-Collate/t/loc_ca.t @@ -1,17 +1,32 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 41 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 38; +ok(1); + +######################### my $dot = pack 'U', 0xB7; my $objCa = Unicode::Collate::Locale-> new(locale => 'CA', normalization => undef); -ok(1); ok($objCa->getlocale, 'ca'); $objCa->change(level => 1); @@ -70,3 +85,11 @@ ok($objCa->lt("Ll","L${dot}l")); ok($objCa->lt("LL","L${dot}L")); # 38 + +$objCa->change(backwards => undef, level => 2); + +ok($objCa->gt("a\x{300}a", "aa\x{300}")); +ok($objCa->lt("Ca\x{300}ca\x{302}", "ca\x{302}ca\x{300}")); +ok($objCa->lt("ca\x{300}ca\x{302}", "Ca\x{302}ca\x{300}")); + +# 41 diff --git a/cpan/Unicode-Collate/t/loc_cs.t b/cpan/Unicode-Collate/t/loc_cs.t index 7079a6eec7..de04fdcd5d 100644 --- a/cpan/Unicode-Collate/t/loc_cs.t +++ b/cpan/Unicode-Collate/t/loc_cs.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 34 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 34; +ok(1); + +######################### my $objCs = Unicode::Collate::Locale-> new(locale => 'CS', normalization => undef); -ok(1); ok($objCs->getlocale, 'cs'); $objCs->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_cy.t b/cpan/Unicode-Collate/t/loc_cy.t index 13cc3bec3b..24f9eeacb1 100644 --- a/cpan/Unicode-Collate/t/loc_cy.t +++ b/cpan/Unicode-Collate/t/loc_cy.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 74 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 74; +ok(1); + +######################### my $objCy = Unicode::Collate::Locale-> new(locale => 'CY', normalization => undef); -ok(1); ok($objCy->getlocale, 'cy'); $objCy->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_cyrl.t b/cpan/Unicode-Collate/t/loc_cyrl.t index c7223ac145..02deb3869e 100644 --- a/cpan/Unicode-Collate/t/loc_cyrl.t +++ b/cpan/Unicode-Collate/t/loc_cyrl.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 104 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 104; +ok(1); + +######################### my $objNoSuppress = Unicode::Collate::Locale-> new(locale => 'NoSuppress', normalization => undef); -ok(1); ok($objNoSuppress->getlocale, 'default'); $objNoSuppress->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_da.t b/cpan/Unicode-Collate/t/loc_da.t index aff6da741c..e21afec813 100644 --- a/cpan/Unicode-Collate/t/loc_da.t +++ b/cpan/Unicode-Collate/t/loc_da.t @@ -1,10 +1,26 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 117 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 111; +ok(1); + +######################### my $eth = pack 'U', 0xF0; my $ETH = pack 'U', 0xD0; @@ -26,7 +42,6 @@ my $Arng = pack 'U', 0xC5; my $objDa = Unicode::Collate::Locale-> new(locale => 'DA', normalization => undef); -ok(1); ok($objDa->getlocale, 'da'); $objDa->change(level => 1); @@ -167,3 +182,14 @@ ok($objDa->gt("y", "Y")); ok($objDa->gt("z", "Z")); # 111 + +$objDa->change(upper_before_lower => 0); + +ok($objDa->lt("a", "A")); +ok($objDa->lt("b", "B")); +ok($objDa->lt("c", "C")); +ok($objDa->lt("x", "X")); +ok($objDa->lt("y", "Y")); +ok($objDa->lt("z", "Z")); + +# 117 diff --git a/cpan/Unicode-Collate/t/loc_de.t b/cpan/Unicode-Collate/t/loc_de.t index 4eafdb63b0..6908b098d1 100644 --- a/cpan/Unicode-Collate/t/loc_de.t +++ b/cpan/Unicode-Collate/t/loc_de.t @@ -1,10 +1,26 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 32 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 32; +ok(1); + +######################### my $auml = pack 'U', 0xE4; my $Auml = pack 'U', 0xC4; @@ -16,7 +32,6 @@ my $Uuml = pack 'U', 0xDC; my $objDe = Unicode::Collate::Locale-> new(locale => 'DE', normalization => undef); -ok(1); ok($objDe->getlocale, 'default'); $objDe->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_deph.t b/cpan/Unicode-Collate/t/loc_deph.t index 3650099d67..0f0b15033f 100644 --- a/cpan/Unicode-Collate/t/loc_deph.t +++ b/cpan/Unicode-Collate/t/loc_deph.t @@ -1,10 +1,26 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 42 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 42; +ok(1); + +######################### my $auml = pack 'U', 0xE4; my $Auml = pack 'U', 0xC4; @@ -16,7 +32,6 @@ my $Uuml = pack 'U', 0xDC; my $objDePhone = Unicode::Collate::Locale-> new(locale => 'DE-PHONE', normalization => undef); -ok(1); ok($objDePhone->getlocale, 'de__phonebook'); $objDePhone->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_eo.t b/cpan/Unicode-Collate/t/loc_eo.t index 2a24b12874..5fdec234bc 100644 --- a/cpan/Unicode-Collate/t/loc_eo.t +++ b/cpan/Unicode-Collate/t/loc_eo.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 38 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 38; +ok(1); + +######################### my $objEo = Unicode::Collate::Locale-> new(locale => 'EO', normalization => undef); -ok(1); ok($objEo->getlocale, 'eo'); $objEo->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_es.t b/cpan/Unicode-Collate/t/loc_es.t index 54ac671350..2491b38a30 100644 --- a/cpan/Unicode-Collate/t/loc_es.t +++ b/cpan/Unicode-Collate/t/loc_es.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 26 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 26; +ok(1); + +######################### my $objEs = Unicode::Collate::Locale-> new(locale => 'ES', normalization => undef); -ok(1); ok($objEs->getlocale, 'es'); $objEs->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_estr.t b/cpan/Unicode-Collate/t/loc_estr.t index 963c3569d5..a83736b85d 100644 --- a/cpan/Unicode-Collate/t/loc_estr.t +++ b/cpan/Unicode-Collate/t/loc_estr.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 26 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 26; +ok(1); + +######################### my $objEsTrad = Unicode::Collate::Locale-> new(locale => 'ES-trad', normalization => undef); -ok(1); ok($objEsTrad->getlocale, 'es__traditional'); $objEsTrad->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_et.t b/cpan/Unicode-Collate/t/loc_et.t index ed8a53ec8d..c6e3053373 100644 --- a/cpan/Unicode-Collate/t/loc_et.t +++ b/cpan/Unicode-Collate/t/loc_et.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 61 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 61; +ok(1); + +######################### my $objEt = Unicode::Collate::Locale-> new(locale => 'ET', normalization => undef); -ok(1); ok($objEt->getlocale, 'et'); $objEt->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_fi.t b/cpan/Unicode-Collate/t/loc_fi.t index c8be1fb7f2..b9bedc3a96 100644 --- a/cpan/Unicode-Collate/t/loc_fi.t +++ b/cpan/Unicode-Collate/t/loc_fi.t @@ -1,10 +1,26 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 82 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 82; +ok(1); + +######################### my $uuml = pack 'U', 0xFC; my $Uuml = pack 'U', 0xDC; @@ -22,7 +38,6 @@ my $Ostk = pack 'U', 0xD8; my $objFi = Unicode::Collate::Locale-> new(locale => 'FI', normalization => undef); -ok(1); ok($objFi->getlocale, 'fi'); $objFi->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_fil.t b/cpan/Unicode-Collate/t/loc_fil.t index 811f0dfaa0..bfa83af460 100644 --- a/cpan/Unicode-Collate/t/loc_fil.t +++ b/cpan/Unicode-Collate/t/loc_fil.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 14 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 14; +ok(1); + +######################### my $objFil = Unicode::Collate::Locale-> new(locale => 'FIL', normalization => undef); -ok(1); ok($objFil->getlocale, 'fil'); $objFil->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_fo.t b/cpan/Unicode-Collate/t/loc_fo.t index d476132471..6678b942d0 100644 --- a/cpan/Unicode-Collate/t/loc_fo.t +++ b/cpan/Unicode-Collate/t/loc_fo.t @@ -1,10 +1,26 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 105 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 105; +ok(1); + +######################### my $eth = pack 'U', 0xF0; my $ETH = pack 'U', 0xD0; @@ -26,7 +42,6 @@ my $Arng = pack 'U', 0xC5; my $objFo = Unicode::Collate::Locale-> new(locale => 'FO', normalization => undef); -ok(1); ok($objFo->getlocale, 'fo'); $objFo->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_fr.t b/cpan/Unicode-Collate/t/loc_fr.t index bfd7403ac1..4e2e5eacb8 100644 --- a/cpan/Unicode-Collate/t/loc_fr.t +++ b/cpan/Unicode-Collate/t/loc_fr.t @@ -1,10 +1,26 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 26 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 26; +ok(1); + +######################### my $ae = pack 'U', 0xE6; my $AE = pack 'U', 0xC6; @@ -12,7 +28,6 @@ my $AE = pack 'U', 0xC6; my $objFr = Unicode::Collate::Locale-> new(locale => 'FR', normalization => undef); -ok(1); ok($objFr->getlocale, 'fr'); $objFr->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_ha.t b/cpan/Unicode-Collate/t/loc_ha.t index 0f7c399b51..72e6742206 100644 --- a/cpan/Unicode-Collate/t/loc_ha.t +++ b/cpan/Unicode-Collate/t/loc_ha.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 34 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 34; +ok(1); + +######################### my $objHa = Unicode::Collate::Locale-> new(locale => 'HA', normalization => undef); -ok(1); ok($objHa->getlocale, 'ha'); $objHa->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_haw.t b/cpan/Unicode-Collate/t/loc_haw.t index ad0f1b1b43..3194da4605 100644 --- a/cpan/Unicode-Collate/t/loc_haw.t +++ b/cpan/Unicode-Collate/t/loc_haw.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 49 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 49; +ok(1); + +######################### my $objHaw = Unicode::Collate::Locale-> new(locale => 'HAW', normalization => undef); -ok(1); ok($objHaw->getlocale, 'haw'); $objHaw->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_hr.t b/cpan/Unicode-Collate/t/loc_hr.t index 026657e73e..5c01a0f4bb 100644 --- a/cpan/Unicode-Collate/t/loc_hr.t +++ b/cpan/Unicode-Collate/t/loc_hr.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 88 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 88; +ok(1); + +######################### my $objHr = Unicode::Collate::Locale-> new(locale => 'HR', normalization => undef); -ok(1); ok($objHr->getlocale, 'hr'); $objHr->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_hu.t b/cpan/Unicode-Collate/t/loc_hu.t index 85309a3722..b70907c074 100644 --- a/cpan/Unicode-Collate/t/loc_hu.t +++ b/cpan/Unicode-Collate/t/loc_hu.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 235 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 235; +ok(1); + +######################### my $objHu = Unicode::Collate::Locale-> new(locale => 'HU', normalization => undef); -ok(1); ok($objHu->getlocale, 'hu'); $objHu->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_hy.t b/cpan/Unicode-Collate/t/loc_hy.t index e3e1e1c5c6..e823aa5531 100644 --- a/cpan/Unicode-Collate/t/loc_hy.t +++ b/cpan/Unicode-Collate/t/loc_hy.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 13 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 13; +ok(1); + +######################### my $objHy = Unicode::Collate::Locale-> new(locale => 'HY', normalization => undef); -ok(1); ok($objHy->getlocale, 'hy'); $objHy->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_ig.t b/cpan/Unicode-Collate/t/loc_ig.t index 970bb7aaf0..09e39d5fc1 100644 --- a/cpan/Unicode-Collate/t/loc_ig.t +++ b/cpan/Unicode-Collate/t/loc_ig.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 108 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 108; +ok(1); + +######################### my $objIg = Unicode::Collate::Locale-> new(locale => 'IG', normalization => undef); -ok(1); ok($objIg->getlocale, 'ig'); $objIg->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_is.t b/cpan/Unicode-Collate/t/loc_is.t index e97357caf9..181dcbcf07 100644 --- a/cpan/Unicode-Collate/t/loc_is.t +++ b/cpan/Unicode-Collate/t/loc_is.t @@ -1,10 +1,26 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 110 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 110; +ok(1); + +######################### my $eth = pack 'U', 0xF0; my $ETH = pack 'U', 0xD0; @@ -24,7 +40,6 @@ my $Arng = pack 'U', 0xC5; my $objIs = Unicode::Collate::Locale-> new(locale => 'IS', normalization => undef); -ok(1); ok($objIs->getlocale, 'is'); $objIs->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_ja.t b/cpan/Unicode-Collate/t/loc_ja.t index 3e02520f97..5a774183c6 100644 --- a/cpan/Unicode-Collate/t/loc_ja.t +++ b/cpan/Unicode-Collate/t/loc_ja.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 490 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 475; +ok(1); + +######################### my $objJa = Unicode::Collate::Locale-> new(locale => 'JA', normalization => undef); -ok(1); ok($objJa->getlocale, 'ja'); $objJa->change(level => 1); @@ -35,6 +50,31 @@ ok($objJa->lt("\x{4E02}", "\x{3400}")); # 3400: Ext.A undef in JIS X 0208 # 17 +# Ext.B +ok($objJa->lt("\x{20000}", "\x{20001}")); +ok($objJa->lt("\x{20001}", "\x{20002}")); +ok($objJa->lt("\x{20002}", "\x{20003}")); +ok($objJa->lt("\x{20003}", "\x{20004}")); +ok($objJa->lt("\x{20004}", "\x{20005}")); + +# 22 + +$objJa->change(overrideCJK => undef); + +ok($objJa->lt("\x{4E00}", "\x{4E01}")); +ok($objJa->lt("\x{4E01}", "\x{4E02}")); +ok($objJa->lt("\x{4E02}", "\x{4E03}")); +ok($objJa->lt("\x{4E03}", "\x{4E04}")); +ok($objJa->lt("\x{4E04}", "\x{4E05}")); + +ok($objJa->lt("\x{9F9B}", "\x{9F9C}")); +ok($objJa->lt("\x{9F9C}", "\x{9F9D}")); +ok($objJa->lt("\x{9F9D}", "\x{9F9E}")); +ok($objJa->lt("\x{9F9E}", "\x{9F9F}")); +ok($objJa->lt("\x{9F9F}", "\x{9FA0}")); + +# 32 + $objJa->change(level => 3); ok($objJa->eq("\x{3041}", "\x{30A1}")); @@ -124,7 +164,7 @@ ok($objJa->eq("\x{3094}", "\x{30F4}")); ok($objJa->eq("\x{3095}", "\x{30F5}")); ok($objJa->eq("\x{3096}", "\x{30F6}")); -# 103 +# 118 $objJa->change(variable => 'Non-ignorable'); @@ -303,7 +343,7 @@ ok($objJa->eq("\x{FFEC}", "\x{2193}")); ok($objJa->eq("\x{FFED}", "\x{25A0}")); ok($objJa->eq("\x{FFEE}", "\x{25CB}")); -# 277 +# 292 $objJa->change(level => 4); @@ -394,7 +434,7 @@ ok($objJa->lt("\x{3094}", "\x{30F4}")); ok($objJa->lt("\x{3095}", "\x{30F5}")); ok($objJa->lt("\x{3096}", "\x{30F6}")); -# 363 +# 378 ok($objJa->eq("\x{304C}", "\x{304B}\x{3099}")); ok($objJa->eq("\x{304E}", "\x{304D}\x{3099}")); @@ -423,7 +463,7 @@ ok($objJa->eq("\x{307C}", "\x{307B}\x{3099}")); ok($objJa->eq("\x{307D}", "\x{307B}\x{309A}")); ok($objJa->eq("\x{3094}", "\x{3046}\x{3099}")); -# 389 +# 404 $objJa->change(katakana_before_hiragana => 1); @@ -514,4 +554,4 @@ ok($objJa->lt("\x{3094}", "\x{30F4}")); ok($objJa->lt("\x{3095}", "\x{30F5}")); ok($objJa->lt("\x{3096}", "\x{30F6}")); -# 475 +# 490 diff --git a/cpan/Unicode-Collate/t/loc_jait.t b/cpan/Unicode-Collate/t/loc_jait.t index 001fdfdead..4b0f031dad 100644 --- a/cpan/Unicode-Collate/t/loc_jait.t +++ b/cpan/Unicode-Collate/t/loc_jait.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 759 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 759; +ok(1); + +######################### my $objJa = Unicode::Collate::Locale-> new(locale => 'JA', normalization => undef); -ok(1); ok($objJa->getlocale, 'ja'); $objJa->change(level => 2); diff --git a/cpan/Unicode-Collate/t/loc_japr.t b/cpan/Unicode-Collate/t/loc_japr.t index 7f13e0858c..86dff87ab6 100644 --- a/cpan/Unicode-Collate/t/loc_japr.t +++ b/cpan/Unicode-Collate/t/loc_japr.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 602 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 602; +ok(1); + +######################### my $objJa = Unicode::Collate::Locale-> new(locale => 'JA', normalization => undef); -ok(1); ok($objJa->getlocale, 'ja'); $objJa->change(level => 2); diff --git a/cpan/Unicode-Collate/t/loc_kk.t b/cpan/Unicode-Collate/t/loc_kk.t index ecdfd6e95f..413d532e21 100644 --- a/cpan/Unicode-Collate/t/loc_kk.t +++ b/cpan/Unicode-Collate/t/loc_kk.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 149 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 149; +ok(1); + +######################### my $objKk = Unicode::Collate::Locale-> new(locale => 'KK', normalization => undef); -ok(1); ok($objKk->getlocale, 'kk'); $objKk->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_kl.t b/cpan/Unicode-Collate/t/loc_kl.t index bc19f8e73a..b123ed7d42 100644 --- a/cpan/Unicode-Collate/t/loc_kl.t +++ b/cpan/Unicode-Collate/t/loc_kl.t @@ -1,10 +1,26 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 101 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 101; +ok(1); + +######################### my $eth = pack 'U', 0xF0; my $ETH = pack 'U', 0xD0; @@ -26,7 +42,6 @@ my $Arng = pack 'U', 0xC5; my $objKl = Unicode::Collate::Locale-> new(locale => 'KL', normalization => undef); -ok(1); ok($objKl->getlocale, 'kl'); $objKl->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_ko.t b/cpan/Unicode-Collate/t/loc_ko.t index 268eb3bd8c..d680f67639 100644 --- a/cpan/Unicode-Collate/t/loc_ko.t +++ b/cpan/Unicode-Collate/t/loc_ko.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 52 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 42; +ok(1); + +######################### my $objKo = Unicode::Collate::Locale-> new(locale => 'KO', normalization => undef); -ok(1); ok($objKo->getlocale, 'ko'); $objKo->change(level => 1); @@ -40,6 +55,15 @@ ok($objKo->eq("\x{9821}", "\x{9EE0}")); # 22 +# Ext.B +ok($objKo->lt("\x{20000}", "\x{20001}")); +ok($objKo->lt("\x{20001}", "\x{20002}")); +ok($objKo->lt("\x{20002}", "\x{20003}")); +ok($objKo->lt("\x{20003}", "\x{20004}")); +ok($objKo->lt("\x{20004}", "\x{20005}")); + +# 27 + $objKo->change(level => 2); ok($objKo->lt("\x{AC00}", "\x{4F3D}")); @@ -66,4 +90,13 @@ ok($objKo->lt("\x{7E88}", "\x{896D}")); ok($objKo->lt("\x{896D}", "\x{9821}")); ok($objKo->lt("\x{9821}", "\x{9EE0}")); -#42 +# 47 + +# Ext.B +ok($objKo->lt("\x{20000}", "\x{20001}")); +ok($objKo->lt("\x{20001}", "\x{20002}")); +ok($objKo->lt("\x{20002}", "\x{20003}")); +ok($objKo->lt("\x{20003}", "\x{20004}")); +ok($objKo->lt("\x{20004}", "\x{20005}")); + +# 52 diff --git a/cpan/Unicode-Collate/t/loc_lt.t b/cpan/Unicode-Collate/t/loc_lt.t index ef5da1c395..86c508c781 100644 --- a/cpan/Unicode-Collate/t/loc_lt.t +++ b/cpan/Unicode-Collate/t/loc_lt.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 55 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 55; +ok(1); + +######################### my $objLt = Unicode::Collate::Locale-> new(locale => 'LT', normalization => undef); -ok(1); ok($objLt->getlocale, 'lt'); $objLt->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_lv.t b/cpan/Unicode-Collate/t/loc_lv.t index 6f411663fb..f67d82db08 100644 --- a/cpan/Unicode-Collate/t/loc_lv.t +++ b/cpan/Unicode-Collate/t/loc_lv.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 50 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 50; +ok(1); + +######################### my $objLv = Unicode::Collate::Locale-> new(locale => 'LV', normalization => undef); -ok(1); ok($objLv->getlocale, 'lv'); $objLv->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_mk.t b/cpan/Unicode-Collate/t/loc_mk.t index 87164baa25..1df037ef50 100644 --- a/cpan/Unicode-Collate/t/loc_mk.t +++ b/cpan/Unicode-Collate/t/loc_mk.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 130 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 130; +ok(1); + +######################### my $objMk = Unicode::Collate::Locale-> new(locale => 'MK', normalization => undef); -ok(1); ok($objMk->getlocale, 'mk'); $objMk->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_mt.t b/cpan/Unicode-Collate/t/loc_mt.t index 3a5c92cf90..f3e15ba19c 100644 --- a/cpan/Unicode-Collate/t/loc_mt.t +++ b/cpan/Unicode-Collate/t/loc_mt.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 50 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 44; +ok(1); + +######################### my $objMt = Unicode::Collate::Locale-> new(locale => 'MT', normalization => undef); -ok(1); ok($objMt->getlocale, 'mt'); $objMt->change(level => 1); @@ -74,3 +89,14 @@ ok($objMt->gt("y", "Y")); ok($objMt->gt("z", "Z")); # 44 + +$objMt->change(upper_before_lower => 0); + +ok($objMt->lt("a", "A")); +ok($objMt->lt("b", "B")); +ok($objMt->lt("c", "C")); +ok($objMt->lt("x", "X")); +ok($objMt->lt("y", "Y")); +ok($objMt->lt("z", "Z")); + +# 50 diff --git a/cpan/Unicode-Collate/t/loc_nb.t b/cpan/Unicode-Collate/t/loc_nb.t index 0aba13437a..8ca61cbad4 100644 --- a/cpan/Unicode-Collate/t/loc_nb.t +++ b/cpan/Unicode-Collate/t/loc_nb.t @@ -1,10 +1,26 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 95 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 95; +ok(1); + +######################### my $eth = pack 'U', 0xF0; my $ETH = pack 'U', 0xD0; @@ -26,7 +42,6 @@ my $Arng = pack 'U', 0xC5; my $objNb = Unicode::Collate::Locale-> new(locale => 'NB', normalization => undef); -ok(1); ok($objNb->getlocale, 'nb'); $objNb->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_nn.t b/cpan/Unicode-Collate/t/loc_nn.t index 9f3cb0be37..50503a32af 100644 --- a/cpan/Unicode-Collate/t/loc_nn.t +++ b/cpan/Unicode-Collate/t/loc_nn.t @@ -1,10 +1,26 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 95 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 95; +ok(1); + +######################### my $eth = pack 'U', 0xF0; my $ETH = pack 'U', 0xD0; @@ -26,7 +42,6 @@ my $Arng = pack 'U', 0xC5; my $objNn = Unicode::Collate::Locale-> new(locale => 'NN', normalization => undef); -ok(1); ok($objNn->getlocale, 'nn'); $objNn->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_nso.t b/cpan/Unicode-Collate/t/loc_nso.t index e0fab023bc..402e25ada1 100644 --- a/cpan/Unicode-Collate/t/loc_nso.t +++ b/cpan/Unicode-Collate/t/loc_nso.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 40 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 40; +ok(1); + +######################### my $objNso = Unicode::Collate::Locale-> new(locale => 'NSO', normalization => undef); -ok(1); ok($objNso->getlocale, 'nso'); $objNso->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_om.t b/cpan/Unicode-Collate/t/loc_om.t index ed25934ddc..eba364fb8a 100644 --- a/cpan/Unicode-Collate/t/loc_om.t +++ b/cpan/Unicode-Collate/t/loc_om.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 41 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 41; +ok(1); + +######################### my $objOm = Unicode::Collate::Locale-> new(locale => 'OM', normalization => undef); -ok(1); ok($objOm->getlocale, 'om'); $objOm->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_pl.t b/cpan/Unicode-Collate/t/loc_pl.t index 5291062fe1..a4f07ad11f 100644 --- a/cpan/Unicode-Collate/t/loc_pl.t +++ b/cpan/Unicode-Collate/t/loc_pl.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 65 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 65; +ok(1); + +######################### my $objPl = Unicode::Collate::Locale-> new(locale => 'PL', normalization => undef); -ok(1); ok($objPl->getlocale, 'pl'); $objPl->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_ro.t b/cpan/Unicode-Collate/t/loc_ro.t index 8fa95438fb..9a88320cea 100644 --- a/cpan/Unicode-Collate/t/loc_ro.t +++ b/cpan/Unicode-Collate/t/loc_ro.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 71 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 71; +ok(1); + +######################### my $objRo = Unicode::Collate::Locale-> new(locale => 'RO', normalization => undef); -ok(1); ok($objRo->getlocale, 'ro'); $objRo->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_ru.t b/cpan/Unicode-Collate/t/loc_ru.t index 111f81d91d..bdd81cbaf8 100644 --- a/cpan/Unicode-Collate/t/loc_ru.t +++ b/cpan/Unicode-Collate/t/loc_ru.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 130 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 130; +ok(1); + +######################### my $objRu = Unicode::Collate::Locale-> new(locale => 'RU', normalization => undef); -ok(1); ok($objRu->getlocale, 'ru'); $objRu->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_se.t b/cpan/Unicode-Collate/t/loc_se.t index 9e3ecf0037..718b5df022 100644 --- a/cpan/Unicode-Collate/t/loc_se.t +++ b/cpan/Unicode-Collate/t/loc_se.t @@ -1,10 +1,26 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 217 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 217; +ok(1); + +######################### my $objSe = Unicode::Collate::Locale-> new(locale => 'SE', normalization => undef); @@ -16,7 +32,6 @@ my $THRN = pack 'U', 0xDE; my $ae = pack 'U', 0xE6; my $AE = pack 'U', 0xC6; -ok(1); ok($objSe->getlocale, 'se'); $objSe->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_sk.t b/cpan/Unicode-Collate/t/loc_sk.t index 9ed6f0a29a..79ed15fe49 100644 --- a/cpan/Unicode-Collate/t/loc_sk.t +++ b/cpan/Unicode-Collate/t/loc_sk.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 52 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 52; +ok(1); + +######################### my $objSk = Unicode::Collate::Locale-> new(locale => 'SK', normalization => undef); -ok(1); ok($objSk->getlocale, 'sk'); $objSk->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_sl.t b/cpan/Unicode-Collate/t/loc_sl.t index 0c5ddbbec5..8fb595d369 100644 --- a/cpan/Unicode-Collate/t/loc_sl.t +++ b/cpan/Unicode-Collate/t/loc_sl.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 20 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 20; +ok(1); + +######################### my $objSl = Unicode::Collate::Locale-> new(locale => 'SL', normalization => undef); -ok(1); ok($objSl->getlocale, 'sl'); $objSl->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_sq.t b/cpan/Unicode-Collate/t/loc_sq.t index 93b4a706e5..16c8f1cb96 100644 --- a/cpan/Unicode-Collate/t/loc_sq.t +++ b/cpan/Unicode-Collate/t/loc_sq.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 126 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 126; +ok(1); + +######################### my $objSq = Unicode::Collate::Locale-> new(locale => 'SQ', normalization => undef); -ok(1); ok($objSq->getlocale, 'sq'); $objSq->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_sr.t b/cpan/Unicode-Collate/t/loc_sr.t index a80fc6208d..70a0a934f2 100644 --- a/cpan/Unicode-Collate/t/loc_sr.t +++ b/cpan/Unicode-Collate/t/loc_sr.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 130 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 130; +ok(1); + +######################### my $objSr = Unicode::Collate::Locale-> new(locale => 'SR', normalization => undef); -ok(1); ok($objSr->getlocale, 'sr'); $objSr->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_sv.t b/cpan/Unicode-Collate/t/loc_sv.t index 7266f5e6a3..c905e14717 100644 --- a/cpan/Unicode-Collate/t/loc_sv.t +++ b/cpan/Unicode-Collate/t/loc_sv.t @@ -1,10 +1,26 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 117 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 117; +ok(1); + +######################### my $eth = pack 'U', 0xF0; my $ETH = pack 'U', 0xD0; @@ -28,7 +44,6 @@ my $Ocrc = pack 'U', 0xD4; my $objSv = Unicode::Collate::Locale-> new(locale => 'SV', normalization => undef); -ok(1); ok($objSv->getlocale, 'sv'); $objSv->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_sw.t b/cpan/Unicode-Collate/t/loc_sw.t index 403d209bc8..1805c1b497 100644 --- a/cpan/Unicode-Collate/t/loc_sw.t +++ b/cpan/Unicode-Collate/t/loc_sw.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 72 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 72; +ok(1); + +######################### my $objSw = Unicode::Collate::Locale-> new(locale => 'SW', normalization => undef); -ok(1); ok($objSw->getlocale, 'sw'); $objSw->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_test.t b/cpan/Unicode-Collate/t/loc_test.t index 6313926979..d1b5b4a1e4 100644 --- a/cpan/Unicode-Collate/t/loc_test.t +++ b/cpan/Unicode-Collate/t/loc_test.t @@ -1,11 +1,28 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 116 }; + use strict; use warnings; use Unicode::Collate::Locale; -our (@listEs, @listEsT, @listFr); +ok(1); -BEGIN { +######################### + +our (@listEs, @listEsT, @listFr); @listEs = qw( cambio camella camello camelo Camerún @@ -33,15 +50,15 @@ BEGIN { "vice versa", "vice-versa", ); -use Test; -plan tests => 10 + $#listEs + 2 + $#listEsT + 2 + $#listFr + 2; +ok(@listEs, 27); +ok(@listEsT, 27); +ok(@listFr, 46); -} - -ok(1); ok(Unicode::Collate::Locale::_locale('es_MX'), 'es'); ok(Unicode::Collate::Locale::_locale('en_CA'), 'default'); +# 6 + my $Collator = Unicode::Collate::Locale-> new(normalization => undef); ok($Collator->getlocale, 'default'); @@ -60,6 +77,8 @@ ok($Collator->eq("", "")); ok($Collator->cmp("", "perl"), -1); ok($Collator->gt("PERL", "perl")); +# 12 + $Collator->change(level => 2); ok($Collator->eq("PERL", "perl")); @@ -76,19 +95,24 @@ my $objFr = Unicode::Collate::Locale->new (normalization => undef, locale => 'FR'); ok($objFr->getlocale, 'fr'); +# 16 + sub randomize { my %hash; @hash{@_} = (); keys %hash; } # ?! for (my $i = 0; $i < $#listEs; $i++) { ok($objEs->lt($listEs[$i], $listEs[$i+1])); } +# 42 for (my $i = 0; $i < $#listEsT; $i++) { ok($objEsT->lt($listEsT[$i], $listEsT[$i+1])); } +# 68 for (my $i = 0; $i < $#listFr; $i++) { ok($objFr->lt($listFr[$i], $listFr[$i+1])); } +# 113 our @randEs = randomize(@listEs); our @sortEs = $objEs->sort(@randEs); @@ -102,5 +126,4 @@ our @randFr = randomize(@listFr); our @sortFr = $objFr->sort(@randFr); ok("@sortFr" eq "@listFr"); -__END__ - +# 116 diff --git a/cpan/Unicode-Collate/t/loc_tn.t b/cpan/Unicode-Collate/t/loc_tn.t index 07e1f808ac..c068a5d791 100644 --- a/cpan/Unicode-Collate/t/loc_tn.t +++ b/cpan/Unicode-Collate/t/loc_tn.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 40 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 40; +ok(1); + +######################### my $objTn = Unicode::Collate::Locale-> new(locale => 'TN', normalization => undef); -ok(1); ok($objTn->getlocale, 'tn'); $objTn->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_to.t b/cpan/Unicode-Collate/t/loc_to.t index a14c7290f0..aa71033875 100644 --- a/cpan/Unicode-Collate/t/loc_to.t +++ b/cpan/Unicode-Collate/t/loc_to.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 132 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 132; +ok(1); + +######################### my $objTo = Unicode::Collate::Locale-> new(locale => 'TO', normalization => undef); -ok(1); ok($objTo->getlocale, 'to'); $objTo->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_tr.t b/cpan/Unicode-Collate/t/loc_tr.t index 6459294710..26b3808f25 100644 --- a/cpan/Unicode-Collate/t/loc_tr.t +++ b/cpan/Unicode-Collate/t/loc_tr.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 57 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 57; +ok(1); + +######################### my $objTr = Unicode::Collate::Locale-> new(locale => 'TR', normalization => undef); -ok(1); ok($objTr->getlocale, 'tr'); $objTr->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_uk.t b/cpan/Unicode-Collate/t/loc_uk.t index c84466de80..13258bb5a4 100644 --- a/cpan/Unicode-Collate/t/loc_uk.t +++ b/cpan/Unicode-Collate/t/loc_uk.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 7 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 7; +ok(1); + +######################### my $objUk = Unicode::Collate::Locale-> new(locale => 'UK', normalization => undef); -ok(1); ok($objUk->getlocale, 'uk'); $objUk->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_vi.t b/cpan/Unicode-Collate/t/loc_vi.t index 75bb5ba083..543d5797ba 100644 --- a/cpan/Unicode-Collate/t/loc_vi.t +++ b/cpan/Unicode-Collate/t/loc_vi.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 424 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 424; +ok(1); + +######################### my $objVi = Unicode::Collate::Locale-> new(locale => 'VI', normalization => undef); -ok(1); ok($objVi->getlocale, 'vi'); $objVi->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_wo.t b/cpan/Unicode-Collate/t/loc_wo.t index 48cb8df21d..3abbf102b4 100644 --- a/cpan/Unicode-Collate/t/loc_wo.t +++ b/cpan/Unicode-Collate/t/loc_wo.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 40 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 40; +ok(1); + +######################### my $objWo = Unicode::Collate::Locale-> new(locale => 'WO', normalization => undef); -ok(1); ok($objWo->getlocale, 'wo'); $objWo->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_yo.t b/cpan/Unicode-Collate/t/loc_yo.t index 06823f5719..952f62366f 100644 --- a/cpan/Unicode-Collate/t/loc_yo.t +++ b/cpan/Unicode-Collate/t/loc_yo.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 33 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 33; +ok(1); + +######################### my $objYo = Unicode::Collate::Locale-> new(locale => 'YO', normalization => undef); -ok(1); ok($objYo->getlocale, 'yo'); $objYo->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_zh.t b/cpan/Unicode-Collate/t/loc_zh.t index d91431c38e..0f01057b0b 100644 --- a/cpan/Unicode-Collate/t/loc_zh.t +++ b/cpan/Unicode-Collate/t/loc_zh.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 272 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 272; +ok(1); + +######################### my $objZh = Unicode::Collate::Locale-> new(locale => 'ZH', normalization => undef); -ok(1); ok($objZh->getlocale, 'zh'); $objZh->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_zhb5.t b/cpan/Unicode-Collate/t/loc_zhb5.t index c4b8c5270c..d466803b8c 100644 --- a/cpan/Unicode-Collate/t/loc_zhb5.t +++ b/cpan/Unicode-Collate/t/loc_zhb5.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 293 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 293; +ok(1); + +######################### my $objZhB = Unicode::Collate::Locale-> new(locale => 'ZH__big5han', normalization => undef); -ok(1); ok($objZhB->getlocale, 'zh__big5han'); $objZhB->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_zhgb.t b/cpan/Unicode-Collate/t/loc_zhgb.t index 486431d28f..b9f4c12fe4 100644 --- a/cpan/Unicode-Collate/t/loc_zhgb.t +++ b/cpan/Unicode-Collate/t/loc_zhgb.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 290 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 290; +ok(1); + +######################### my $objZhG = Unicode::Collate::Locale-> new(locale => 'ZH__gb2312han', normalization => undef); -ok(1); ok($objZhG->getlocale, 'zh__gb2312han'); $objZhG->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_zhpy.t b/cpan/Unicode-Collate/t/loc_zhpy.t index b65ae52282..193d158e7f 100644 --- a/cpan/Unicode-Collate/t/loc_zhpy.t +++ b/cpan/Unicode-Collate/t/loc_zhpy.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 302 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 302; +ok(1); + +######################### my $objZhP = Unicode::Collate::Locale-> new(locale => 'ZH__pinyin', normalization => undef); -ok(1); ok($objZhP->getlocale, 'zh__pinyin'); $objZhP->change(level => 1); diff --git a/cpan/Unicode-Collate/t/loc_zhst.t b/cpan/Unicode-Collate/t/loc_zhst.t index 2ca464917c..8f60ed69f0 100644 --- a/cpan/Unicode-Collate/t/loc_zhst.t +++ b/cpan/Unicode-Collate/t/loc_zhst.t @@ -1,15 +1,30 @@ -#!perl + +BEGIN { + unless ("A" eq pack('U', 0x41)) { + print "1..0 # Unicode::Collate " . + "cannot stringify a Unicode code point\n"; + exit 0; + } + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = $^O eq 'MacOS' ? qw(::lib) : qw(../lib); + } +} + +use Test; +BEGIN { plan tests => 291 }; + use strict; use warnings; use Unicode::Collate::Locale; -use Test; -plan tests => 291; +ok(1); + +######################### my $objZhS = Unicode::Collate::Locale-> new(locale => 'ZH__stroke', normalization => undef); -ok(1); ok($objZhS->getlocale, 'zh__stroke'); $objZhS->change(level => 1); diff --git a/cpan/Unicode-Collate/t/nonchar.t b/cpan/Unicode-Collate/t/nonchar.t index ed11bf26d2..d789307b48 100644 --- a/cpan/Unicode-Collate/t/nonchar.t +++ b/cpan/Unicode-Collate/t/nonchar.t @@ -26,7 +26,7 @@ BEGIN { } } -BEGIN { plan tests => 27 }; +BEGIN { plan tests => 61 }; # 1 + 30 * 2 ok(1); @@ -45,76 +45,70 @@ no warnings 'utf8'; # 2. A special noncharacter <LOW> (U+FFFE) for merged database fields, # allowing "Disi\x{301}lva<LOW>John" to sort next to "Disilva<LOW>John". -my $Collator = Unicode::Collate->new( - table => 'keys.txt', - level => 1, - normalization => undef, - UCA_Version => 22, - entry => <<'ENTRIES', +my $entry = <<'ENTRIES'; FFFE ; [*0001.0020.0005.FFFE] # <noncharacter-FFFE> FFFF ; [.FFFE.0020.0005.FFFF] # <noncharacter-FFFF> ENTRIES -); - -# 2..16 - -ok($Collator->lt("\x{FFFD}", "\x{FFFF}")); -ok($Collator->lt("\x{1FFFD}", "\x{1FFFF}")); -ok($Collator->lt("\x{2FFFD}", "\x{2FFFF}")); -ok($Collator->lt("\x{10FFFD}", "\x{10FFFF}")); - -ok($Collator->lt("perl\x{FFFD}", "perl\x{FFFF}")); -ok($Collator->lt("perl\x{1FFFD}", "perl\x{FFFF}")); -ok($Collator->lt("perl\x{1FFFE}", "perl\x{FFFF}")); -ok($Collator->lt("perl\x{1FFFF}", "perl\x{FFFF}")); -ok($Collator->lt("perl\x{2FFFD}", "perl\x{FFFF}")); -ok($Collator->lt("perl\x{2FFFE}", "perl\x{FFFF}")); -ok($Collator->lt("perl\x{2FFFF}", "perl\x{FFFF}")); -ok($Collator->lt("perl\x{10FFFD}", "perl\x{FFFF}")); -ok($Collator->lt("perl\x{10FFFE}", "perl\x{FFFF}")); -ok($Collator->lt("perl\x{10FFFF}", "perl\x{FFFF}")); - -ok($Collator->gt("perl\x{FFFF}AB", "perl\x{FFFF}")); - -$Collator->change(level => 4); - -# 17..23 - -my @dsf = ( - "di Silva\x{FFFE}Fred", - "diSilva\x{FFFE}Fred", - "di Si\x{301}lva\x{FFFE}Fred", - "diSi\x{301}lva\x{FFFE}Fred", -); -my @dsj = ( - "di Silva\x{FFFE}John", - "diSilva\x{FFFE}John", - "di Si\x{301}lva\x{FFFE}John", - "diSi\x{301}lva\x{FFFE}John", -); - -ok($Collator->lt($dsf[0], $dsf[1])); -ok($Collator->lt($dsf[1], $dsf[2])); -ok($Collator->lt($dsf[2], $dsf[3])); - -ok($Collator->lt($dsf[3], $dsj[0])); - -ok($Collator->lt($dsj[0], $dsj[1])); -ok($Collator->lt($dsj[1], $dsj[2])); -ok($Collator->lt($dsj[2], $dsj[3])); - -# 24..27 - -my @ds_j = ( - "di Silva John", - "diSilva John", - "di Si\x{301}lva John", - "diSi\x{301}lva John", -); - -ok($Collator->lt($ds_j[0], $ds_j[1])); -ok($Collator->lt($ds_j[1], $ds_j[2])); -ok($Collator->lt($ds_j[2], $ds_j[3])); - -ok($Collator->lt($dsj[0], $ds_j[0])); + +my @disilva = ("di Silva", "diSilva", "di Si\x{301}lva", "diSi\x{301}lva"); +my @dsf = map "$_\x{FFFE}Fred", @disilva; +my @dsj = map "$_\x{FFFE}John", @disilva; +my @dsJ = map "$_ John", @disilva; + +for my $norm (undef, 'NFD') { + if (defined $norm) { + eval { require Unicode::Normalize }; + if ($@) { + ok(1) for 1..30; # silent skip + next; + } + } + + my $coll = Unicode::Collate->new( + table => 'keys.txt', + level => 1, + normalization => $norm, + UCA_Version => 22, + entry => $entry, + ); + + # 1..4 + ok($coll->lt("\x{FFFD}", "\x{FFFF}")); + ok($coll->lt("\x{1FFFD}", "\x{1FFFF}")); + ok($coll->lt("\x{2FFFD}", "\x{2FFFF}")); + ok($coll->lt("\x{10FFFD}", "\x{10FFFF}")); + + # 5..14 + ok($coll->lt("perl\x{FFFD}", "perl\x{FFFF}")); + ok($coll->lt("perl\x{1FFFD}", "perl\x{FFFF}")); + ok($coll->lt("perl\x{1FFFE}", "perl\x{FFFF}")); + ok($coll->lt("perl\x{1FFFF}", "perl\x{FFFF}")); + ok($coll->lt("perl\x{2FFFD}", "perl\x{FFFF}")); + ok($coll->lt("perl\x{2FFFE}", "perl\x{FFFF}")); + ok($coll->lt("perl\x{2FFFF}", "perl\x{FFFF}")); + ok($coll->lt("perl\x{10FFFD}", "perl\x{FFFF}")); + ok($coll->lt("perl\x{10FFFE}", "perl\x{FFFF}")); + ok($coll->lt("perl\x{10FFFF}", "perl\x{FFFF}")); + + # 15..16 + ok($coll->gt("perl\x{FFFF}AB", "perl\x{FFFF}")); + ok($coll->lt("perl\x{FFFF}\x{10FFFF}", "perl\x{FFFF}\x{FFFF}")); + + $coll->change(level => 4); + + # 17..25 + for my $i (0 .. $#disilva - 1) { + ok($coll->lt($dsf[$i], $dsf[$i+1])); + ok($coll->lt($dsj[$i], $dsj[$i+1])); + ok($coll->lt($dsJ[$i], $dsJ[$i+1])); + } + + # 26 + ok($coll->lt($dsf[-1], $dsj[0])); + + # 27..30 + for my $i (0 .. $#disilva) { + ok($coll->lt($dsj[$i], $dsJ[$i])); + } +} diff --git a/cpan/Unicode-Collate/t/overcjk0.t b/cpan/Unicode-Collate/t/overcjk0.t index 016abe08b6..1dba193f61 100644 --- a/cpan/Unicode-Collate/t/overcjk0.t +++ b/cpan/Unicode-Collate/t/overcjk0.t @@ -20,7 +20,9 @@ use Unicode::Collate; ok(1); -##### 2..6 +######################### + +# 2..6 my $ignoreCJK = Unicode::Collate->new( table => undef, @@ -54,45 +56,46 @@ ok($ignoreCJK->lt("Pe\x{5B57}rl", "Perl")); # 'r' is unassigned. my @Versions = (8, 9, 11, 14, 16, 18, 20, 22); for my $v (@Versions) { -$ignoreCJK->change(UCA_Version => $v); - -# UI -ok($ignoreCJK->cmp("\x{4E00}", "") == 0); -ok($ignoreCJK->cmp("\x{9FA5}", "") == 0); -ok($ignoreCJK->cmp("\x{9FA6}", "") == ($v >= 14 ? 0 : 1)); -ok($ignoreCJK->cmp("\x{9FAF}", "") == ($v >= 14 ? 0 : 1)); -ok($ignoreCJK->cmp("\x{9FB0}", "") == ($v >= 14 ? 0 : 1)); -ok($ignoreCJK->cmp("\x{9FBB}", "") == ($v >= 14 ? 0 : 1)); -ok($ignoreCJK->cmp("\x{9FBC}", "") == ($v >= 18 ? 0 : 1)); -ok($ignoreCJK->cmp("\x{9FBF}", "") == ($v >= 18 ? 0 : 1)); -ok($ignoreCJK->cmp("\x{9FC0}", "") == ($v >= 18 ? 0 : 1)); -ok($ignoreCJK->cmp("\x{9FC3}", "") == ($v >= 18 ? 0 : 1)); -ok($ignoreCJK->cmp("\x{9FC4}", "") == ($v >= 20 ? 0 : 1)); -ok($ignoreCJK->cmp("\x{9FCB}", "") == ($v >= 20 ? 0 : 1)); -ok($ignoreCJK->cmp("\x{9FCC}", "") == 1); -ok($ignoreCJK->cmp("\x{9FCF}", "") == 1); - -# Ext.A -ok($ignoreCJK->cmp("\x{3400}", "") == 0); -ok($ignoreCJK->cmp("\x{4DB5}", "") == 0); -ok($ignoreCJK->cmp("\x{4DB6}", "") == 1); -ok($ignoreCJK->cmp("\x{4DBF}", "") == 1); - -# Ext.B -ok($ignoreCJK->cmp("\x{20000}","") == 0); -ok($ignoreCJK->cmp("\x{2A6D6}","") == 0); -ok($ignoreCJK->cmp("\x{2A6D7}","") == 1); -ok($ignoreCJK->cmp("\x{2A6DF}","") == 1); - -# Ext.C -ok($ignoreCJK->cmp("\x{2A700}","") == ($v >= 20 ? 0 : 1)); -ok($ignoreCJK->cmp("\x{2B734}","") == ($v >= 20 ? 0 : 1)); -ok($ignoreCJK->cmp("\x{2B735}","") == 1); -ok($ignoreCJK->cmp("\x{2B73F}","") == 1); - -# Ext.D -ok($ignoreCJK->cmp("\x{2B740}","") == ($v >= 22 ? 0 : 1)); -ok($ignoreCJK->cmp("\x{2B81D}","") == ($v >= 22 ? 0 : 1)); -ok($ignoreCJK->cmp("\x{2B81E}","") == 1); -ok($ignoreCJK->cmp("\x{2B81F}","") == 1); + $ignoreCJK->change(UCA_Version => $v); + + # UI + ok($ignoreCJK->cmp("\x{4E00}", "") == 0); + ok($ignoreCJK->cmp("\x{9FA5}", "") == 0); + ok($ignoreCJK->cmp("\x{9FA6}", "") == ($v >= 14 ? 0 : 1)); + ok($ignoreCJK->cmp("\x{9FAF}", "") == ($v >= 14 ? 0 : 1)); + ok($ignoreCJK->cmp("\x{9FB0}", "") == ($v >= 14 ? 0 : 1)); + ok($ignoreCJK->cmp("\x{9FBB}", "") == ($v >= 14 ? 0 : 1)); + ok($ignoreCJK->cmp("\x{9FBC}", "") == ($v >= 18 ? 0 : 1)); + ok($ignoreCJK->cmp("\x{9FBF}", "") == ($v >= 18 ? 0 : 1)); + ok($ignoreCJK->cmp("\x{9FC0}", "") == ($v >= 18 ? 0 : 1)); + ok($ignoreCJK->cmp("\x{9FC3}", "") == ($v >= 18 ? 0 : 1)); + ok($ignoreCJK->cmp("\x{9FC4}", "") == ($v >= 20 ? 0 : 1)); + ok($ignoreCJK->cmp("\x{9FCB}", "") == ($v >= 20 ? 0 : 1)); + ok($ignoreCJK->cmp("\x{9FCC}", "") == 1); + ok($ignoreCJK->cmp("\x{9FCF}", "") == 1); + + # Ext.A + ok($ignoreCJK->cmp("\x{3400}", "") == 0); + ok($ignoreCJK->cmp("\x{4DB5}", "") == 0); + ok($ignoreCJK->cmp("\x{4DB6}", "") == 1); + ok($ignoreCJK->cmp("\x{4DBF}", "") == 1); + + # Ext.B + ok($ignoreCJK->cmp("\x{20000}","") == 0); + ok($ignoreCJK->cmp("\x{2A6D6}","") == 0); + ok($ignoreCJK->cmp("\x{2A6D7}","") == 1); + ok($ignoreCJK->cmp("\x{2A6DF}","") == 1); + + # Ext.C + ok($ignoreCJK->cmp("\x{2A700}","") == ($v >= 20 ? 0 : 1)); + ok($ignoreCJK->cmp("\x{2B734}","") == ($v >= 20 ? 0 : 1)); + ok($ignoreCJK->cmp("\x{2B735}","") == 1); + ok($ignoreCJK->cmp("\x{2B73F}","") == 1); + + # Ext.D + ok($ignoreCJK->cmp("\x{2B740}","") == ($v >= 22 ? 0 : 1)); + ok($ignoreCJK->cmp("\x{2B81D}","") == ($v >= 22 ? 0 : 1)); + ok($ignoreCJK->cmp("\x{2B81E}","") == 1); + ok($ignoreCJK->cmp("\x{2B81F}","") == 1); } + diff --git a/cpan/Unicode-Collate/t/overcjk1.t b/cpan/Unicode-Collate/t/overcjk1.t index b05340e704..600f0ad586 100644 --- a/cpan/Unicode-Collate/t/overcjk1.t +++ b/cpan/Unicode-Collate/t/overcjk1.t @@ -20,7 +20,9 @@ use Unicode::Collate; ok(1); -##### 2..11 +######################### + +# 2..11 my $overCJK = Unicode::Collate->new( table => 'keys.txt', @@ -54,20 +56,21 @@ ok($overCJK->lt("a\x{4E03}", "A\x{4E01}")); my @Versions = (8, 9, 11, 14, 16, 18, 20, 22); for my $v (@Versions) { -$overCJK->change(UCA_Version => $v); -ok($overCJK->cmp("a\x{3400}", "A\x{4DB5}") == 1); -ok($overCJK->cmp("a\x{4DB5}", "A\x{4E00}") == 1); -ok($overCJK->cmp("a\x{4E00}", "A\x{9FA5}") == 1); -ok($overCJK->cmp("a\x{9FA5}", "A\x{9FA6}") == ($v >= 14 ? 1 : -1)); -ok($overCJK->cmp("a\x{9FA6}", "A\x{9FAF}") == ($v >= 14 ? 1 : -1)); -ok($overCJK->cmp("a\x{9FAF}", "A\x{9FB0}") == ($v >= 14 ? 1 : -1)); -ok($overCJK->cmp("a\x{9FB0}", "A\x{9FBB}") == ($v >= 14 ? 1 : -1)); -ok($overCJK->cmp("a\x{9FBB}", "A\x{9FBC}") == ($v >= 18 ? 1 : -1)); -ok($overCJK->cmp("a\x{9FBC}", "A\x{9FBF}") == ($v >= 18 ? 1 : -1)); -ok($overCJK->cmp("a\x{9FBF}", "A\x{9FC3}") == ($v >= 18 ? 1 : -1)); -ok($overCJK->cmp("a\x{9FC3}", "A\x{9FC4}") == ($v >= 20 ? 1 : -1)); -ok($overCJK->cmp("a\x{9FC4}", "A\x{9FCA}") == ($v >= 20 ? 1 : -1)); -ok($overCJK->cmp("a\x{9FCA}", "A\x{9FCB}") == ($v >= 20 ? 1 : -1)); -ok($overCJK->cmp("a\x{9FCB}", "A\x{9FCC}") == -1); -ok($overCJK->cmp("a\x{9FCC}", "A\x{9FCF}") == -1); + $overCJK->change(UCA_Version => $v); + ok($overCJK->cmp("a\x{3400}", "A\x{4DB5}") == 1); + ok($overCJK->cmp("a\x{4DB5}", "A\x{4E00}") == 1); + ok($overCJK->cmp("a\x{4E00}", "A\x{9FA5}") == 1); + ok($overCJK->cmp("a\x{9FA5}", "A\x{9FA6}") == ($v >= 14 ? 1 : -1)); + ok($overCJK->cmp("a\x{9FA6}", "A\x{9FAF}") == ($v >= 14 ? 1 : -1)); + ok($overCJK->cmp("a\x{9FAF}", "A\x{9FB0}") == ($v >= 14 ? 1 : -1)); + ok($overCJK->cmp("a\x{9FB0}", "A\x{9FBB}") == ($v >= 14 ? 1 : -1)); + ok($overCJK->cmp("a\x{9FBB}", "A\x{9FBC}") == ($v >= 18 ? 1 : -1)); + ok($overCJK->cmp("a\x{9FBC}", "A\x{9FBF}") == ($v >= 18 ? 1 : -1)); + ok($overCJK->cmp("a\x{9FBF}", "A\x{9FC3}") == ($v >= 18 ? 1 : -1)); + ok($overCJK->cmp("a\x{9FC3}", "A\x{9FC4}") == ($v >= 20 ? 1 : -1)); + ok($overCJK->cmp("a\x{9FC4}", "A\x{9FCA}") == ($v >= 20 ? 1 : -1)); + ok($overCJK->cmp("a\x{9FCA}", "A\x{9FCB}") == ($v >= 20 ? 1 : -1)); + ok($overCJK->cmp("a\x{9FCB}", "A\x{9FCC}") == -1); + ok($overCJK->cmp("a\x{9FCC}", "A\x{9FCF}") == -1); } + diff --git a/cpan/Unicode-Collate/t/override.t b/cpan/Unicode-Collate/t/override.t index 032db15bb1..bb15ffdfe7 100644 --- a/cpan/Unicode-Collate/t/override.t +++ b/cpan/Unicode-Collate/t/override.t @@ -1,3 +1,4 @@ + BEGIN { unless ("A" eq pack('U', 0x41)) { print "1..0 # Unicode::Collate " . @@ -19,6 +20,8 @@ use Unicode::Collate; ok(1); +######################### + ##### 2..6 my $all_undef_8 = Unicode::Collate->new( diff --git a/cpan/Unicode-Collate/t/test.t b/cpan/Unicode-Collate/t/test.t index 698802e9be..dc1e903388 100644 --- a/cpan/Unicode-Collate/t/test.t +++ b/cpan/Unicode-Collate/t/test.t @@ -12,7 +12,7 @@ BEGIN { } use Test; -BEGIN { plan tests => 113 }; +BEGIN { plan tests => 107 }; use strict; use warnings; @@ -20,6 +20,8 @@ use Unicode::Collate; ok(1); +######################### + sub _pack_U { Unicode::Collate::pack_U(@_) } sub _unpack_U { Unicode::Collate::unpack_U(@_) } @@ -137,22 +139,22 @@ ok( $Collator->cmp($hiragana, $katakana), -1); ok( $Collator->lt($hiragana, $katakana) ); ##### 53..54 - -my $ignoreAE = Unicode::Collate->new( - table => 'keys.txt', - normalization => undef, - ignoreChar => qr/^[aAeE]$/, -); - -ok($ignoreAE->eq("element","lament")); -ok($ignoreAE->eq("Perl","ePrl")); +{ + my $ignoreAE = Unicode::Collate->new( + table => 'keys.txt', + normalization => undef, + ignoreChar => qr/^[aAeE]$/, + ); + ok($ignoreAE->eq("element","lament")); + ok($ignoreAE->eq("Perl","ePrl")); +} ##### 55 - -my $onlyABC = Unicode::Collate->new( - table => undef, - normalization => undef, - entry => << 'ENTRIES', +{ + my $onlyABC = Unicode::Collate->new( + table => undef, + normalization => undef, + entry => << 'ENTRIES', 0061 ; [.0101.0020.0002.0061] # LATIN SMALL LETTER A 0041 ; [.0101.0020.0008.0041] # LATIN CAPITAL LETTER A 0062 ; [.0102.0020.0002.0062] # LATIN SMALL LETTER B @@ -160,62 +162,63 @@ my $onlyABC = Unicode::Collate->new( 0063 ; [.0103.0020.0002.0063] # LATIN SMALL LETTER C 0043 ; [.0103.0020.0008.0043] # LATIN CAPITAL LETTER C ENTRIES -); - -ok( - join(':', $onlyABC->sort( qw/ ABA BAC cc A Ab cAc aB / ) ), - join(':', qw/ A aB Ab ABA BAC cAc cc / ), -); + ); + ok( + join(':', $onlyABC->sort( qw/ ABA BAC cc A Ab cAc aB / ) ), + join(':', qw/ A aB Ab ABA BAC cAc cc / ), + ); +} ##### 56..59 - -my $undefAE = Unicode::Collate->new( - table => 'keys.txt', - normalization => undef, - undefChar => qr/^[aAeE]$/, -); - -ok($undefAE ->gt("edge","fog")); -ok($Collator->lt("edge","fog")); -ok($undefAE ->gt("lake","like")); -ok($Collator->lt("lake","like")); +{ + my $undefAE = Unicode::Collate->new( + table => 'keys.txt', + normalization => undef, + undefChar => qr/^[aAeE]$/, + ); + ok($undefAE ->gt("edge","fog")); + ok($Collator->lt("edge","fog")); + ok($undefAE ->gt("lake","like")); + ok($Collator->lt("lake","like")); +} ##### 60..69 - -# Table is undefined, then no entry is defined. - -my $undef_table = Unicode::Collate->new( - table => undef, - normalization => undef, - level => 1, -); - -# in the Unicode code point order -ok($undef_table->lt('', 'A')); -ok($undef_table->lt('ABC', 'B')); - -# Hangul should be decomposed (even w/o Unicode::Normalize). -ok($undef_table->lt("Perl", "\x{AC00}")); -ok($undef_table->eq("\x{AC00}", "\x{1100}\x{1161}")); -ok($undef_table->eq("\x{AE00}", "\x{1100}\x{1173}\x{11AF}")); -ok($undef_table->lt("\x{AE00}", "\x{3042}")); - # U+AC00: Hangul GA - # U+AE00: Hangul GEUL - # U+3042: Hiragana A - -# Weight for CJK Ideographs is defined, though. -ok($undef_table->lt("", "\x{4E00}")); -ok($undef_table->lt("\x{4E8C}","ABC")); -ok($undef_table->lt("\x{4E00}","\x{3042}")); -ok($undef_table->lt("\x{4E00}","\x{4E8C}")); - # U+4E00: Ideograph "ONE" - # U+4E8C: Ideograph "TWO" - +{ + # Table is undefined, then no entry is defined. + my $undef_table = Unicode::Collate->new( + table => undef, + normalization => undef, + level => 1, + ); + + # in the Unicode code point order + ok($undef_table->lt('', 'A')); + ok($undef_table->lt('ABC', 'B')); + + # Hangul should be decomposed (even w/o Unicode::Normalize). + ok($undef_table->lt("Perl", "\x{AC00}")); + ok($undef_table->eq("\x{AC00}", "\x{1100}\x{1161}")); + ok($undef_table->eq("\x{AE00}", "\x{1100}\x{1173}\x{11AF}")); + ok($undef_table->lt("\x{AE00}", "\x{3042}")); + + # U+AC00: Hangul GA + # U+AE00: Hangul GEUL + # U+3042: Hiragana A + + # Weight for CJK Ideographs is defined, though. + ok($undef_table->lt("", "\x{4E00}")); + ok($undef_table->lt("\x{4E8C}","ABC")); + ok($undef_table->lt("\x{4E00}","\x{3042}")); + ok($undef_table->lt("\x{4E00}","\x{4E8C}")); + + # U+4E00: Ideograph "ONE" + # U+4E8C: Ideograph "TWO" +} ##### 70..74 - -my $few_entries = Unicode::Collate->new( - entry => <<'ENTRIES', +{ + my $few_entries = Unicode::Collate->new( + entry => <<'ENTRIES', 0050 ; [.0101.0020.0002.0050] # P 0045 ; [.0102.0020.0002.0045] # E 0052 ; [.0103.0020.0002.0052] # R @@ -224,85 +227,63 @@ my $few_entries = Unicode::Collate->new( 1175 ; [.0106.0020.0002.1175] # Hangul Jamo middle I 5B57 ; [.0107.0020.0002.5B57] # CJK Ideograph "Letter" ENTRIES - table => undef, - normalization => undef, -); - -# defined before undefined - -my $sortABC = join '', - $few_entries->sort(split //, "ABCDEFGHIJKLMNOPQRSTUVWXYZ "); + table => undef, + normalization => undef, + ); + # defined before undefined + my $sortABC = join '', + $few_entries->sort(split //, "ABCDEFGHIJKLMNOPQRSTUVWXYZ "); -ok($sortABC eq "PERL ABCDFGHIJKMNOQSTUVWXYZ"); + ok($sortABC eq "PERL ABCDFGHIJKMNOQSTUVWXYZ"); -ok($few_entries->lt('E', 'D')); -ok($few_entries->lt("\x{5B57}", "\x{4E00}")); -ok($few_entries->lt("\x{AE30}", "\x{AC00}")); + ok($few_entries->lt('E', 'D')); + ok($few_entries->lt("\x{5B57}", "\x{4E00}")); + ok($few_entries->lt("\x{AE30}", "\x{AC00}")); -# Hangul must be decomposed. - -ok($few_entries->eq("\x{AC00}", "\x{1100}\x{1161}")); + # Hangul must be decomposed. + ok($few_entries->eq("\x{AC00}", "\x{1100}\x{1161}")); +} ##### 75..79 +{ + my $dropArticles = Unicode::Collate->new( + table => "keys.txt", + normalization => undef, + preprocess => sub { + my $string = shift; + $string =~ s/\b(?:an?|the)\s+//ig; + $string; + }, + ); + ok($dropArticles->eq("camel", "a camel")); + ok($dropArticles->eq("Perl", "The Perl")); + ok($dropArticles->lt("the pen", "a pencil")); + ok($Collator->lt("Perl", "The Perl")); + ok($Collator->gt("the pen", "a pencil")); +} -my $dropArticles = Unicode::Collate->new( - table => "keys.txt", - normalization => undef, - preprocess => sub { - my $string = shift; - $string =~ s/\b(?:an?|the)\s+//ig; - $string; - }, -); - -ok($dropArticles->eq("camel", "a camel")); -ok($dropArticles->eq("Perl", "The Perl")); -ok($dropArticles->lt("the pen", "a pencil")); -ok($Collator->lt("Perl", "The Perl")); -ok($Collator->gt("the pen", "a pencil")); - -##### 80..81 - -my $backLevel1 = Unicode::Collate->new( - table => undef, - normalization => undef, - backwards => [ 1 ], -); - -# all strings are reversed at level 1. - -ok($backLevel1->gt("AB", "BA")); -ok($backLevel1->gt("\x{3042}\x{3044}", "\x{3044}\x{3042}")); - -##### 82..89 - -my $backLevel2 = Unicode::Collate->new( - table => "keys.txt", - normalization => undef, - undefName => qr/HANGUL|HIRAGANA|KATAKANA|BOPOMOFO/, - backwards => 2, -); - -ok($backLevel2->gt("Ca\x{300}ca\x{302}", "ca\x{302}ca\x{300}")); -ok($backLevel2->gt("ca\x{300}ca\x{302}", "Ca\x{302}ca\x{300}")); -ok($Collator ->lt("Ca\x{300}ca\x{302}", "ca\x{302}ca\x{300}")); -ok($Collator ->lt("ca\x{300}ca\x{302}", "Ca\x{302}ca\x{300}")); - -# HIRAGANA and KATAKANA are made undefined via undefName. -# So they are after CJK Unified Ideographs. - -ok($backLevel2->lt("\x{4E00}", $hiragana)); -ok($backLevel2->lt("\x{4E03}", $katakana)); -ok($Collator ->gt("\x{4E00}", $hiragana)); -ok($Collator ->gt("\x{4E03}", $katakana)); - - -##### 90..96 +##### 80..83 +{ + my $undefName = Unicode::Collate->new( + table => "keys.txt", + normalization => undef, + undefName => qr/HANGUL|HIRAGANA|KATAKANA|BOPOMOFO/, + ); + # HIRAGANA and KATAKANA are made undefined via undefName. + # So they are after CJK Unified Ideographs. + + ok($undefName->lt("\x{4E00}", $hiragana)); + ok($undefName->lt("\x{4E03}", $katakana)); + ok($Collator ->gt("\x{4E00}", $hiragana)); + ok($Collator ->gt("\x{4E03}", $katakana)); +} -my $O_str = Unicode::Collate->new( - table => "keys.txt", - normalization => undef, - entry => <<'ENTRIES', +##### 84..90 +{ + my $O_str = Unicode::Collate->new( + table => "keys.txt", + normalization => undef, + entry => <<'ENTRIES', 0008 ; [*0008.0000.0000.0000] # BACKSPACE (need to be non-ignorable) 004F 0337 ; [.0B53.0020.0008.004F] # capital O WITH SHORT SOLIDUS OVERLAY 006F 0008 002F ; [.0B53.0020.0002.006F] # LATIN SMALL LETTER O WITH STROKE @@ -312,26 +293,27 @@ my $O_str = Unicode::Collate->new( #00F8 ; [.0B53.0020.0002.00F8] # LATIN SMALL LETTER O WITH STROKE #00D8 ; [.0B53.0020.0008.00D8] # LATIN CAPITAL LETTER O WITH STROKE ENTRIES -); + ); -my $o_BS_slash = _pack_U(0x006F, 0x0008, 0x002F); -my $O_BS_slash = _pack_U(0x004F, 0x0008, 0x002F); -my $o_sol = _pack_U(0x006F, 0x0337); -my $O_sol = _pack_U(0x004F, 0x0337); -my $o_stroke = _pack_U(0x00F8); -my $O_stroke = _pack_U(0x00D8); + my $o_BS_slash = _pack_U(0x006F, 0x0008, 0x002F); + my $O_BS_slash = _pack_U(0x004F, 0x0008, 0x002F); + my $o_sol = _pack_U(0x006F, 0x0337); + my $O_sol = _pack_U(0x004F, 0x0337); + my $o_stroke = _pack_U(0x00F8); + my $O_stroke = _pack_U(0x00D8); -ok($O_str->eq($o_stroke, $o_BS_slash)); -ok($O_str->eq($O_stroke, $O_BS_slash)); + ok($O_str->eq($o_stroke, $o_BS_slash)); + ok($O_str->eq($O_stroke, $O_BS_slash)); -ok($O_str->eq($o_stroke, $o_sol)); -ok($O_str->eq($O_stroke, $O_sol)); + ok($O_str->eq($o_stroke, $o_sol)); + ok($O_str->eq($O_stroke, $O_sol)); -ok($Collator->eq("\x{200B}", "\0")); -ok($O_str ->gt("\x{200B}", "\0")); -ok($O_str ->gt("\x{200B}", "A")); + ok($Collator->eq("\x{200B}", "\0")); + ok($O_str ->gt("\x{200B}", "\0")); + ok($O_str ->gt("\x{200B}", "A")); +} -##### 97..107 +##### 91..101 my %origVer = $Collator->change(UCA_Version => 8); @@ -361,7 +343,7 @@ $Collator->change(level => 4); ok($Collator->gt("!\x{300}", "")); ok($Collator->eq("!\x{300}", "!")); -##### 108..113 +##### 102..107 $_ = 'Foo'; diff --git a/cpan/Unicode-Collate/t/trailwt.t b/cpan/Unicode-Collate/t/trailwt.t index e987f8f509..de2d92cd1f 100644 --- a/cpan/Unicode-Collate/t/trailwt.t +++ b/cpan/Unicode-Collate/t/trailwt.t @@ -1,3 +1,4 @@ + BEGIN { unless ("A" eq pack('U', 0x41)) { print "1..0 # Unicode::Collate " . @@ -17,10 +18,10 @@ use strict; use warnings; use Unicode::Collate; -######################### - ok(1); +######################### + # a standard collator (3.1.1) my $Collator = Unicode::Collate->new( level => 1, @@ -222,5 +223,3 @@ ok($Collator->eq("\x{1100}\x{1161}A", "\x{326E}A")); ok($Collator->eq("\x{1100}\x{1161}\x{3042}", "\x{326E}\x{3042}")); ok($Collator->eq("\x{1100}\x{1161}\x{4E00}", "\x{326E}\x{4E00}")); -1; -__END__ diff --git a/cpan/Unicode-Collate/t/view.t b/cpan/Unicode-Collate/t/view.t index 44963f4189..ca8e627eae 100644 --- a/cpan/Unicode-Collate/t/view.t +++ b/cpan/Unicode-Collate/t/view.t @@ -18,10 +18,10 @@ use strict; use warnings; use Unicode::Collate; -######################### - ok(1); +######################### + my $Collator = Unicode::Collate->new( table => 'keys.txt', normalization => undef, |