diff options
author | Mark Wells <mark@freeside.biz> | 2014-09-11 15:54:45 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2014-09-11 15:54:45 -0700 |
commit | 792fa56fe32dfea38ab824183dc130bc926480df (patch) | |
tree | 671231a28c33964531bb5f829b6d30f22b5fcd74 /t |
Import original source of Geo-USCensus-Geocoding 0.01
Diffstat (limited to 't')
-rw-r--r-- | t/00-load.t | 9 | ||||
-rw-r--r-- | t/01-lookup.t | 19 | ||||
-rw-r--r-- | t/02-fail.t | 16 |
3 files changed, 44 insertions, 0 deletions
diff --git a/t/00-load.t b/t/00-load.t new file mode 100644 index 0000000..46f282f --- /dev/null +++ b/t/00-load.t @@ -0,0 +1,9 @@ +#!perl -T + +use Test::More tests => 1; + +BEGIN { + use_ok( 'Geo::USCensus::Geocoding' ) || print "Bail out!\n"; +} + +diag( "Testing Geo::USCensus::Geocoding $Geo::USCensus::Geocoding, Perl $], $^X" ); diff --git a/t/01-lookup.t b/t/01-lookup.t new file mode 100644 index 0000000..11c8b37 --- /dev/null +++ b/t/01-lookup.t @@ -0,0 +1,19 @@ +#!perl -T + +use Test::More tests => 2; +use Data::Dumper; +use Geo::USCensus::Geocoding; + +diag( "Testing lookup of a known good address" ); +my $result = Geo::USCensus::Geocoding->query( + street => '1526 H St', # the California Governor's Mansion + city => 'Sacramento', + state => 'CA', + zip => '95814', +); + +is( $result->message, '', 'error status' ); +is( $result->matches, 1, 'number of matches' ); +diag($result->match(0)->matchedAddress); +diag('Census tract '.$result->match(0)->censustract); + diff --git a/t/02-fail.t b/t/02-fail.t new file mode 100644 index 0000000..72fc6da --- /dev/null +++ b/t/02-fail.t @@ -0,0 +1,16 @@ +#!perl -T + +use Test::More tests => 1; +use Data::Dumper; +use Geo::USCensus::Geocoding; + +diag( "Testing lookup of a known nonexistent address" ); +my $result = Geo::USCensus::Geocoding->query( + street => '1000 Z St', # there is no Z street + city => 'Sacramento', + state => 'CA', + zip => '95814', +); + +is( $result->matches, 0, 'number of matches' ); + |