Algorithm-GooglePolylineEncoding
view release on metacpan or search on metacpan
Revision history for Perl extension Algorithm::GooglePolylineEncoding.
0.06 2018-01-01
- stable release with changes in 0.05_50
0.05_50 2017-12-31
- fix encode_level for large integers (by using
Math::BigInt's as_bin)
This should fix the test errors seen on 32bit
systems.
0.05 2017-06-10
- fix link in documentation
0.04 2016-07-21
- no code changes, just distribution care
(GH Pull #1, .travis.yml, appveyor.yml)
0.03 2012-01-28
t/polyline.t view on Meta::CPAN
my($path, $encoded) = @_;
local $Test::Builder::Level = $Test::Builder::Level + 1;
if (defined $encoded) {
my $success;
$success++ if is(Algorithm::GooglePolylineEncoding::encode_polyline(@$path), $encoded, 'encode_polyline');
$success++ if is_deeply([Algorithm::GooglePolylineEncoding::decode_polyline($encoded)], $path, 'decode_polyline');
return 1 if $success == 2;
} else {
my $encoded = Algorithm::GooglePolylineEncoding::encode_polyline(@$path);
my @path2 = Algorithm::GooglePolylineEncoding::decode_polyline($encoded);
my $errors = 0;
for my $i (0 .. $#$path) {
my $lat_delta = abs($path2[$i]->{lat}-$path->[$i]->{lat});
my $lon_delta = abs($path2[$i]->{lon}-$path->[$i]->{lon});
if ($lat_delta > 0.00006) {
diag "$lat_delta too large (lat index $i in path, $path->[$i]->{lat} != $path2[$i]->{lat})";
$errors++;
}
if ($lon_delta > 0.00006) {
diag "$lat_delta too large (lon index $i in path, $path->[$i]->{lon} != $path2[$i]->{lon})";
$errors++;
}
}
ok($errors == 0, "Roundtrip check");
}
}
__END__
( run in 0.605 second using v1.01-cache-2.11-cpan-65fba6d93b7 )