| 1 | # Copyright 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Kevin Ryde | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # This file is part of Math-PlanePath. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # Math-PlanePath is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # it under the terms of the GNU General Public License as published by the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # Free Software Foundation; either version 3, or (at your option) any later | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # version. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # Math-PlanePath is distributed in the hope that it will be useful, but | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | # for more details. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | # You should have received a copy of the GNU General Public License along | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | # with Math-PlanePath. If not, see <http://www.gnu.org/licenses/>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | package Math::PlanePath::DekkingCurve; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | ▶ | use 5.004; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | #use List::Util 'max'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | *max = \&Math::PlanePath::_max; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 1 | ▶ | use vars '$VERSION', '@ISA'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | $VERSION = 128; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 1 | ▶ | use Math::PlanePath; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 1 | ▶ | use Math::PlanePath::Base::NSEW; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 1 | @ISA = ('Math::PlanePath::Base::NSEW', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 'Math::PlanePath'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 1 | *_divrem = \&Math::PlanePath::_divrem; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 1 | *_divrem_mutate = \&Math::PlanePath::_divrem_mutate; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | use Math::PlanePath::Base::Generic | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 1 | 'is_infinite', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 1 | ▶ | 'round_nearest'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | use Math::PlanePath::Base::Digits | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 1 | 'round_up_pow', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 'round_down_pow', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 'digit_split_lowtohigh', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 1 | ▶ | 'digit_join_lowtohigh'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | # uncomment this to run the ### lines | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | # use Smart::Comments; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 1 | ▶ | use constant n_start => 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 1 | ▶ | use constant class_x_negative => 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 1 | ▶ | use constant class_y_negative => 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 1 | use constant parameter_info_array => [ { name => 'arms', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | share_key => 'arms_4', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | display => 'Arms', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | type => 'integer', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | minimum => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | maximum => 4, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | default => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | width => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | description => 'Arms', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 1 | ▶ | } ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | sub x_negative { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 4 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
x_negative: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 4 | return $self->{'arms'} > 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 1 | my @x_negative_at_n = (undef, undef, 5, 2, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | sub x_negative_at_n { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 3 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
x_negative_at_n: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 3 | return $x_negative_at_n[$self->{'arms'}]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 1 | sub y_negative { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 4 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
y_negative: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 4 | return $self->{'arms'} > 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 1 | my @y_negative_at_n = (undef, undef, undef, 8, 3); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | sub y_negative_at_n { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 3 | ▶ | my ($self) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
y_negative_at_n: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 3 | return $y_negative_at_n[$self->{'arms'}]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 1 | ▶ | use Math::PlanePath::DekkingCentres; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 1 | ▶ | use vars '@_next_state','@_digit_to_x','@_digit_to_y','@_yx_to_digit'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | BEGIN { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 1 | ▶ | *_next_state = \@Math::PlanePath::DekkingCentres::_next_state; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 1 | *_digit_to_x = \@Math::PlanePath::DekkingCentres::_digit_to_x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 1 | *_digit_to_y = \@Math::PlanePath::DekkingCentres::_digit_to_y; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 1 | *_yx_to_digit = \@Math::PlanePath::DekkingCentres::_yx_to_digit; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 12 | ▶ | my $self = shift->SUPER::new(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 12 | ▶ | $self->{'arms'} ||= 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"arms"} ||= 1
MC/DC100%1/1
$self->{"arms"} ||= 1
$self->{"arms"}
Truth table100%2/2
A
A= $self->{"arms"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 12 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | # tables generated by tools/dekking-curve-table.pl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 1 | my @edge_dx = (0,0,0,1,1, 0,0,1,1,0, 0,0,0,1,0, 0,0,1,0,1, 0,1,0,1,1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 1,1,1,1,1, 1,1,1,0,1, 1,1,0,1,0, 0,0,1,0,0, 0,1,1,0,0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 1,1,1,0,0, 1,1,0,0,1, 1,1,1,0,1, 1,1,0,1,0, 1,0,1,0,0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0,0,0,0,0, 0,0,0,1,0, 0,0,1,0,1, 1,1,0,1,1, 1,0,0,1,1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 1,1,1,1,1, 1,0,0,0,0, 1,1,1,1,1, 0,0,0,0,1, 1,0,0,1,1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 1,1,1,0,0, 1,1,1,1,1, 0,0,0,1,1, 0,0,1,0,1, 0,1,0,1,1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0,0,0,0,0, 0,1,1,1,1, 0,0,0,0,0, 1,1,1,1,0, 0,1,1,0,0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 0,0,0,1,1, 0,0,0,0,0, 1,1,1,0,0, 1,1,0,1,0, 1,0,1,0,0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 1 | my @edge_dy = (0,0,0,0,0, 0,0,0,1,0, 0,0,1,0,1, 1,1,0,1,1, 1,0,0,1,1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0,0,0,1,1, 0,0,1,1,0, 0,0,0,1,0, 0,0,1,0,1, 0,1,0,1,1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 1,1,1,1,1, 1,1,1,0,1, 1,1,0,1,0, 0,0,1,0,0, 0,1,1,0,0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 1,1,1,0,0, 1,1,0,0,1, 1,1,1,0,1, 1,1,0,1,0, 1,0,1,0,0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0,0,0,1,1, 0,0,0,0,0, 1,1,1,0,0, 1,1,0,1,0, 1,0,1,0,0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 1,1,1,1,1, 1,0,0,0,0, 1,1,1,1,1, 0,0,0,0,1, 1,0,0,1,1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 1,1,1,0,0, 1,1,1,1,1, 0,0,0,1,1, 0,0,1,0,1, 0,1,0,1,1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0,0,0,0,0, 0,1,1,1,1, 0,0,0,0,0, 1,1,1,1,0, 0,1,1,0,0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | sub n_to_xy { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 22674 | ▶ | my ($self, $n) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
n_to_xy: called CC=8 SCAR=23.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | ### DekkingCurve n_to_xy(): $n | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 22674 | ▶ | if ($n < 0) { return; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 22674 | ▶ | if (is_infinite($n)) { return ($n,$n); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 22674 | my $int = int($n); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 22674 | $n -= $int; # fraction part | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 22674 | my $arms = $self->{'arms'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 22674 | my $arm = _divrem_mutate ($int, $arms); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 22674 | ▶ | if ($arm) { $int += 1; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 22674 | my @digits = digit_split_lowtohigh($int,25); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 22674 | my $state = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 22674 | my @x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | my @y; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 22674 | foreach my $i (reverse 0 .. $#digits) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 107202 | $state += $digits[$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 107202 | $x[$i] = $_digit_to_x[$state]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 107202 | $y[$i] = $_digit_to_y[$state]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 107202 | $state = $_next_state[$state]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | ### @x | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | ### @y | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | ### $state | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | ### dx: $_digit_to_x[$state+24] - $_digit_to_x[$state] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | ### dy: $_digit_to_y[$state+24] - $_digit_to_y[$state] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 22674 | my $zero = $int * 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 22674 | my $x = ($n * (($_digit_to_x[$state+24] - $_digit_to_x[$state])/4) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | + digit_join_lowtohigh(\@x, 5, $zero) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | + $edge_dx[$state]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 22674 | my $y = ($n * (($_digit_to_y[$state+24] - $_digit_to_y[$state])/4) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | + digit_join_lowtohigh(\@y, 5, $zero) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | + $edge_dy[$state]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 22674 | ▶ | if ($arm < 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 22674 | ▶ | if ($arm < 1) { return ($x,$y); } # arm==0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | return (-$y,$x); # arm==1 rotate +90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | if ($arm < 3) { return (-$x,-$y); } # arm==2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | return ($y,-$x); # arm==3 rotate -90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | sub xy_to_n { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 9405 | ▶ | my ($self, $x, $y) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xy_to_n: called CC=17 SCAR=30.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | ### DekkingCurve xy_to_n(): "$x, $y" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 9405 | $x = round_nearest ($x); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 9405 | $y = round_nearest ($y); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 9405 | ▶ | if (is_infinite($x)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | return $x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 9405 | ▶ | if (is_infinite($y)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | return $y; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 9405 | my $arms = $self->{'arms'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 9405 | ▶ | if (($arms < 2 && $x < 0) || ($arms < 3 && $y < 0)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$arms < 2 and $x < 0 or $arms < 3 and $y < 0
$arms < 2 and $x < 0
$arms < 3 and $y < 0
MC/DC0%0/4
$arms < 2 and $x < 0 or $arms < 3 and $y < 0
$arms < 2
$x < 0
$arms < 3
$y < 0
Truth table14%1/7
A and B or C and D
A= $arms < 2B= $x < 0C= $arms < 3D= $y < 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | ### X or Y negative, no N value ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 9405 | foreach my $arm (0 .. $arms-1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 9405 | foreach my $xoffset (0,-1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 13792 | foreach my $yoffset (0,-1) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 22565 | my @x = digit_split_lowtohigh($x+$xoffset,5); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 22565 | my @y = digit_split_lowtohigh($y+$yoffset,5); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 22565 | my $state = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 22565 | my @n; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 22565 | foreach my $i (reverse 0 .. max($#x,$#y)) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 106999 | ▶ | my $digit = $n[$i] = $_yx_to_digit[$state + 5*($y[$i]||0) + ($x[$i]||0)]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%4/4
$y[$i] || 0
$x[$i] || 0
MC/DC100%1/1
$y[$i] || 0
$y[$i]
MC/DC100%1/1
$x[$i] || 0
$x[$i]
Truth table100%2/2
A
A= $y[$i]
Truth table100%2/2
A
A= $x[$i]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 106999 | $state = $_next_state[$state+$digit]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 22565 | my $zero = $x*0*$y; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 22565 | my $n = digit_join_lowtohigh(\@n, 25, $zero); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 22565 | $n = $n*$arms; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 22565 | ▶ | if (my ($nx,$ny) = $self->n_to_xy($n)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 22565 | ▶ | if ($nx == $x && $ny == $y) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$nx == $x and $ny == $y
MC/DC100%2/2
$nx == $x and $ny == $y
$nx == $x
$ny == $y
Truth table100%3/3
A and B
A= $nx == $xB= $ny == $y
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 5019 | ▶ | return $n + ($arm ? $arm-$arms : $arm); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 4386 | ($x,$y) = ($y,-$x); # rotate -90 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | ### rotate to: "$x, $y" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 4386 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | # not exact | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | sub rect_to_n_range { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 8 | ▶ | my ($self, $x1,$y1, $x2,$y2) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rect_to_n_range: called CC=7 SCAR=23.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | ### DekkingCurve rect_to_n_range(): "$x1,$y1, $x2,$y2" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 8 | $x1 = round_nearest ($x1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 8 | $x2 = round_nearest ($x2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 8 | $y1 = round_nearest ($y1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 8 | $y2 = round_nearest ($y2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 8 | ▶ | if ($x1 > $x2) { ($x1,$x2) = ($x2,$x1); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 8 | ▶ | if ($y1 > $y2) { ($y1,$y2) = ($y2,$y1); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 8 | my $arms = $self->{'arms'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 8 | ▶ | if (($arms < 2 && $x2 < 0) || ($arms < 3 && $y2 < 0)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$arms < 2 and $x2 < 0 or $arms < 3 and $y2 < 0
$arms < 2 and $x2 < 0
$arms < 3 and $y2 < 0
MC/DC0%0/4
$arms < 2 and $x2 < 0 or $arms < 3 and $y2 < 0
$arms < 2
$x2 < 0
$arms < 3
$y2 < 0
Truth table14%1/7
A and B or C and D
A= $arms < 2B= $x2 < 0C= $arms < 3D= $y2 < 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | ### rectangle all negative, no N values ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | return (1, 0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 8 | my ($pow) = round_down_pow (max(abs($x1),abs($y1),$x2,$y2) + 1, 5); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | ### $pow | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 8 | return (0, 25*$pow*$pow*$arms - 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | sub level_to_n_range { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 2 | ▶ | my ($self, $level) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
level_to_n_range: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 2 | return (0, 25**$level * $self->{'arms'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | sub n_to_level { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 8 | ▶ | my ($self, $n) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
n_to_level: called CC=3 SCAR=11.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | ### n_to_level(): $n | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 8 | ▶ | if ($n < 0) { return undef; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 8 | ▶ | if (is_infinite($n)) { return $n; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 8 | $n = round_nearest($n); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 8 | $n += $self->{'arms'}-1; # division rounding up | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 8 | _divrem_mutate ($n, $self->{'arms'}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 8 | my ($pow, $exp) = round_up_pow ($n, 25); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 8 | return $exp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | # Not taking into account multiple arms ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | # Return true if X axis segment $x to $x+1 is traversed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | sub _UNDOCUMENTED__xseg_is_traversed { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 3126 | ▶ | my ($self, $x) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_UNDOCUMENTED__xseg_is_traversed: called CC=8 SCAR=21.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 3126 | ▶ | if ($x < 0 || is_infinite($x)) { return 0; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$x < 0 or is_infinite($x)
MC/DC0%0/2
$x < 0 or is_infinite($x)
$x < 0
is_infinite($x)
Truth table33%1/3
A or B
A= $x < 0B= is_infinite($x)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 3126 | ▶ | if ($x == 0) { return 1; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 3125 | my $digit = _divrem_mutate($x, 5); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 3125 | ▶ | if ($digit) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 2500 | return ($digit == 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | # find lowest non-zero | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 625 | ▶ | while ($x && ! ($digit = _divrem_mutate($x, 5))) { } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$x and not $digit = _divrem_mutate($x, 5)
MC/DC50%1/2
$x and not $digit = _divrem_mutate($x, 5)
$x
not $digit = _divrem_mutate($x, 5)
Truth table66%2/3
A and not(B)
A= $xB= not $digit = _divrem_mutate($x, 5)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 625 | ▶ | return ($digit == 1 || $digit == 2); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$digit == 1 || $digit == 2
MC/DC100%2/2
$digit == 1 || $digit == 2
$digit == 1
$digit == 2
Truth table100%3/3
A || B
A= $digit == 1B= $digit == 2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | # Return true if Y axis segment $y to $y+1 is traversed | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | sub _UNDOCUMENTED__yseg_is_traversed { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 3126 | ▶ | my ($self, $y) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_UNDOCUMENTED__yseg_is_traversed: called CC=7 SCAR=19.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 3126 | ▶ | if ($y < 0 || is_infinite($y)) { return 0; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$y < 0 or is_infinite($y)
MC/DC0%0/2
$y < 0 or is_infinite($y)
$y < 0
is_infinite($y)
Truth table33%1/3
A or B
A= $y < 0B= is_infinite($y)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 3126 | my $digit = _divrem_mutate($y, 5); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 3126 | ▶ | if ($digit != 4) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 2501 | return ($digit == 3); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | # find lowest non-4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 625 | ▶ | while ($y && ($digit = _divrem_mutate($y, 5)) == 4) { } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$y and ($digit = _divrem_mutate($y, 5)) == 4
MC/DC100%2/2
$y and ($digit = _divrem_mutate($y, 5)) == 4
$y
($digit = _divrem_mutate($y, 5)) == 4
Truth table100%3/3
A and B
A= $yB= ($digit = _divrem_mutate($y, 5)) == 4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 625 | ▶ | return ($digit == 2 || $digit == 3); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$digit == 2 || $digit == 3
MC/DC100%2/2
$digit == 2 || $digit == 3
$digit == 2
$digit == 3
Truth table100%3/3
A || B
A= $digit == 2B= $digit == 3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | #------------------------------------------------------------------------------ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||