7 use Test::More tests => 14;
8 use Data::Dump qw/dump/;
13 my $host = '127.0.0.1';
14 my $mac = 'dead00beef';
16 my $dir = "$server::base_dir/conf/$server::ip";
17 system "sudo chown $UID $dir/ip $dir/mac";
19 ok( client::conf( $host => 'test', default => 'default' ), 'conf default' );
20 cmp_ok( client::conf( $host => 'test' ), 'eq', 'default', 'default' );
21 ok( client::conf( $host => 'test' => 'value' ), 'conf set' );
22 cmp_ok( client::conf( $host => 'test' ), 'eq', 'value', 'value' );
24 ok( ! client::conf( $host => 'non-existing' ), 'conf non-existing' );
26 ok( my $ip = client::next_ip( $mac ), 'next_ip' );
29 ok( my $ip_from_mac = client::ip_from_mac( $mac ), 'ip_from_mac' );
31 cmp_ok( $ip_from_mac, 'eq', $ip );
33 ok( my $mac_from_ip = client::mac_from_ip( $ip ), 'mac_from_ip' );
35 cmp_ok( $mac_from_ip, 'eq', $mac );
38 ok( unlink( $_ ), "unlink $_" ) foreach ( glob("$dir/ip/$host/*"), "$dir/mac/$mac" );
39 ok( rmdir "$dir/ip/$host", 'rmdir' );