Check/Test/soa_refresh_range.pm untested

filter: Statementstmt 0.0% 0 / 34 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 58 CC 5 SCAR 24.8
CC
5
Cov
0%
test
20.0
new
6.0
BEGIN
2.0
CRAP 12.0
1 package Net::DNS::Check::Test::soa_refresh_range;
2  
3 use strict;
4 use vars qw(@ISA $VERSION);
5  
6 @ISA = qw(Net::DNS::Check::Test);
7  
8  
9 sub new {
10 my ($class) = shift;
11  
12 my ($self) = bless {}, $class;
13  
14 if ( @_ ) {
15 $self->_process_args(@_);
16 }
17  
18 $self->test();
19  
20 return $self;
21 }
22  
23  
24 sub test()
25 {
26 my ($self) = shift;
27  
28 return unless ( $self->{config} );
29  
30 my $soa_min_refresh = $self->{config}->soa_min_refresh();
31 my $soa_max_refresh = $self->{config}->soa_max_refresh();
32  
33 my $test_status = 1;
34 my $test_detail = {};
35  
36 foreach my $nsquery ( @{$self->{nsquery}} ) {
37 my $soa_refresh = scalar $nsquery->soa_refresh();
38 my $ns_name = $nsquery->ns_name();
39
40 $test_detail->{$ns_name}->{desc} = $soa_refresh;
41  
42 if ($soa_min_refresh > 0 && $soa_refresh < $soa_min_refresh ) {
43 $test_status = 0;
44 $test_detail->{$ns_name}->{status} = 0;
45 } elsif ( $soa_max_refresh > 0 && $soa_refresh > $soa_max_refresh ) {
46 $test_status = 0;
47 $test_detail->{$ns_name}->{status} = 0;
48 } else {
49 $test_detail->{$ns_name}->{status} = 1;
50 }
51 }
52  
53 $self->{test_status} = $test_status;
54 $self->{test_detail} = $test_detail;
55  
56 return $test_status;
57 }
58  
59 1;
60  
61 __END__