File: 07-intf.t

package info (click to toggle)
libnet-libdnet-perl 0.98-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 412 kB
  • sloc: perl: 1,007; ansic: 311; makefile: 9
file content (36 lines) | stat: -rw-r--r-- 847 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
#!/usr/bin/perl
#
# $Id: 07-intf.t 3 2008-11-25 19:56:47Z gomor $
#

use Test;
BEGIN{ plan tests => 9 };

use Net::Libdnet;

# the tests may destroy your network configuration.
# just fake them for those people who did not explicitely require them.
if( !$ENV{REAL_TESTS} ){
	print STDERR "$0: faking dangerous tests\n";
	for( $i=0 ; $i<9 ; $i++ ){ ok(1); };
	exit 0;
}

# gateway to a.root-server.net
$gw = route_get("198.41.0.4");

ok(intf_get_dst(undef)->{name}, undef);
ok(intf_get_dst("XXX")->{name}, undef);
$if = intf_get_dst($gw);
$name = $if->{name};
$ip = $if->{addr}; $ip =~ s,/.*$,,;
ok(defined($name), 1);

ok(intf_get(undef)->{name}, undef);
ok(intf_get("XXX")->{name}, undef);
ok(intf_get($name)->{name}, $name);

ok(intf_get_src(undef)->{name}, undef);
ok(intf_get_src("XXX")->{name}, undef);
ok(intf_get_src($ip)->{name}, $name);