1 |
dpavlin |
156 |
#!/usr/bin/perl |
2 |
|
|
|
3 |
|
|
use warnings; |
4 |
|
|
use strict; |
5 |
|
|
use autodie; |
6 |
|
|
|
7 |
dpavlin |
194 |
use Test::More tests => 9; |
8 |
dpavlin |
156 |
use Data::Dump qw/dump/; |
9 |
|
|
|
10 |
|
|
use_ok 'client'; |
11 |
|
|
|
12 |
|
|
my $host = '127.0.0.1'; |
13 |
|
|
my $test_path = "$server::base_dir/conf/$server::ip/ip/$host/test"; |
14 |
|
|
unlink $test_path if -e $test_path; |
15 |
|
|
|
16 |
|
|
ok( client::conf( $host => 'test', default => 'default' ), 'conf default' ); |
17 |
|
|
cmp_ok( client::conf( $host => 'test' ), 'eq', 'default', 'default' ); |
18 |
|
|
ok( client::conf( $host => 'test' => 'value' ), 'conf set' ); |
19 |
|
|
cmp_ok( client::conf( $host => 'test' ), 'eq', 'value', 'value' ); |
20 |
|
|
|
21 |
dpavlin |
168 |
ok( my $ip = client::next_ip(), 'next_ip' ); |
22 |
|
|
diag $ip; |
23 |
|
|
|
24 |
dpavlin |
156 |
diag "cleanup"; |
25 |
|
|
ok( unlink($test_path), "unlink $test_path" ); |
26 |
|
|
$test_path =~ s{/[^/]+$}{}; |
27 |
|
|
ok( rmdir($test_path), "rmdir $test_path" ); |
28 |
dpavlin |
194 |
|
29 |
|
|
ok( my $ip = client::ip_from_mac( 'AC:DE:48:00:00:00' ), 'ip_from_mac' ); |
30 |
|
|
diag $ip; |
31 |
dpavlin |
200 |
|
32 |
|
|
ok( my $mac = client::mac_from_ip( $ip ), 'mac_from_ip' ); |
33 |
|
|
diag $mac; |