File: Reader-no-ipv4-search-tree.t

package info (click to toggle)
libmaxmind-db-reader-xs-perl 1.000007-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,784 kB
  • sloc: perl: 3,202; ansic: 260; makefile: 3; sh: 2
file content (29 lines) | stat: -rw-r--r-- 647 bytes parent folder | download | duplicates (7)
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
use strict;
use warnings;
use autodie;

use Test::Fatal;
use Test::More;

use lib 't/lib';

# This must come before `use MaxMind::DB::Reader;` as otherwise the wrong
# reader may be loaded
use Test::MaxMind::DB::Reader;

use MaxMind::DB::Reader;

my $reader = MaxMind::DB::Reader->new(
    file => 'maxmind-db/test-data/MaxMind-DB-no-ipv4-search-tree.mmdb' );

is(
    $reader->record_for_address('1.1.1.1'), '::0/64',
    'IPv4 lookup in tree without ::/96 subtree worked (first bit is 0)'
);

is(
    $reader->record_for_address('192.1.1.1'), '::0/64',
    'IPv4 lookup in tree without ::/96 subtree worked (first bit is 1)'
);

done_testing();