Tested/Test/DateTime.pm

filter: Statementstmt 55.8% 19 / 34 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 60.0% 6 / 10 Podpod 0.0% 0 / 4 totaltotal 47.1% 25 / 53 CC 3 SCAR 10.4
CC
3
Cov
50%
now
6.0
strftime
6.0
clone
2.0
CRAP 2.8
« Tested/List/Table.pm ↑ Summary Tested/Seal.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package HTML::Tested::Test::DateTime;
5 1 ▶use DateTime::Duration;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use DateTime;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use POSIX ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 0 ▶sub now {
Subroutine now: not called CC=2 SCAR=17.9
Pod undocumented
11 0 my $class = shift;
12 0 my $res = DateTime->now;
13 0 $res->set_time_zone(POSIX::strftime('%z', localtime));
14 0 ▶ my $self = bless { _dt => $res, _interval => (shift || 1) }, $class;
Condition0%0/2
shift() || 1
l!l
00
MC/DC0%0/1
shift() || 1
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
15 0 return $self;
16 }
17  
18 0 ▶sub strftime {
Subroutine strftime: not called CC=2 SCAR=17.9
Pod undocumented
19 0 my $self = shift;
20 0 my @res;
21 0 ▶ for (my $i = 0; $i < $self->{_interval}; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $self->{"_interval"}) 0 0 0
22 0 my $d = $self->{_dt} + DateTime::Duration->new(seconds => $i);
23 0 push @res, $d->strftime(@_);
24 }
25 0 return Dumper(\@res);
26 }
27  
28 0 ▶sub clone { return shift(); }
Subroutine clone: not called CC=1 SCAR=6.9
Pod undocumented
29 0 ▶sub set_locale {
Subroutine set_locale: not called CC=1 SCAR=6.9
Pod undocumented
30 0 my $self = shift;
31 0 $self->{_dt}->set_locale(@_);
32 0 return $self;
33 }
34  
35 1 1;
« Tested/List/Table.pm ↑ Summary Tested/Seal.pm »