This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Integrate CPAN release of version.pm 0.9905
[perl5.git] / cpan / Locale-Codes / t / country2code_old.t
CommitLineData
c69a30ec
CBW
1#!/usr/bin/perl -w
2
3require 5.002;
4
5$runtests=shift(@ARGV);
6if ( -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
18unshift(@INC,$dir);
19use Locale::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
26sub test {
27 my(@test) = @_;
28 $test[1] = $type{$test[1]} if (@test == 2 && $test[1] && exists $type{$test[1]});
29 return country2code(@test);
30}
31
32$tests = "
33
34kazakhstan
35 ~
36 kz
37
38kazakstan
39 ~
40 kz
41
42macao
43 ~
44 mo
45
46macau
47 ~
48 mo
49
50
51~ _undef_
52
53_undef_
54 ~
55 _undef_
56
57Banana
58 ~
59 _undef_
60
61japan
62 ~
63 jp
64
65Japan
66 ~
67 jp
68
69United States
70 ~
71 us
72
73United Kingdom
74 ~
75 gb
76
77Andorra
78 ~
79 ad
80
81Zimbabwe
82 ~
83 zw
84
85Iran
86 ~
87 ir
88
89North Korea
90 ~
91 kp
92
93South Korea
94 ~
95 kr
96
97Libya
98 ~
99 ly
100
b15b9c2a 101Syrian Arab Republic
c69a30ec
CBW
102 ~
103 sy
104
105Svalbard
106 ~
107 _undef_
108
109Jan Mayen
110 ~
111 _undef_
112
113USA
114 ~
115 us
116
117United States of America
118 ~
119 us
120
121Great Britain
122 ~
123 gb
124
125Burma
126 ~
127 mm
128
129French Southern and Antarctic Lands
130 ~
131 tf
132
133Aland Islands
134 ~
135 ax
136
137Yugoslavia
138 ~
139 _undef_
140
141Serbia and Montenegro
142 ~
143 _undef_
144
145East Timor
146 ~
147 tl
148
149Zaire
150 ~
151 _undef_
152
153Congo, The Democratic Republic of the
154 ~
155 cd
156
157Congo, The Democratic Republic of the
158LOCALE_CODE_ALPHA_3
159 ~
160 cod
161
162Congo, The Democratic Republic of the
163LOCALE_CODE_NUMERIC
164 ~
165 180
166
167";
168
169print "country2code (old)...\n";
170test_Func(\&test,$tests,$runtests);
171
1721;
173# Local Variables:
174# mode: cperl
175# indent-tabs-mode: nil
176# cperl-indent-level: 3
177# cperl-continued-statement-offset: 2
178# cperl-continued-brace-offset: 0
179# cperl-brace-offset: 0
180# cperl-brace-imaginary-offset: 0
181# cperl-label-offset: -2
182# End:
183