TinyDNS/t/1.t

filter: Statementstmt 43.7% 28 / 64 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 48.6% 36 / 74 CC 1 SCAR 0.0
CC
1
Cov
44%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/DNS/example.pl ↑ Summary
1 # Before `make install' is performed this script should be runnable with
2 # `make test'. After `make install' it should work as `perl 1.t'
3 #########################
4  
5 # change 'tests => 1' to 'tests => last_test_to_print';
6  
7 #########################
8  
9 # Insert your test code below, the Test::More module is use()ed here so read
10 # its man page ( perldoc Test::More ) for help writing this test script.
11  
12 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use lib ".";
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use Test::More tests => 32;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use DNS::TinyDNS;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 my ($dnscache,%config,$cache,$server);
19  
20 # Tests 4 dnscache
21 1 $dnscache = DNS::TinyDNS->new( type => 'dnscache');
22 1 ok( $dnscache );
23  
24 SKIP : {
25 1 ▶ skip("I can't find a running version of dnscache", 19)
Branch: 1 branch
BranchTrueFalseTotal
unless $dnscache->dir("/service/dnscachex") 1 0 1
26 unless $dnscache->dir("/service/dnscachex");
27 0 ok( $dnscache->dir );
28 0 ok( $config{ip} = $dnscache->get_env('ip') );
29 0 ok( $config{ipsend} = $dnscache->get_env('ipsend') );
30 0 ok( $config{cachesize} = $dnscache->get_env('cachesize') );
31 0 ok( $config{datalimit} = $dnscache->get_env('datalimit') );
32 0 ok( $config{root} = $dnscache->get_env('root') );
33 {
34 0 my @a = $dnscache->get_env( qw{cachesize ip datalimit} );
35 0 ok( 3 == @a );
36 }
37 0 ok( $dnscache->set_env( ip => $config{ip} ) );
38 0 ok( $dnscache->set_env( root => $config{root} ) );
39 0 ok( $dnscache->set_env( cachesize => $config{cachesize} ) );
40 0 ok( $dnscache->set_env( datalimit => $config{datalimit} ) );
41 0 ok( $dnscache->set_env( ipsend => $config{ipsend} ) );
42 ok( $dnscache->set_env( ip => $config{ip},
43 root => $config{root},
44 0 cachesize => $config{cachesize} ) );
45 0 ok( $dnscache->add_ip( '10.0.0.13' ) );
46 0 ok( $dnscache->del_ip( '10.0.0.13' ) );
47 0 ok( $dnscache->list_ips );
48 0 ok( $dnscache->list_servers );
49 0 ok( $dnscache->add_server( '10.0.0.13' ) );
50 0 ok( $dnscache->del_server( '10.0.0.13' ) );
51 }
52 # End of dnscache tests
53  
54 # Test for dnsserver
55 1 %config = ();
56 1 my $dnsserver = DNS::TinyDNS->new(type => 'dnsserver');
57 1 ok( $dnsserver );
58  
59 SKIP : {
60 1 ▶ skip("I can't find a running version of dnsserver", 11)
Branch: 1 branch
BranchTrueFalseTotal
unless $dnsserver->dir("/service/tinydns") 1 0 1
61 unless $dnsserver->dir("/service/tinydns");
62  
63 0 ok( $dnsserver->dir );
64 0 ok( $config{ip}=$dnsserver->get_env('ip') );
65 0 ok( $config{root}=$dnsserver->get_env('root') );
66 {
67 0 my @a = $dnsserver->get_env( qw{ip root} );
68 0 ok( 2 == @a );
69 }
70 0 ok( $dnsserver->set_env( ip => $config{ip} ) );
71 0 ok( $dnsserver->set_env( root => $config{root} ) );
72 {
73 0 my @zones;
74 0 ok( @zones=$dnsserver->list_zones );
75 0 ok( $dnsserver->list( type => 'mx',
76 zone => $zones[-1] ) );
77 0 ok( $dnsserver->get_zone( $zones[-1] ) );
78 }
79 0 ok( $dnsserver->add( zone => '7a69ezine.org',
80 type => 'host',
81 ip => '10.0.0.1',
82 host => 'rivendel',
83 ttl => 84500, ) );
84 0 ok( $dnsserver->del( zone => '7a69ezine.org',
85 type => 'host',
86 ip => '10.0.0.1',
87 host => 'rivendel',
88 ttl => 84500, ) );
89 }
90  
91 1;
« blib/lib/DNS/example.pl ↑ Summary