Branch Coverage

blib/lib/DateTimeX/Moment.pm
Criterion Covered Total %
branch 210 270 77.7


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 334 if $a eq 'DateTime'
76 8 126 if ($time_zone->is_floating) { }
87 76 610 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
292 1 3 unless (shift())->{'_moment'}->hour
293 1 2 unless (shift())->hour_12_0
335 523 2 $hyphen ? :
342 1 2 $hyphen ? :
349 1 2 $hyphen ? :
356 2 2 $colon ? :
385 8 12 $_[0]{'_moment'}->hour < 12 ? :
410 0 0 $lhs < 0 ? :
419 0 48 unless $rhs->isa($class)
420 4 44 unless $lhs->time_zone->name eq $rhs->time_zone->name
424 12 36 $lhs_moment < $rhs_moment ? :
425 12 36 if $sign == -1
434 21 27 if ($time_zone->has_dst_changes)
438 13 8 if ($lhs_dst != $rhs_dst)
443 12 1 if (defined $previous)
445 5 7 if ($lhs_dst) { }
446 4 1 unless $previous_dst
449 1 6 if $previous_dst
455 6 42 if ($nanoseconds < 0)
459 5 43 if ($seconds < 0)
463 8 40 if ($minutes < 0)
467 9 39 if ($days < 0)
486 0 4 unless $rhs->isa($class)
487 0 4 unless $lhs->time_zone eq $rhs->time_zone
490 2 2 $lhs_moment < $rhs_moment ? :
491 2 2 if $sign == -1
504 53 10 unless defined $self->{'formatter'}
510 2 17 unless defined $rhs
511 0 17 $flip ? :
516 0 15 unless defined $rhs
517 3 12 if _isa_datetime_compareble($rhs)
520 2 10 $flip ? :
526 12 0 ref $_[0] ? :
527 0 12 unless defined $rhs
528 2 10 if _isa_datetime_compareble($rhs)
534 0 6 if $flip
536 2 4 unless (_isa_duration($dur))
548 0 12 if $flip
550 1 11 if (_isa_duration($date2)) { }
9 2 elsif (_isa_datetime($date2)) { }
570 30 51 ref $_[0] ? :
571 0 81 unless defined $rhs
573 2 79 unless (_isa_datetime_compareble($lhs) and _isa_datetime_compareble($rhs))
577 75 2 if (not $consistent and $lhs->can('time_zone') and $rhs->can('time_zone'))
581 0 75 if ($is_floating1 and not $is_floating2) { }
3 129 elsif ($is_floating2 and not $is_floating1) { }
589 77 2 if ($lhs->isa('DateTimeX::Moment') and $rhs->isa('DateTimeX::Moment'))
597 2 2 if $lhs_components[$i] != $rhs_components[$i]
605 0 41 @_ == 1 && ref $_[0] eq 'HASH' ? :
611 41 246 $unit eq 'day' ? :
612 69 218 exists $args{$unit} ? :
614 0 41 if (%args)
620 31 0 unless ($moment->is_equal($result))
640 0 656 if @_ == 1 and _isa_duration($_[0])
642 0 656 @_ == 1 && ref $_[0] eq 'HASH' ? :
647 0 503 if (exists $args{'years'} and exists $args{'months'})
648 0 0 $type eq 'plus' ? :
654 1954 670 unless exists $args{$unit}
659 602 54 unless ($moment->is_equal($result))
667 2416 204 unless exists $args{$unit}
672 71 584 unless ($moment->is_equal($result))
677 0 655 if (%args)
716 5 0 $another->isa('DateTimeX::Moment') ? :
717 0 5 unless _isa_moment($rhs)
720 4 1 $lhs > $rhs ? :
723 0 5 if ($unit eq 'milliseconds') { }
0 5 elsif ($unit eq 'microseconds') { }
761 6 1 $self->can($2) ? :
764 163 2 unless wantarray
786 0 31 if @_ != 2
789 2 29 if $time_zone == $self->{'time_zone'}
790 0 29 if $time_zone->name eq $self->{'time_zone'}->name
793 5 24 if ($self->{'time_zone'}->is_floating) { }
811 0 48 @_ == 1 && ref $_[0] eq 'HASH' ? :
814 0 48 unless my $to = delete $args{'to'}
815 0 48 if (%args)
822 1 47 if ($to eq 'year') { }
2 45 elsif ($to eq 'month') { }
9 36 elsif ($to eq 'week') { }
16 20 elsif ($to eq 'local_week') { }
12 8 elsif ($to eq 'day') { }
1 7 elsif ($to eq 'hour') { }
2 5 elsif ($to eq 'minute') { }
1 4 elsif ($to eq 'second') { }
856 35 9 unless ($moment->is_equal($result))
872 0 50 unless _isa_duration($duration)
875 0 50 if $duration->is_zero
877 0 50 unless ($duration->is_limit_mode)
886 0 6 if @_ != 2
898 24 831 unless is_instance($_[0], 'DateTime::Locale::FromData')
899 4 1 if _isa_invocant($_[0])
902 176 13 if &blessed($_[0])
905 3 0 if &blessed($_[0])
906 2 3 unless &blessed($_[0])