diff options
author | ivan <ivan> | 2010-11-01 18:24:45 +0000 |
---|---|---|
committer | ivan <ivan> | 2010-11-01 18:24:45 +0000 |
commit | 43107005cf3fc4356e72a2820e623c6983309e6b (patch) | |
tree | b40d88c8e39565f1adbb06f28c2f7a576fee0f6b /t/main.t |
importing upstream 1.41Locale_SubCountry_1_41
Diffstat (limited to 't/main.t')
-rwxr-xr-x | t/main.t | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/t/main.t b/t/main.t new file mode 100755 index 0000000..304bee1 --- /dev/null +++ b/t/main.t @@ -0,0 +1,57 @@ +#------------------------------------------------------------------------------ +# Test script for CPAN module Locale::SubCountry +# +# Author: Kim Ryan +#------------------------------------------------------------------------------ + +use strict; +use locale; +use Locale::SubCountry; + +# We start with some black magic to print on failure. + +BEGIN { print "1..15\n"; } + +my $australia = new Locale::SubCountry('Australia'); +print $australia->code('New South Wales ') eq 'NSW' ? "ok 1\n" : "not ok 1\n"; +print $australia->full_name('S.A.') eq 'South Australia' ? "ok 2\n" : "not ok 2\n"; + +my $upper_case = 1; +print $australia->full_name('Qld',$upper_case) eq 'QUEENSLAND' ? "ok 3\n" : "not ok 3\n"; + +print $australia->country_code eq 'AU' ? "ok 4\n" : "not ok 4\n"; + +print $australia->category('NSW') eq 'state' ? "ok 5\n" : "not ok 5\n"; + +print $australia->ISO3166_2_code('01') eq 'ACT' ? "ok 6\n" : "not ok 6\n"; + +print $australia->FIPS10_4_code('ACT') eq '01' ? "ok 7\n" : "not ok 7\n"; + +my %states = $australia->full_name_code_hash; +print $states{'Tasmania'} eq 'TAS' ? "ok 8\n" : "not ok 8\n"; + +%states = $australia->code_full_name_hash; +print $states{'SA'} eq 'South Australia' ? "ok 9\n" : "not ok 9\n"; + +my @states = $australia->all_codes; +print @states == 8 ? "ok 10\n" : "not ok 10\n"; + +my @all_names = $australia->all_full_names; +print $all_names[1] eq 'New South Wales' ? "ok 11\n" : "not ok 11\n"; + +my $world = new Locale::SubCountry::World; + +my %countries = $world->full_name_code_hash; +print $countries{'NEW ZEALAND'} eq 'NZ' ? "ok 12\n" : "not ok 12\n"; + +%countries = $world->code_full_name_hash; +print $countries{'GB'} eq 'UNITED KINGDOM' ? "ok 13\n" : "not ok 13\n"; + +my @all_country_codes = $world->all_codes; +print @all_country_codes ? "ok 14\n" : "not ok 14\n"; + +my @all_country_names = $world->all_full_names; +print @all_country_names ? "ok 15\n" : "not ok 15\n"; + + + |