This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[PATCH] Bump Locale-Codes from 3.36 to 3.37
[perl5.git] / cpan / Locale-Codes / t / code2country.t
1 #!/usr/bin/perl -w
2
3 require 5.002;
4
5 $runtests=shift(@ARGV);
6 if ( -f "t/testfunc.pl" ) {
7   require "t/testfunc.pl";
8   $dir="./lib";
9   $tdir="t";
10 } elsif ( -f "testfunc.pl" ) {
11   require "testfunc.pl";
12   $dir="../lib";
13   $tdir=".";
14 } else {
15   die "ERROR: cannot find testfunc.pl\n";
16 }
17
18 unshift(@INC,$dir);
19 use Locale::Codes::Country;
20
21 %type = ( "LOCALE_CODE_ALPHA_2" => LOCALE_CODE_ALPHA_2,
22           "LOCALE_CODE_ALPHA_3" => LOCALE_CODE_ALPHA_3,
23           "LOCALE_CODE_NUMERIC" => LOCALE_CODE_NUMERIC,
24         );
25
26 sub test {
27    my(@test) = @_;
28    $test[1]  = $type{$test[1]}   if (@test == 2  &&  $test[1]  &&  exists $type{$test[1]});
29    return code2country(@test);
30 }
31
32 $tests = "
33
34 ~ _undef_
35
36 _undef_ ~ _undef_
37
38 zz ~ _undef_
39
40 zz LOCALE_CODE_ALPHA_2 ~ _undef_
41
42 zz LOCALE_CODE_ALPHA_3 ~ _undef_
43
44 zz LOCALE_CODE_NUMERIC ~ _undef_
45
46 ja ~ _undef_
47
48 uk ~ _undef_
49
50 BO
51    ~
52    Bolivia (Plurinational State of)
53
54 BO
55 LOCALE_CODE_ALPHA_2
56    ~
57    Bolivia (Plurinational State of)
58
59 bol
60 LOCALE_CODE_ALPHA_3
61    ~
62    Bolivia (Plurinational State of)
63
64 pk ~ Pakistan
65
66 sn ~ Senegal
67
68 us
69    ~
70    United States of America
71
72 ad ~ Andorra
73
74 ad LOCALE_CODE_ALPHA_2 ~ Andorra
75
76 and LOCALE_CODE_ALPHA_3 ~ Andorra
77
78 020 LOCALE_CODE_NUMERIC ~ Andorra
79
80 48 LOCALE_CODE_NUMERIC ~ Bahrain
81
82 zw ~ Zimbabwe
83
84 gb
85    ~
86    United Kingdom of Great Britain and Northern Ireland
87
88 kz ~ Kazakhstan
89
90 mo ~ Macao
91
92 tl LOCALE_CODE_ALPHA_2 ~ Timor-Leste
93
94 tls LOCALE_CODE_ALPHA_3 ~ Timor-Leste
95
96 626 LOCALE_CODE_NUMERIC ~ Timor-Leste
97
98 BO LOCALE_CODE_ALPHA_3 ~ _undef_
99
100 BO LOCALE_CODE_NUMERIC ~ _undef_
101
102 ax
103    ~
104    Aland Islands
105
106 ala
107 LOCALE_CODE_ALPHA_3
108    ~
109    Aland Islands
110
111 248
112 LOCALE_CODE_NUMERIC
113    ~
114    Aland Islands
115
116 scg
117 LOCALE_CODE_ALPHA_3
118    ~
119    _undef_
120
121 891
122 LOCALE_CODE_NUMERIC
123    ~
124    _undef_
125
126 rou LOCALE_CODE_ALPHA_3 ~ Romania
127
128 zr  ~ _undef_
129
130 zr retired  ~ Zaire
131
132 jp alpha-2 not_retired other_arg ~ _undef_
133
134 jp _blank_ ~ Japan
135
136 jp alpha-15 ~ _undef_
137
138 jp alpha-2 retired ~ Japan
139
140 ";
141
142 print "code2country...\n";
143 test_Func(\&test,$tests,$runtests);
144
145 1;
146 # Local Variables:
147 # mode: cperl
148 # indent-tabs-mode: nil
149 # cperl-indent-level: 3
150 # cperl-continued-statement-offset: 2
151 # cperl-continued-brace-offset: 0
152 # cperl-brace-offset: 0
153 # cperl-brace-imaginary-offset: 0
154 # cperl-label-offset: -2
155 # End:
156