importing upstream 1.41
[Locale-SubCountry.git] / t / main.t
1 #------------------------------------------------------------------------------
2 # Test script for CPAN module Locale::SubCountry 
3 #                                            
4 # Author: Kim Ryan 
5 #------------------------------------------------------------------------------
6
7 use strict;
8 use locale;
9 use Locale::SubCountry;
10
11 # We start with some black magic to print on failure.
12
13 BEGIN { print "1..15\n"; }
14
15 my $australia = new Locale::SubCountry('Australia');
16 print $australia->code('New South Wales ') eq 'NSW' ? "ok 1\n" : "not ok 1\n";
17 print $australia->full_name('S.A.') eq 'South Australia' ? "ok 2\n" : "not ok 2\n";
18
19 my $upper_case = 1;
20 print $australia->full_name('Qld',$upper_case) eq 'QUEENSLAND'  ? "ok 3\n" : "not ok 3\n";
21
22 print $australia->country_code eq 'AU' ? "ok 4\n" : "not ok 4\n";
23
24 print $australia->category('NSW') eq 'state' ? "ok 5\n" : "not ok 5\n";
25
26 print $australia->ISO3166_2_code('01') eq 'ACT' ? "ok 6\n" : "not ok 6\n";
27
28 print $australia->FIPS10_4_code('ACT') eq '01' ? "ok 7\n" : "not ok 7\n";
29
30 my %states =  $australia->full_name_code_hash;
31 print $states{'Tasmania'} eq 'TAS' ? "ok 8\n" : "not ok 8\n";
32
33 %states =  $australia->code_full_name_hash;
34 print $states{'SA'} eq 'South Australia' ? "ok 9\n" : "not ok 9\n";
35
36 my @states = $australia->all_codes;
37 print @states == 8 ? "ok 10\n" : "not ok 10\n";
38
39 my @all_names = $australia->all_full_names;
40 print $all_names[1] eq 'New South Wales' ? "ok 11\n" : "not ok 11\n";
41
42 my $world = new Locale::SubCountry::World;
43
44 my %countries =  $world->full_name_code_hash;
45 print $countries{'NEW ZEALAND'} eq 'NZ' ? "ok 12\n" : "not ok 12\n";
46
47 %countries =  $world->code_full_name_hash;
48 print $countries{'GB'} eq 'UNITED KINGDOM' ? "ok 13\n" : "not ok 13\n";
49
50 my @all_country_codes = $world->all_codes;
51 print @all_country_codes ? "ok 14\n" : "not ok 14\n";
52
53 my @all_country_names = $world->all_full_names;
54 print @all_country_names ? "ok 15\n" : "not ok 15\n";
55
56
57