File: 05range.t

package info (click to toggle)
libnet-subnets-perl 1.02-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 136 kB
  • sloc: perl: 669; makefile: 9
file content (21 lines) | stat: -rw-r--r-- 485 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env perl

# Copyright (C) 2003-2010, Sebastian Riedel.

use strict;
use warnings;

use Test::Simple tests => 2;

use Net::Subnets;

my @subnets = qw(10.0.0.0/24 10.0.1.4/32);
my @lowips  = qw(10.0.0.1 10.0.1.4);
my @highips = qw(10.0.0.254 10.0.1.4);

my $sn = Net::Subnets->new;
for (my $i = 0; $i <= $#subnets; $i++) {
    my ($lowip, $highip) = $sn->range(\$subnets[$i]);
    ok((($lowips[$i] eq $$lowip) && ($highips[$i] eq $$highip)),
        'right address range');
}