File: github-0004.t

package info (click to toggle)
libnet-netmask-perl 2.0003-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 320 kB
  • sloc: perl: 2,239; makefile: 2; sh: 1
file content (38 lines) | stat: -rwxr-xr-x 760 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
38
#!/usr/bin/perl -w

use strict;

use utf8;
use Test2::V0;

use Net::Netmask;

my $debug = 0;

ok( Net::Netmask->debug($debug) == $debug, "unable to set debug" );

# test a variety of ip's with bytes greater than 255.
# all these tests should return undef

my @tests = (
    {
        input => ['١٠٠.١٠٠.١٠٠.١٠٠/32'],
        error => qr/^could not parse /,
        type  => 'bad net byte',
    },
);

foreach my $test (@tests) {
    my $input = $test->{input};
    my $err   = $test->{error};
    my $name  = ( join ', ', @{ $test->{input} } );
    my $type  = $test->{type};

    my $result = Net::Netmask->new2(@$input);

    is( $result, undef, "$name $type" );
    like( Net::Netmask->errstr, $err, "$name errstr mismatch" );
}

done_testing;