File: 003_neighbors.t

package info (click to toggle)
libgeo-hash-xs-perl 0.00015-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 412 kB
  • sloc: perl: 1,981; ansic: 55; makefile: 3
file content (40 lines) | stat: -rw-r--r-- 1,224 bytes parent folder | download
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
38
39
40
use strict;
use warnings;
use Test::More;
use Geo::Hash::XS;

ok my $gh = Geo::Hash::XS->new;
isa_ok $gh, 'Geo::Hash::XS';

{
    my @set = $gh->neighbors('xn76gg');
    my @expect = qw/xn76gu xn76uh xn76u5 xn76u4 xn76gf xn76gd xn76ge xn76gs/;
    ok eq_set \@set, \@expect or
        diag "got '@set', but expected '@expect'";
}

{
    my @set = $gh->neighbors('xpst02vt');
    my @expect = qw/xpst02vw xpst02vy xpst02vv xpst02vu xpst02vs xpst02vk xpst02vm xpst02vq/;
    ok eq_set \@set, \@expect or
        diag "got '@set', but expected '@expect'";
}

{
    my @set = $gh->neighbors('xn76gg', 2);
    my @expect = qw/xn76gu xn76uh xn76u5 xn76u4 xn76gf xn76gd xn76ge xn76gs 
                    xn76gv xn76gm xn76gk xn76g7 xn76um xn76u6 xn76g3 xn76g9 
                    xn76uk xn76u7 xn76gc xn76uj xn76gt xn76g6 xn76u1 xn76u3/;
    ok eq_set \@set, \@expect or
        diag "got '@set', but expected '@expect'";
}

{
    my @set = $gh->neighbors('xn76gg', 1, 1);
    my @expect = qw/xn76gv xn76gm xn76gk xn76g7 xn76um xn76u6 xn76g3 xn76g9 
                    xn76uk xn76u7 xn76gc xn76uj xn76gt xn76g6 xn76u1 xn76u3/;
    ok eq_set \@set, \@expect or
        diag "got '@set', but expected '@expect'";
}

done_testing;