Branch Coverage

blib/lib/DateTimeX/Moment.pm
Criterion Covered Total %
branch 199 260 76.5


line true false branch
32 33 0 if (eval { do { require Data::Util; 1 } }) { }
36 0 0 if &blessed($_[0])
49 0 793 unless defined $locale
50 769 24 if _isa_locale($locale)
56 785 5 unless defined $formatter
57 4 1 if _isa_formatter($formatter)
63 0 773 unless defined $time_zone
64 88 685 if _isa_time_zone($time_zone)
70 9 249 if $a eq 'DateTime'
76 6 98 if ($time_zone->is_floating) { }
87 55 557 if ($time_zone->is_floating) { }
98 0 761 @_ == 1 && ref $_[0] eq 'HASH' ? :
100 1 760 if exists $args{'language'}
118 0 20 @_ == 1 && ref $_[0] eq 'HASH' ? :
120 0 20 if exists $args{'language'}
123 1 19 exists $args{'time_zone'} ? :
124 0 20 if (%args)
141 0 7 @_ == 1 && ref $_[0] eq 'HASH' ? :
143 0 7 unless my $object = delete $args{'object'}
145 0 7 if exists $args{'language'}
148 6 1 $object->can('time_zone') ? :
149 0 7 if (%args)
154 4 3 if ($object->isa('DateTimeX::Moment'))
157 1 3 if $formatter
164 3 0 if (_isa_moment_convertable($object)) { }
170 0 0 if ($object->time_zone->is_floating)
187 0 19 @_ == 1 && ref $_[0] eq 'HASH' ? :
188 0 19 unless exists $args{'epoch'}
192 0 19 if exists $args{'language'}
195 1 18 exists $args{'time_zone'} ? :
196 0 19 if (%args)
220 0 28 @_ == 1 && ref $_[0] eq 'HASH' ? :
222 0 56 unless defined $args{$key}
224 1 27 if 0 > $args{'month'} or $args{'month'} > 12
237 1 35 if $month == 2 and _is_leap_year($year)
243 6 9 if $year % 4
244 3 6 if $year % 100
245 3 3 if $year % 400
251 0 26 @_ == 1 && ref $_[0] eq 'HASH' ? :
253 0 52 unless defined $args{$key}
266 134 710 if $self->{'time_zone'}->is_floating
292 1 3 unless (shift())->{'_moment'}->hour
293 1 2 unless (shift())->hour_12_0
326 106 523 defined $_[0] ? :
335 2 1 defined $_[0] ? :
344 2 1 defined $_[0] ? :
353 106 2 defined $_[0] ? :
383 8 12 $_[0]{'_moment'}->hour < 12 ? :
408 0 0 $lhs < 0 ? :
414 16 9 if $lhs->day_of_month >= $rhs->day_of_month
423 0 25 unless $rhs->isa($class)
424 0 25 unless $lhs->time_zone->name eq $rhs->time_zone->name
428 9 16 $lhs_moment < $rhs_moment ? :
429 9 16 if $sign == -1
437 6 19 if ($nanoseconds < 0)
441 5 20 if ($seconds < 0)
445 4 21 if ($minutes < 0)
449 0 25 if ($days < 0)
469 0 2 unless $rhs->isa($class)
470 0 2 unless $lhs->time_zone eq $rhs->time_zone
473 1 1 $lhs_moment < $rhs_moment ? :
474 1 1 if $sign == -1
487 53 10 unless defined $self->{'formatter'}
493 2 15 unless defined $rhs
494 0 15 $flip ? :
499 0 15 unless defined $rhs
500 3 12 if _isa_datetime_compareble($rhs)
503 2 10 $flip ? :
509 12 0 ref $_[0] ? :
510 0 12 unless defined $rhs
511 2 10 if _isa_datetime_compareble($rhs)
517 0 6 if $flip
519 2 4 unless (_isa_duration($dur))
531 0 12 if $flip
533 1 11 if (_isa_duration($date2)) { }
9 2 elsif (_isa_datetime($date2)) { }
553 28 24 ref $_[0] ? :
554 0 52 unless defined $rhs
556 2 50 unless (_isa_datetime_compareble($lhs) and _isa_datetime_compareble($rhs))
560 46 2 if (not $consistent and $lhs->can('time_zone') and $rhs->can('time_zone'))
564 0 46 if ($is_floating1 and not $is_floating2) { }
3 73 elsif ($is_floating2 and not $is_floating1) { }
572 48 2 if ($lhs->isa('DateTimeX::Moment') and $rhs->isa('DateTimeX::Moment'))
580 2 2 if $lhs_components[$i] != $rhs_components[$i]
588 0 81 @_ == 1 && ref $_[0] eq 'HASH' ? :
594 81 486 $unit eq 'day' ? :
595 225 342 exists $args{$unit} ? :
597 0 81 if (%args)
621 0 647 if @_ == 1 and _isa_duration($_[0])
623 0 647 @_ == 1 && ref $_[0] eq 'HASH' ? :
628 0 503 if (exists $args{'years'} and exists $args{'months'})
629 0 0 $type eq 'plus' ? :
635 1955 633 unless exists $args{$unit}
640 607 40 unless ($moment->is_equal($result))
648 2472 112 unless exists $args{$unit}
653 49 597 unless ($moment->is_equal($result))
658 0 646 if (%args)
697 3 0 $another->isa('DateTimeX::Moment') ? :
698 0 3 unless _isa_moment($rhs)
701 2 1 $lhs > $rhs ? :
704 0 3 if ($unit eq 'milliseconds') { }
0 3 elsif ($unit eq 'microseconds') { }
742 6 1 $self->can($2) ? :
745 163 2 unless wantarray
767 0 23 if @_ != 2
770 2 21 if $time_zone == $self->{'time_zone'}
771 0 21 if $time_zone->name eq $self->{'time_zone'}->name
774 5 16 if ($self->{'time_zone'}->is_floating) { }
792 0 69 @_ == 1 && ref $_[0] eq 'HASH' ? :
795 0 69 unless my $to = delete $args{'to'}
796 0 69 if (%args)
801 25 44 if ($to eq 'week' or $to eq 'local_week')
802 16 9 $to eq 'local_week' ? :
804 22 3 if $day_diff
808 1 24 if ($@)
816 1 43 if $to eq 'second'
817 2 41 if $to eq 'minute'
818 1 40 if $to eq 'hour'
819 33 7 if $to eq 'day'
820 2 5 if $to eq 'month'
821 1 4 if $to eq 'year'
839 0 20 unless _isa_duration($duration)
842 0 20 if $duration->is_zero
844 0 20 unless ($duration->is_limit_mode)
853 0 6 if @_ != 2
865 24 769 unless is_instance($_[0], 'DateTime::Locale::FromData')
866 4 1 if _isa_invocant($_[0])
869 118 13 if &blessed($_[0])
872 3 0 if &blessed($_[0])
873 2 3 unless &blessed($_[0])