blib/lib/Salvation/TC/Type/Date/Reverse.pm

filter: Statementstmt 66.6% 14 / 21 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 80.0% 4 / 5 Podpod 100% 1 / 1 totaltotal 52.7% 19 / 36 SCAR 17.9
CC
4
Cov
50%
Check
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 6.0
« blib/lib/Salvation/TC/Type/Text.pm ↑ Summary blib/lib/Salvation/TC/Utils.pm »
1 package Salvation::TC::Type::Date::Reverse;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use base 'Salvation::TC::Type::Date';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 4 ▶use Salvation::TC::Exception::WrongType ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 4 my $re = qr/^(\d{4})[\.\/\-](\d{1,2})[\.\/\-](\d{1,2})\s*(\d+:\d+(:\d+)*?)?$/;
11  
12 sub Check {
13  
14 0 ▶ my ( $class, $date ) = @_;
Subroutine Check: not called CC=4 SCAR=30.0
Pod documented
15  
16 0 eval {
17  
18 0 ▶ die "Wrong date format. Expected year[.-/]month[./-]day time" if ( ! defined( $date ) || $date !~ $re );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $date and $date =~ /$re/ 0 0 0
Condition0%0/3
defined $date and $date =~ /$re/
!ll&&!rl&&r
000
MC/DC0%0/2
defined $date and $date =~ /$re/
defined $date $date =~ /$re/
Truth table0%0/3
A and B
A= defined $dateB= $date =~ /$re/
ABresult
0X0
100
111
19  
20 0 my ( $year, $month, $day, $time ) = ( $1, $2, $3, $4 );
21  
22 0 $class->SUPER::Check( "$day.$month.$year $time" );
23 };
24  
25 0 ▶ if( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
26  
27 0 Salvation::TC::Exception::WrongType -> throw( type => 'Date::Reverse', value => $date );
28 };
29 }
30  
31 4 1;
32 __END__
« blib/lib/Salvation/TC/Type/Text.pm ↑ Summary blib/lib/Salvation/TC/Utils.pm »