Commit | Line | Data |
---|---|---|
c69a30ec CBW |
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::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 country2code(@test); | |
30 | } | |
31 | ||
32 | $tests = " | |
33 | ||
34 | kazakhstan | |
35 | ~ | |
36 | kz | |
37 | ||
38 | kazakstan | |
39 | ~ | |
40 | kz | |
41 | ||
42 | macao | |
43 | ~ | |
44 | mo | |
45 | ||
46 | macau | |
47 | ~ | |
48 | mo | |
49 | ||
50 | ||
51 | ~ _undef_ | |
52 | ||
53 | _undef_ | |
54 | ~ | |
55 | _undef_ | |
56 | ||
57 | Banana | |
58 | ~ | |
59 | _undef_ | |
60 | ||
61 | japan | |
62 | ~ | |
63 | jp | |
64 | ||
65 | Japan | |
66 | ~ | |
67 | jp | |
68 | ||
69 | United States | |
70 | ~ | |
71 | us | |
72 | ||
73 | United Kingdom | |
74 | ~ | |
75 | gb | |
76 | ||
77 | Andorra | |
78 | ~ | |
79 | ad | |
80 | ||
81 | Zimbabwe | |
82 | ~ | |
83 | zw | |
84 | ||
85 | Iran | |
86 | ~ | |
87 | ir | |
88 | ||
89 | North Korea | |
90 | ~ | |
91 | kp | |
92 | ||
93 | South Korea | |
94 | ~ | |
95 | kr | |
96 | ||
97 | Libya | |
98 | ~ | |
99 | ly | |
100 | ||
b15b9c2a | 101 | Syrian Arab Republic |
c69a30ec CBW |
102 | ~ |
103 | sy | |
104 | ||
105 | Svalbard | |
106 | ~ | |
107 | _undef_ | |
108 | ||
109 | Jan Mayen | |
110 | ~ | |
111 | _undef_ | |
112 | ||
113 | USA | |
114 | ~ | |
115 | us | |
116 | ||
117 | United States of America | |
118 | ~ | |
119 | us | |
120 | ||
121 | Great Britain | |
122 | ~ | |
123 | gb | |
124 | ||
125 | Burma | |
126 | ~ | |
127 | mm | |
128 | ||
129 | French Southern and Antarctic Lands | |
130 | ~ | |
131 | tf | |
132 | ||
133 | Aland Islands | |
134 | ~ | |
135 | ax | |
136 | ||
137 | Yugoslavia | |
138 | ~ | |
139 | _undef_ | |
140 | ||
141 | Serbia and Montenegro | |
142 | ~ | |
143 | _undef_ | |
144 | ||
145 | East Timor | |
146 | ~ | |
147 | tl | |
148 | ||
149 | Zaire | |
150 | ~ | |
151 | _undef_ | |
152 | ||
153 | Congo, The Democratic Republic of the | |
154 | ~ | |
155 | cd | |
156 | ||
157 | Congo, The Democratic Republic of the | |
158 | LOCALE_CODE_ALPHA_3 | |
159 | ~ | |
160 | cod | |
161 | ||
162 | Congo, The Democratic Republic of the | |
163 | LOCALE_CODE_NUMERIC | |
164 | ~ | |
165 | 180 | |
166 | ||
167 | "; | |
168 | ||
169 | print "country2code (old)...\n"; | |
170 | test_Func(\&test,$tests,$runtests); | |
171 | ||
172 | 1; | |
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 |