/[pxelator]/lib/PXElator/t/ip.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /lib/PXElator/t/ip.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 413 - (hide annotations)
Wed Sep 9 14:27:02 2009 UTC (14 years, 8 months ago) by dpavlin
File MIME type: application/x-troff
File size: 857 byte(s)
added ip::in_dhcp_range and use it

1 dpavlin 224 #!/usr/bin/perl
2    
3     use warnings;
4     use strict;
5     use autodie;
6    
7 dpavlin 413 use Test::More tests => 12;
8 dpavlin 224 use Data::Dump qw/dump/;
9    
10     use_ok 'ip';
11    
12     foreach my $object ( qw/link route/ ) {
13     ok( my @a = ip::lines( $object ), "lines $object" );
14     diag dump( @a );
15     ok( my $h = ip::html( $object ), "html $object" );
16     diag $h;
17     }
18    
19 dpavlin 265 ok( my @devs = ip::devices_up(), 'devices_up' );
20     diag dump( @devs );
21 dpavlin 278
22     ok( ip::default_route_dev(), 'default_route_dev' );
23    
24     ok( my $int = ip::to_int( '127.0.0.1' ), 'to_int' );
25     ok( my $ip = ip::from_int( $int ), 'from_int' );
26     cmp_ok( $ip, 'eq', '127.0.0.1', 'same' );
27 dpavlin 413
28     my $ip_in_range = ip::to_int($server::ip) & ip::to_int($server::netmask);
29     $ip_in_range += $server::ip_from;
30     $ip_in_range = ip::from_int($ip_in_range);
31    
32     ok( ip::in_dhcp_range( $ip_in_range ), "in_dhcp_range $ip_in_range" );
33     ok( ! ip::in_dhcp_range( '4.2.2.2' ), 'not in_dhcp_range' );

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26