summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorivan <ivan>2010-11-01 18:24:45 +0000
committerivan <ivan>2010-11-01 18:24:45 +0000
commit43107005cf3fc4356e72a2820e623c6983309e6b (patch)
treeb40d88c8e39565f1adbb06f28c2f7a576fee0f6b /t
importing upstream 1.41Locale_SubCountry_1_41
Diffstat (limited to 't')
-rwxr-xr-xt/main.t57
-rwxr-xr-xt/pod-coverage.t6
-rwxr-xr-xt/pod.t6
3 files changed, 69 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";
+
+
+
diff --git a/t/pod-coverage.t b/t/pod-coverage.t
new file mode 100755
index 0000000..703f91d
--- /dev/null
+++ b/t/pod-coverage.t
@@ -0,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod::Coverage 1.04";
+plan skip_all => "Test::Pod::Coverage 1.04 required for testing POD coverage" if $@;
+all_pod_coverage_ok();
diff --git a/t/pod.t b/t/pod.t
new file mode 100755
index 0000000..976d7cd
--- /dev/null
+++ b/t/pod.t
@@ -0,0 +1,6 @@
+#!perl -T
+
+use Test::More;
+eval "use Test::Pod 1.14";
+plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;
+all_pod_files_ok();