4 |
use strict; |
use strict; |
5 |
use autodie; |
use autodie; |
6 |
|
|
7 |
use Test::More tests => 16; |
use Test::More tests => 19; |
8 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
9 |
use English; |
use English; |
10 |
|
|
23 |
|
|
24 |
ok( ! client::conf( $host => 'non-existing' ), 'conf non-existing' ); |
ok( ! client::conf( $host => 'non-existing' ), 'conf non-existing' ); |
25 |
|
|
26 |
|
ok( client::remove( $host ), "remove $host" ); |
27 |
|
|
28 |
ok( my $ip = client::next_ip( $mac ), 'next_ip' ); |
ok( my $ip = client::next_ip( $mac ), 'next_ip' ); |
29 |
diag $ip; |
diag $ip; |
30 |
|
|
42 |
ok( my @ips = client::all_ips(), 'all_ips' ); |
ok( my @ips = client::all_ips(), 'all_ips' ); |
43 |
diag dump @ips; |
diag dump @ips; |
44 |
|
|
45 |
diag "cleanup"; |
ok( my $new_ip = client::change_ip( $ip, $host ), 'change_ip' ); |
46 |
ok( unlink( $_ ), "unlink $_" ) foreach ( glob("$dir/ip/$host/*"), "$dir/mac/$mac" ); |
ok( ! client::change_ip( $new_ip, $new_ip ), 'change_ip without change' ); |
47 |
ok( rmdir "$dir/ip/$host", 'rmdir' ); |
ok( my $old_ip = client::change_ip( $new_ip, $ip ), 'change_ip back' ); |
48 |
|
cmp_ok( $old_ip, 'eq', $ip, 'ip back' ); |
49 |
|
|
50 |
|
ok( client::remove( $ip ), "remove $ip" ); |