File: cvt.t

package info (click to toggle)
libgeo-coordinates-itm-perl 0.02-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 96 kB
  • sloc: perl: 298; makefile: 2
file content (37 lines) | stat: -rw-r--r-- 726 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!perl

use strict;
use warnings;

use Test::More;
use Test::Number::Delta within => 0.001;
use Geo::Coordinates::ITM qw( ll_to_grid grid_to_ll );

my @case = (
  {
    name => 'Spire of Dublin',
    itm  => [ 715830, 734697 ],
    ll   => [ 53.3497939132163, -6.26024777285805 ]
  },
  {
    name => 'GPS station',
    itm  => [ 709885.081, 736167.699 ],
    ll   => [ 53.3642734370663, -6.34898734665306 ]
  },
);

plan tests => @case * 2;

for my $case ( @case ) {
  my $name = $case->{name};

  my @ll = grid_to_ll( @{ $case->{itm} } );
  delta_ok [@ll], $case->{ll}, "$name: grid_to_ll";

  my @grid = ll_to_grid( @{ $case->{ll} } );
  delta_ok [@grid], $case->{itm}, "$name: ll_to_grid";

}

# vim:ts=2:sw=2:et:ft=perl