From 792fa56fe32dfea38ab824183dc130bc926480df Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Thu, 11 Sep 2014 15:54:45 -0700 Subject: Import original source of Geo-USCensus-Geocoding 0.01 --- t/00-load.t | 9 +++++++++ t/01-lookup.t | 19 +++++++++++++++++++ t/02-fail.t | 16 ++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 t/00-load.t create mode 100644 t/01-lookup.t create mode 100644 t/02-fail.t (limited to 't') 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' ); + -- cgit v1.2.1