Branch Coverage

blib/lib/DateTimeX/Moment.pm
Criterion Covered Total %
branch 200 268 74.6


line true false branch
32 35 0 if (eval { do { require Data::Util; 1 } }) { }
36 0 0 if &blessed($_[0])
49 0 855 unless defined $locale
50 831 24 if _isa_locale($locale)
56 847 5 unless defined $formatter
57 4 1 if _isa_formatter($formatter)
63 0 843 unless defined $time_zone
64 92 751 if _isa_time_zone($time_zone)
70 9 326 if $a eq 'DateTime'
76 8 126 if ($time_zone->is_floating) { }
87 76 604 if ($time_zone->is_floating) { }
98 0 823 @_ == 1 && ref $_[0] eq 'HASH' ? :
100 1 822 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 26 if $month == 2 and _is_leap_year($year)
243 3 8 if $year % 4
244 2 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 90 745 if $self->{'time_zone'}->is_floating
308 1 3 unless $_[0]{'_moment'}->hour
309 1 2 unless $_[0]->hour_12_0
382 8 12 $_[0]{'_moment'}->hour < 12 ? :
403 523 2 $hyphen ? :
410 1 2 $hyphen ? :
417 1 2 $hyphen ? :
424 2 2 $colon ? :
437 0 44 unless $rhs->isa($class)
438 4 40 unless $lhs->time_zone->name eq $rhs->time_zone->name
442 12 32 $lhs_moment < $rhs_moment ? :
443 12 32 if $sign == -1
452 19 25 if ($time_zone->has_dst_changes)
456 11 8 if ($lhs_dst != $rhs_dst)
461 10 1 if (defined $previous)
463 4 6 if ($lhs_dst) { }
464 4 0 unless $previous_dst
467 1 5 if $previous_dst
473 6 38 if ($nanoseconds < 0)
477 5 39 if ($seconds < 0)
481 8 36 if ($minutes < 0)
485 9 35 if ($days < 0)
503 0 4 unless $rhs->isa($class)
520 53 10 unless defined $self->{'formatter'}
526 2 13 unless defined $rhs
527 0 13 $flip ? :
532 0 15 unless defined $rhs
533 3 12 if _isa_datetime_compareble($rhs)
536 2 10 $flip ? :
542 12 0 ref $_[0] ? :
543 0 12 unless defined $rhs
544 2 10 if _isa_datetime_compareble($rhs)
550 0 6 if $flip
552 2 4 unless (_isa_duration($dur))
564 0 12 if $flip
566 1 11 if (_isa_duration($date2)) { }
9 2 elsif (_isa_datetime($date2)) { }
586 26 51 ref $_[0] ? :
587 0 77 unless defined $rhs
589 2 75 unless (_isa_datetime_compareble($lhs) and _isa_datetime_compareble($rhs))
593 71 2 if (not $consistent and $lhs->can('time_zone') and $rhs->can('time_zone'))
597 0 71 if ($is_floating1 and not $is_floating2) { }
3 121 elsif ($is_floating2 and not $is_floating1) { }
605 73 2 if ($lhs->isa('DateTimeX::Moment') and $rhs->isa('DateTimeX::Moment'))
613 2 2 if $lhs_components[$i] != $rhs_components[$i]
621 0 41 @_ == 1 && ref $_[0] eq 'HASH' ? :
634 0 69 unless exists $params{$component}
637 0 41 if (%args)
643 31 0 unless ($moment->is_equal($result))
659 0 31 if @_ != 2
662 2 29 if $time_zone == $self->{'time_zone'}
663 0 29 if $time_zone->name eq $self->{'time_zone'}->name
666 5 24 if ($self->{'time_zone'}->is_floating) { }
679 0 6 if @_ != 2
696 0 656 if @_ == 1 and _isa_duration($_[0])
698 0 656 @_ == 1 && ref $_[0] eq 'HASH' ? :
703 0 503 if (exists $args{'years'} and exists $args{'months'})
704 0 0 $type eq 'plus' ? :
710 1954 670 unless exists $args{$unit}
715 602 54 unless ($moment->is_equal($result))
723 2416 204 unless exists $args{$unit}
728 71 584 unless ($moment->is_equal($result))
733 0 655 if (%args)
746 0 4 unless $rhs->isa($class)
751 1 3 if ($lhs_moment->rd < $rhs_moment->rd)
758 0 4 if ($days < 0)
773 0 5 unless $rhs->isa($class)
806 0 0 $another->isa('DateTimeX::Moment') ? :
807 0 0 unless _isa_moment($rhs)
810 0 0 $lhs > $rhs ? :
813 0 0 if ($unit eq 'milliseconds') { }
0 0 elsif ($unit eq 'microseconds') { }
851 6 1 $self->can($2) ? :
854 163 2 unless wantarray
876 0 40 @_ == 1 && ref $_[0] eq 'HASH' ? :
879 0 40 unless my $to = delete $args{'to'}
880 0 40 if (%args)
887 1 39 if ($to eq 'year') { }
2 37 elsif ($to eq 'month') { }
9 28 elsif ($to eq 'week') { }
16 12 elsif ($to eq 'local_week') { }
4 8 elsif ($to eq 'day') { }
1 7 elsif ($to eq 'hour') { }
2 5 elsif ($to eq 'minute') { }
1 4 elsif ($to eq 'second') { }
921 31 5 unless ($moment->is_equal($result))
937 0 50 unless _isa_duration($duration)
940 0 50 if $duration->is_zero
942 0 50 unless ($duration->is_limit_mode)
950 24 831 unless is_instance($_[0], 'DateTime::Locale::FromData')
951 4 1 if _isa_invocant($_[0])
954 168 13 if &blessed($_[0])
957 3 0 if &blessed($_[0])
958 2 3 unless &blessed($_[0])