| 1 | package Set::IntSpan; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 20 | ▶ | use 5; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 20 | ▶ | use if $Set::IntSpan::integer, qw(integer); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 20 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 20 | ▶ | use base qw(Exporter); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 20 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 20 | our $VERSION = '1.19'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 20 | our @EXPORT_OK = qw(grep_set map_set grep_spans map_spans); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | use overload | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 20 | ▶ | '+' => 'union' , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | '-' => 'diff' , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | '*' => 'intersect' , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | '^' => 'xor' , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | '~' => 'complement', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | '+=' => 'U' , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | '-=' => 'D' , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | '*=' => 'I' , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | '^=' => 'X' , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 'eq' => 'set_eq' , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 'ne' => 'set_ne' , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 'lt' => 'set_lt' , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 'le' => 'set_le' , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 'gt' => 'set_gt' , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 'ge' => 'set_ge' , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | '<=>' => 'spaceship' , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 'cmp' => 'spaceship' , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | '""' => 'run_list' , | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 20 | ▶ | 'bool' => sub { not shift->empty }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | sub _reorder # restore the order of args that are reversed by operator overloads | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 278 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_reorder: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 278 | ▶ | if ($_[2]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 5 | my $temp = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 5 | $_[0] = $_[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 5 | $_[1] = $temp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | sub set_eq | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 52 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_eq: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 52 | my($a, $set_spec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 52 | my $b = $a->_real_set($set_spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 52 | $a->equal($b) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | sub set_le | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 7 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_le: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 7 | my($a, $set_spec, $reverse) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 7 | my $b = $a->_real_set($set_spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 7 | _reorder($a, $b, $reverse); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 7 | $a->subset($b) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | sub set_ge | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 7 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_ge: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 7 | my($a, $set_spec, $reverse) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 7 | my $b = $a->_real_set($set_spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 7 | _reorder($a, $b, $reverse); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 7 | $a->superset($b) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 4 | ▶ | sub set_ne { not &set_eq } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_ne: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 3 | ▶ | sub set_lt { &set_le and not &set_eq } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_lt: called CC=2 SCAR=6.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 3 | ▶ | sub set_gt { &set_ge and not &set_eq } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_gt: called CC=2 SCAR=6.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | sub set_cmp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_cmp: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | my($a, $b, $reverse) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | $b = $a->_real_set($b); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | _reorder($a, $b, $reverse); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | $a->equal($b) ? 0 : 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | sub spaceship | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 21 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
spaceship: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 21 | my($a, $b, $reverse) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 21 | ▶ | ref $a and $a = $a->size; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 21 | ▶ | ref $b and $b = $b->size; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 21 | _reorder($a, $b, $reverse); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 21 | ▶ | $a == $b and return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 14 | ▶ | $a < 0 and return 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 12 | ▶ | $b < 0 and return -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 11 | $a <=> $b | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 20 | $Set::IntSpan::Empty_String = '-'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | sub new | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 3427 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 3427 | my($this, $set_spec, @set_specs) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 3427 | ▶ | my $class = ref($this) || $this; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
ref $this || $this
MC/DC0%0/2
ref $this || $this
ref $this
$this
Truth table66%2/3
A || B
A= ref $thisB= $this
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 3427 | my $set = bless { }, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 3427 | $set->{empty_string} = \$Set::IntSpan::Empty_String; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 3427 | $set->copy($set_spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 3416 | ▶ | while (@set_specs) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 13 | $set = $set->union(shift @set_specs); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | $set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 3416 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | sub valid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 11 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
valid: called CC=3 SCAR=11.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 11 | my($this, $run_list) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 11 | ▶ | my $class = ref($this) || $this; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $this || $this
MC/DC0%0/2
ref $this || $this
ref $this
$this
Truth table33%1/3
A || B
A= ref $thisB= $this
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 11 | my $set = new $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 11 | eval { $set->_copy_run_list($run_list) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 11 | ▶ | $@ ? 0 : 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | sub copy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 3427 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
copy: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 3427 | my($set, $set_spec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | SWITCH: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 3427 | ▶ | defined $set_spec or $set->_copy_empty ( ), last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 2498 | ▶ | ref $set_spec or $set->_copy_run_list($set_spec), last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 98 | ▶ | ref $set_spec eq 'ARRAY' and $set->_copy_array ($set_spec), last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 50 | $set->_copy_set ($set_spec) ; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | $set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 3416 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | sub _copy_empty # makes $set the empty set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 3340 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_copy_empty: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 3340 | my $set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 3340 | $set->{negInf} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 3340 | $set->{posInf} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 3340 | $set->{edges } = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | sub _copy_array # copies an array into a set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 48 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_copy_array: called CC=13 SCAR=25.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 48 | my($set, $array) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 48 | my @spans = grep { ref } @$array; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 48 | my @elements = sort { $a <=> $b } grep { not ref } @$array; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 48 | my @span; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 48 | for my $e (@elements) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 74 | ▶ | if (@span==0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 23 | push @span, $e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | ▶ | elsif (@span==1 and $e==$span[0]+1) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
@span == 1 and $e == $span[0] + 1
MC/DC100%2/2
@span == 1 and $e == $span[0] + 1
@span == 1
$e == $span[0] + 1
Truth table100%3/3
A and B
A= @span == 1B= $e == $span[0] + 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 19 | push @span, $e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | ▶ | elsif (@span==1 and $e >$span[0]+1) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
@span == 1 and $e > $span[0] + 1
MC/DC100%2/2
@span == 1 and $e > $span[0] + 1
@span == 1
$e > $span[0] + 1
Truth table100%3/3
A and B
A= @span == 1B= $e > $span[0] + 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 6 | push @spans, [ $span[0], $span[0] ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 6 | @span = ($e); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | ▶ | elsif (@span==2 and $e==$span[1]+1) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
@span == 2 and $e == $span[1] + 1
MC/DC100%2/2
@span == 2 and $e == $span[1] + 1
@span == 2
$e == $span[1] + 1
Truth table100%3/3
A and B
A= @span == 2B= $e == $span[1] + 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 11 | $span[1] = $e; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | ▶ | elsif (@span==2 and $e >$span[1]+1) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
@span == 2 and $e > $span[1] + 1
MC/DC100%2/2
@span == 2 and $e > $span[1] + 1
@span == 2
$e > $span[1] + 1
Truth table100%3/3
A and B
A= @span == 2B= $e > $span[1] + 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 6 | push @spans, [ @span ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 6 | @span = ($e); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 48 | ▶ | @span==1 and push @spans, [ $span[0], $span[0] ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 48 | ▶ | @span==2 and push @spans, [ @span ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 48 | $set->_insert_spans(\@spans) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | sub bySpan | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 95 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bySpan: called CC=7 SCAR=19.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 95 | my($al, $au) = @$a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 95 | my($bl, $bu) = @$b; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 95 | ▶ | if (defined $al && defined $bl) { return $al <=> $bl; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
Condition100%3/3
defined $al and defined $bl
MC/DC100%2/2
defined $al and defined $bl
defined $al
defined $bl
Truth table100%3/3
A and B
A= defined $alB= defined $bl
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 5 | elsif (defined $al ) { return 1; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 12 | elsif ( defined $bl) { return -1; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | elsif (defined $au ) { return -1; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | elsif ( defined $bu) { return 1; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 1 | else { return 0; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | sub _insert_spans | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 108 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_insert_spans: called CC=17 SCAR=28.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 108 | my($set, $spans) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 108 | my @edges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 108 | $set->{negInf} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 108 | $set->{posInf} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 108 | $set->{edges } = \@edges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 108 | my @spans = sort bySpan @$spans; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 108 | ▶ | if (@spans and not defined $spans[0][0]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@spans and not defined $spans[0][0]
MC/DC100%2/2
@spans and not defined $spans[0][0]
@spans
not defined $spans[0][0]
Truth table100%3/3
A and not(B)
A= @spansB= not defined $spans[0][0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 24 | $set->{negInf} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 24 | my $span = shift @spans; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 24 | ▶ | if (not defined $span->[1]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 8 | $set->{posInf} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 8 | return $set; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 16 | push @edges, $span->[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 16 | ▶ | while (@spans and not defined $spans[0][0]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@spans and not defined $spans[0][0]
MC/DC0%0/2
@spans and not defined $spans[0][0]
@spans
not defined $spans[0][0]
Truth table66%2/3
A and not(B)
A= @spansB= not defined $spans[0][0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | my $span = shift @spans; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | $edges[0] = $span->[1] if $edges[0] < $span->[1]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 100 | for (@spans) { $_->[0]--; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 100 | ▶ | if (@spans and not @edges) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@spans and not @edges
MC/DC100%2/2
@spans and not @edges
@spans
not @edges
Truth table100%3/3
A and not(B)
A= @spansB= not @edges
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 65 | my $span = shift @spans; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 65 | ▶ | if (defined $span->[1]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 59 | push @edges, @$span; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 6 | push @edges, $span->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 6 | $set->{posInf} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 6 | return $set; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 94 | ▶ | while (@spans and defined $spans[0][1]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@spans and defined $spans[0][1]
MC/DC100%2/2
@spans and defined $spans[0][1]
@spans
defined $spans[0][1]
Truth table100%3/3
A and B
A= @spansB= defined $spans[0][1]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 55 | my $span = shift @spans; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 55 | ▶ | if ($edges[-1] < $span->[0]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 47 | push @edges, @$span; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 8 | ▶ | $edges[-1] = $span->[1] if $edges[-1] < $span->[1]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 94 | ▶ | if (@spans) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 10 | $set->{posInf} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 10 | my $span = shift @spans; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 10 | ▶ | if ($edges[-1] < $span->[0]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 6 | push @edges, $span->[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 4 | pop @edges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 94 | return $set | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | sub _copy_set # copies one set to another | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 50 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_copy_set: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 50 | my($dest, $src) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 50 | $dest->{negInf} = $src->{negInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 50 | $dest->{posInf} = $src->{posInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 50 | $dest->{edges } = [ @{$src->{edges }} ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | sub _copy_run_list # parses a run list | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 2411 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_copy_run_list: called CC=13 SCAR=25.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 2411 | my($set, $runList) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 2411 | $set->_copy_empty; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 2411 | $runList =~ s/\s|_//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 2411 | ▶ | return if $runList eq '-'; # empty set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 2160 | my($first, $last) = (1, 0); # verifies order of infinite runs | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 2160 | my @edges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 2160 | for my $run (split(/,/ , $runList)) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 3081 | ▶ | croak "Set::IntSpan::_copy_run_list: Bad order 1: $runList\n" if $last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | RUN: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 3077 | $run =~ /^ (-?\d+) $/x and do | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 3077 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 652 | push(@edges, $1-1, $1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 652 | last RUN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | $run =~ /^ (-?\d+) - (-?\d+) $/x and do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 2425 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | 1587 | ▶ | croak "Set::IntSpan::_copy_run_list: Bad order 2: $runList\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | if $1 > $2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 1585 | push(@edges, $1-1, $2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 1585 | last RUN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | $run =~ /^ \( - (-?\d+) $/x and do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 838 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 293 | ▶ | croak "Set::IntSpan::_copy_run_list: Bad order 3: $runList\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | unless $first; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 291 | $set->{negInf} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 291 | push @edges, $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 291 | last RUN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | $run =~ /^ (-?\d+) - \) $/x and do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 545 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 298 | push @edges, $1-1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 298 | $set->{posInf} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 298 | $last = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 298 | last RUN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | $run =~ /^ \( - \) $/x and do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 247 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 237 | ▶ | croak "Set::IntSpan::_copy_run_list: Bad order 4: $runList\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | unless $first; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 237 | $last = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 237 | $set->{negInf} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 237 | $set->{posInf} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 237 | last RUN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 10 | croak "Set::IntSpan::_copy_run_list: Bad syntax: $runList\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 3063 | $first = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 2142 | $set->{edges} = [ @edges ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 2142 | ▶ | $set->_cleanup or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | croak "Set::IntSpan::_copy_run_list: Bad order 5: $runList\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | # check for overlapping runs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | # delete duplicate edges | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | sub _cleanup | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 2142 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_cleanup: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 2142 | my $set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 2142 | my $edges = $set->{edges}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 2142 | my $i=0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 2142 | ▶ | while ($i < $#$edges) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 3116 | my $cmp = $$edges[$i] <=> $$edges[$i+1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 3116 | ▶ | $cmp == -1 and $i++ , last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 46 | ▶ | $cmp == 0 and splice(@$edges, $i, 2), last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 4 | ▶ | $cmp == 1 and return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 2138 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | sub run_list | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | 1058 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_list: called CC=9 SCAR=22.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 1058 | my $set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 1058 | ▶ | $set->empty and return ${$set->{empty_string}}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 818 | my @edges = @{$set->{edges}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 818 | my @runs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | 818 | ▶ | $set->{negInf} and unshift @edges, '('; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 818 | ▶ | $set->{posInf} and push @edges, ')'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 818 | ▶ | while(@edges) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 1239 | my($lower, $upper) = splice @edges, 0, 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 1239 | ▶ | if ($lower ne '(' and $upper ne ')' and $lower+1==$upper) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$lower ne "(" and $upper ne ")" and $lower + 1 == $upper
$lower ne "(" and $upper ne ")"
MC/DC100%3/3
$lower ne "(" and $upper ne ")" and $lower + 1 == $upper
$lower ne "("
$upper ne ")"
$lower + 1 == $upper
Truth table100%4/4
A and B and C
A= $lower ne "("B= $upper ne ")"C= $lower + 1 == $upper
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | 305 | push @runs, $upper; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 934 | ▶ | $lower ne '(' and $lower++; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 934 | push @runs, "$lower-$upper"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 818 | join(',', @runs) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | sub dump | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dump: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | my $set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | ▶ | ($set->{negInf} ? '(' : '') . join ',', @{$set->{edges}} . ($set->{posInf} ? ')' : '') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | sub elements | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 58 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
elements: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 58 | my $set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 58 | ▶ | ($set->{negInf} or $set->{posInf}) and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$set->{"negInf"} or $set->{"posInf"}
MC/DC100%2/2
$set->{"negInf"} or $set->{"posInf"}
$set->{"negInf"}
$set->{"posInf"}
Truth table100%3/3
A or B
A= $set->{"negInf"}B= $set->{"posInf"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | croak "Set::IntSpan::elements: infinite set\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | 42 | my @elements; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 42 | my @edges = @{$set->{edges}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 42 | ▶ | while (@edges) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 40 | my($lower, $upper) = splice(@edges, 0, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 40 | push @elements, $lower+1 .. $upper; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 42 | ▶ | wantarray ? @elements : \@elements | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | sub sets | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 23 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sets: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 23 | my $set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 23 | my @edges = @{$set->{edges}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 23 | ▶ | unshift @edges, undef if $set->{negInf}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 23 | ▶ | push @edges, undef if $set->{posInf}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 23 | my @sets; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 23 | ▶ | while (@edges) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 23 | my($lower, $upper) = splice(@edges, 0, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 23 | ▶ | $lower = defined $lower ? $lower+1 : '('; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 23 | ▶ | $upper = defined $upper ? $upper : ')'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 23 | push @sets, Set::IntSpan->new("$lower-$upper"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | @sets | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 23 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | sub spans | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 38 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
spans: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 38 | my $set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 38 | my @edges = @{$set->{edges}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 38 | ▶ | unshift @edges, undef if $set->{negInf}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 38 | ▶ | push @edges, undef if $set->{posInf}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 38 | my @spans; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 38 | ▶ | while (@edges) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 52 | my($lower, $upper) = splice(@edges, 0, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 52 | ▶ | $lower++ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | if defined $lower; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 52 | push @spans, [$lower, $upper]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | @spans | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 38 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | sub _real_set # converts a set specification into a set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 1046 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_real_set: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 1046 | my($set, $set_spec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 1046 | ▶ | (defined $set_spec and ref $set_spec and ref $set_spec ne 'ARRAY') ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
defined $set_spec and ref $set_spec and ref $set_spec ne "ARRAY"
defined $set_spec and ref $set_spec
MC/DC100%3/3
defined $set_spec and ref $set_spec and ref $set_spec ne "ARRAY"
defined $set_spec
ref $set_spec
ref $set_spec ne "ARRAY"
Truth table100%4/4
A and B and C
A= defined $set_specB= ref $set_specC= ref $set_spec ne "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | $set_spec : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | $set->new($set_spec) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | sub U | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 31 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
U: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 31 | my($a, $set_spec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 31 | my $s = $a->union($set_spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 31 | $a->{negInf} = $s->{negInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 31 | $a->{posInf} = $s->{posInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 31 | $a->{edges } = $s->{edges }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 31 | $a | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | sub union | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 85 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
union: called CC=14 SCAR=26.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 85 | my($a, $set_spec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 85 | my $b = $a->_real_set($set_spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | 85 | my $s = $a->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 85 | ▶ | $s->{negInf} = $a->{negInf} || $b->{negInf}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$a->{'negInf'} || $b->{'negInf'}
MC/DC100%2/2
$a->{'negInf'} || $b->{'negInf'}
$a->{'negInf'}
$b->{'negInf'}
Truth table100%3/3
A || B
A= $a->{'negInf'}B= $b->{'negInf'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 85 | my $eA = $a->{edges}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 85 | my $eB = $b->{edges}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 85 | my $eS = $s->{edges}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 85 | my $inA = $a->{negInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 85 | my $inB = $b->{negInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 85 | my $iA = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | 85 | my $iB = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 85 | ▶ | while ($iA<@$eA and $iB<@$eB) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$iA < @$eA and $iB < @$eB
MC/DC100%2/2
$iA < @$eA and $iB < @$eB
$iA < @$eA
$iB < @$eB
Truth table100%3/3
A and B
A= $iA < @$eAB= $iB < @$eB
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 155 | my $xA = $$eA[$iA]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 155 | my $xB = $$eB[$iB]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | 155 | ▶ | if ($xA < $xB) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | 62 | $iA++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | 62 | $inA = ! $inA; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | 62 | ▶ | not $inB and push(@$eS, $xA); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | elsif ($xB < $xA) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 58 | $iB++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 58 | $inB = ! $inB; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 58 | ▶ | not $inA and push(@$eS, $xB); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | 35 | $iA++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 35 | $iB++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 35 | $inA = ! $inA; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 35 | $inB = ! $inB; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 35 | ▶ | $inA == $inB and push(@$eS, $xA); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 85 | ▶ | $iA < @$eA and ! $inB and push(@$eS, @$eA[$iA..$#$eA]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$iA < @$eA and not $inB
MC/DC100%2/2
$iA < @$eA and not $inB
$iA < @$eA
not $inB
Truth table100%3/3
A and not(B)
A= $iA < @$eAB= not $inB
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 85 | ▶ | $iB < @$eB and ! $inA and push(@$eS, @$eB[$iB..$#$eB]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$iB < @$eB and not $inA
MC/DC100%2/2
$iB < @$eB and not $inA
$iB < @$eB
not $inA
Truth table100%3/3
A and not(B)
A= $iB < @$eBB= not $inA
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 85 | ▶ | $s->{posInf} = $a->{posInf} || $b->{posInf}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$a->{'posInf'} || $b->{'posInf'}
MC/DC100%2/2
$a->{'posInf'} || $b->{'posInf'}
$a->{'posInf'}
$b->{'posInf'}
Truth table100%3/3
A || B
A= $a->{'posInf'}B= $b->{'posInf'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 85 | $s | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | sub I | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 31 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
I: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | 31 | my($a, $set_spec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | 31 | my $s = $a->intersect($set_spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 31 | $a->{negInf} = $s->{negInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 31 | $a->{posInf} = $s->{posInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 31 | $a->{edges } = $s->{edges }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | 31 | $a | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | sub intersect | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 67 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
intersect: called CC=14 SCAR=26.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 67 | my($a, $set_spec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 67 | my $b = $a->_real_set($set_spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 67 | my $s = $a->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | 67 | ▶ | $s->{negInf} = $a->{negInf} && $b->{negInf}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$a->{'negInf'} && $b->{'negInf'}
MC/DC100%2/2
$a->{'negInf'} && $b->{'negInf'}
$a->{'negInf'}
$b->{'negInf'}
Truth table100%3/3
A && B
A= $a->{'negInf'}B= $b->{'negInf'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 67 | my $eA = $a->{edges}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 67 | my $eB = $b->{edges}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 67 | my $eS = $s->{edges}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 67 | my $inA = $a->{negInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 67 | my $inB = $b->{negInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | 67 | my $iA = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 67 | my $iB = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | 67 | ▶ | while ($iA<@$eA and $iB<@$eB) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$iA < @$eA and $iB < @$eB
MC/DC100%2/2
$iA < @$eA and $iB < @$eB
$iA < @$eA
$iB < @$eB
Truth table100%3/3
A and B
A= $iA < @$eAB= $iB < @$eB
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | 124 | my $xA = $$eA[$iA]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 124 | my $xB = $$eB[$iB]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | 124 | ▶ | if ($xA < $xB) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | 46 | $iA++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | 46 | $inA = ! $inA; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | 46 | ▶ | $inB and push(@$eS, $xA); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | elsif ($xB < $xA) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 43 | $iB++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 43 | $inB = ! $inB; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 43 | ▶ | $inA and push(@$eS, $xB); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 35 | $iA++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 35 | $iB++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | 35 | $inA = ! $inA; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | 35 | $inB = ! $inB; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 35 | ▶ | $inA == $inB and push(@$eS, $xA); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 67 | ▶ | $iA < @$eA and $inB and push(@$eS, @$eA[$iA..$#$eA]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$iA < @$eA and $inB
MC/DC100%2/2
$iA < @$eA and $inB
$iA < @$eA
$inB
Truth table100%3/3
A and B
A= $iA < @$eAB= $inB
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 67 | ▶ | $iB < @$eB and $inA and push(@$eS, @$eB[$iB..$#$eB]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$iB < @$eB and $inA
MC/DC100%2/2
$iB < @$eB and $inA
$iB < @$eB
$inA
Truth table100%3/3
A and B
A= $iB < @$eBB= $inA
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 67 | ▶ | $s->{posInf} = $a->{posInf} && $b->{posInf}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$a->{'posInf'} && $b->{'posInf'}
MC/DC100%2/2
$a->{'posInf'} && $b->{'posInf'}
$a->{'posInf'}
$b->{'posInf'}
Truth table100%3/3
A && B
A= $a->{'posInf'}B= $b->{'posInf'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 67 | $s | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | sub D | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | 31 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
D: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 31 | my($a, $set_spec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | 31 | my $s = $a->diff($set_spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 31 | $a->{negInf} = $s->{negInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | 31 | $a->{posInf} = $s->{posInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | 31 | $a->{edges } = $s->{edges }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 31 | $a | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | sub diff | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | 243 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
diff: called CC=14 SCAR=26.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 243 | my($a, $set_spec, $reverse) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 243 | my $b = $a->_real_set($set_spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | 243 | _reorder($a, $b, $reverse); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 243 | my $s = $a->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | 243 | ▶ | $s->{negInf} = $a->{negInf} && ! $b->{negInf}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$a->{'negInf'} && !$b->{'negInf'}
MC/DC100%2/2
$a->{'negInf'} && !$b->{'negInf'}
$a->{'negInf'}
!$b->{'negInf'}
Truth table100%3/3
A && not(B)
A= $a->{'negInf'}B= !$b->{'negInf'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 243 | my $eA = $a->{edges}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | 243 | my $eB = $b->{edges}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 243 | my $eS = $s->{edges}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | 243 | my $inA = $a->{negInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | 243 | my $inB = $b->{negInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 243 | my $iA = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 243 | my $iB = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 243 | ▶ | while ($iA<@$eA and $iB<@$eB) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$iA < @$eA and $iB < @$eB
MC/DC100%2/2
$iA < @$eA and $iB < @$eB
$iA < @$eA
$iB < @$eB
Truth table100%3/3
A and B
A= $iA < @$eAB= $iB < @$eB
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 325 | my $xA = $$eA[$iA]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | 325 | my $xB = $$eB[$iB]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | 325 | ▶ | if ($xA < $xB) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 107 | $iA++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | 107 | $inA = ! $inA; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 107 | ▶ | not $inB and push(@$eS, $xA); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | elsif ($xB < $xA) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | 107 | $iB++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | 107 | $inB = ! $inB; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 107 | ▶ | $inA and push(@$eS, $xB); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | 111 | $iA++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 111 | $iB++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 111 | $inA = ! $inA; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | 111 | $inB = ! $inB; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | 111 | ▶ | $inA != $inB and push(@$eS, $xA); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | 243 | ▶ | $iA < @$eA and not $inB and push(@$eS, @$eA[$iA..$#$eA]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$iA < @$eA and not $inB
MC/DC100%2/2
$iA < @$eA and not $inB
$iA < @$eA
not $inB
Truth table100%3/3
A and not(B)
A= $iA < @$eAB= not $inB
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | 243 | ▶ | $iB < @$eB and $inA and push(@$eS, @$eB[$iB..$#$eB]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$iB < @$eB and $inA
MC/DC100%2/2
$iB < @$eB and $inA
$iB < @$eB
$inA
Truth table100%3/3
A and B
A= $iB < @$eBB= $inA
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | 243 | ▶ | $s->{posInf} = $a->{posInf} && ! $b->{posInf}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$a->{'posInf'} && !$b->{'posInf'}
MC/DC100%2/2
$a->{'posInf'} && !$b->{'posInf'}
$a->{'posInf'}
!$b->{'posInf'}
Truth table100%3/3
A && not(B)
A= $a->{'posInf'}B= !$b->{'posInf'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 243 | $s | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | sub X | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 31 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
X: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | 31 | my($a, $set_spec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 31 | my $s = $a->xor($set_spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 31 | $a->{negInf} = $s->{negInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 31 | $a->{posInf} = $s->{posInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | 31 | $a->{edges } = $s->{edges }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | 31 | $a | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | sub xor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | 67 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
xor: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 67 | my($a, $set_spec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | 67 | my $b = $a->_real_set($set_spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | 67 | my $s = $a->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | 67 | $s->{negInf} = $a->{negInf} ^ $b->{negInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 67 | my $eA = $a->{edges}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | 67 | my $eB = $b->{edges}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | 67 | my $eS = $s->{edges}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | 67 | my $iA = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | 67 | my $iB = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 67 | ▶ | while ($iA<@$eA and $iB<@$eB) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$iA < @$eA and $iB < @$eB
MC/DC100%2/2
$iA < @$eA and $iB < @$eB
$iA < @$eA
$iB < @$eB
Truth table100%3/3
A and B
A= $iA < @$eAB= $iB < @$eB
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 122 | my $xA = $$eA[$iA]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | 122 | my $xB = $$eB[$iB]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | 122 | ▶ | if ($xA < $xB) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 45 | $iA++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 45 | push(@$eS, $xA); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | elsif ($xB < $xA) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 43 | $iB++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | 43 | push(@$eS, $xB); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | 34 | $iA++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | 34 | $iB++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 67 | ▶ | $iA < @$eA and push(@$eS, @$eA[$iA..$#$eA]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | 67 | ▶ | $iB < @$eB and push(@$eS, @$eB[$iB..$#$eB]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | 67 | $s->{posInf} = $a->{posInf} ^ $b->{posInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | 67 | $s | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | sub complement | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 13 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
complement: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | 13 | my $set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | 13 | $set->new($set)->C | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | sub C | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 23 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
C: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 23 | my $set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 23 | $set->{negInf} = ! $set->{negInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | 23 | $set->{posInf} = ! $set->{posInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | 23 | $set | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | sub superset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 88 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
superset: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | 88 | my($a, $set_spec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | 88 | my $b = $a->_real_set($set_spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | 88 | $b->diff($a)->empty | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | sub subset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | 88 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
subset: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 88 | my($a, $b) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 88 | $a->diff($b)->empty | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | sub equal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 349 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
equal: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | 349 | my($a, $set_spec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 349 | my $b = $a->_real_set($set_spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | 349 | ▶ | $a->{negInf} == $b->{negInf} or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | 319 | ▶ | $a->{posInf} == $b->{posInf} or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 305 | my $aEdge = $a->{edges}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 305 | my $bEdge = $b->{edges}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | 305 | ▶ | @$aEdge == @$bEdge or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | 287 | ▶ | for (my $i=0; $i<@$aEdge; $i++) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 564 | ▶ | $$aEdge[$i] == $$bEdge[$i] or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 271 | 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | sub equivalent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 81 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
equivalent: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 81 | my($a, $set_spec) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 81 | my $b = $a->_real_set($set_spec); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 81 | $a->cardinality == $b->cardinality | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | sub cardinality | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | 198 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cardinality: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | 198 | my $set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | 198 | ▶ | ($set->{negInf} or $set->{posInf}) and return -1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$set->{"negInf"} or $set->{"posInf"}
MC/DC100%2/2
$set->{"negInf"} or $set->{"posInf"}
$set->{"negInf"}
$set->{"posInf"}
Truth table100%3/3
A or B
A= $set->{"negInf"}B= $set->{"posInf"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 138 | my $cardinality = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | 138 | my @edges = @{$set->{edges}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | 138 | ▶ | while (@edges) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | 157 | my $lower = shift @edges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | 157 | my $upper = shift @edges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | 157 | $cardinality += $upper - $lower; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | $cardinality | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | 138 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | 20 | *size = \&cardinality; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | sub empty | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | 1302 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
empty: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | 1302 | my $set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 1083 | not $set->{negInf} and not @{$set->{edges}} and not $set->{posInf} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | 1302 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition83%5/6
$set->{'negInf'} || @{$set->{'edges'};} || $set->{'posInf'}
$set->{"negInf"} or @{$set->{"edges"};}
MC/DC66%2/3
$set->{'negInf'} || @{$set->{'edges'};} || $set->{'posInf'}
$set->{"negInf"}
@{$set->{"edges"};}
$set->{'posInf'}
Truth table75%3/4
A or B || C
A= $set->{"negInf"}B= @{$set->{"edges"};}C= $set->{'posInf'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | sub finite | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | 27 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
finite: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | 27 | my $set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | not $set->{negInf} and not $set->{posInf} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | 27 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$set->{'negInf'} || $set->{'posInf'}
MC/DC100%2/2
$set->{'negInf'} || $set->{'posInf'}
$set->{'negInf'}
$set->{'posInf'}
Truth table100%3/3
A || B
A= $set->{'negInf'}B= $set->{'posInf'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 162 | ▶ | sub neg_inf { shift->{negInf} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
neg_inf: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | 242 | ▶ | sub pos_inf { shift->{posInf} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pos_inf: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | sub infinite | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | 9 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
infinite: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | 9 | my $set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | $set->{negInf} or $set->{posInf} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | 9 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | sub universal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 9 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
universal: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 9 | my $set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | 2 | $set->{negInf} and not @{$set->{edges}} and $set->{posInf} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | 9 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$set->{"negInf"} and not @{$set->{"edges"};}
MC/DC100%2/2
$set->{"negInf"} and not @{$set->{"edges"};}
$set->{"negInf"}
not @{$set->{"edges"};}
Truth table100%3/3
A and not(B)
A= $set->{"negInf"}B= not @{$set->{"edges"};}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | sub member | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | 97 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
member: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | 97 | my($set, $n) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | 97 | my $i = _bsearch($set->{edges}, $n); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | 97 | ▶ | $set->{negInf} xor $i & 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%4/4
$set->{"negInf"} ^^ $i & 1
MC/DC100%2/2
$set->{"negInf"} ^^ $i & 1
$set->{"negInf"}
$i & 1
Truth table100%4/4
A ^^ B
A= $set->{"negInf"}B= $i & 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | 20 | ▶ | use constant INSERT => 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 20 | ▶ | use constant REMOVE => 1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | 461 | ▶ | sub insert { _indel(@_, INSERT); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
insert: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | 49 | ▶ | sub remove { _indel(@_, REMOVE); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remove: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | sub _indel # INsertion/DELetion | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | 510 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_indel: called CC=13 SCAR=25.7
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 510 | my($set, $n, $indel) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 510 | ▶ | defined $n or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 510 | my $edge = $set->{edges}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 510 | my $i = _bsearch($edge, $n); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | 510 | ▶ | return if $set->{negInf} xor $i & 1 xor $indel; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%8/8
$set->{"negInf"} xor $i & 1 xor $indel
$set->{"negInf"} ^^ $i & 1
MC/DC100%3/3
$set->{"negInf"} xor $i & 1 xor $indel
$set->{"negInf"}
$i & 1
$indel
Truth table100%8/8
A ^^ B xor C
A= $set->{"negInf"}B= $i & 1C= $indel
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 423 | ▶ | my $lGap = $i==0 || $edge->[$i-1] < $n-1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$i == 0 || $$edge[$i - 1] < $n - 1
MC/DC100%2/2
$i == 0 || $$edge[$i - 1] < $n - 1
$i == 0
$$edge[$i - 1] < $n - 1
Truth table100%3/3
A || B
A= $i == 0B= $$edge[$i - 1] < $n - 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 423 | ▶ | my $rGap = $i==@$edge || $n < $edge->[$i]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$i == @$edge || $n < $edge->[$i]
MC/DC100%2/2
$i == @$edge || $n < $edge->[$i]
$i == @$edge
$n < $edge->[$i]
Truth table100%3/3
A || B
A= $i == @$edgeB= $n < $edge->[$i]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 423 | ▶ | if ( $lGap and $rGap) { splice @$edge, $i, 0, $n-1, $n } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition100%3/3
$lGap and $rGap
MC/DC100%2/2
$lGap and $rGap
$lGap
$rGap
Truth table100%3/3
A and B
A= $lGapB= $rGap
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 284 | ▶ | elsif (not $lGap and $rGap) { $edge->[$i-1]++ } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
not $lGap and $rGap
MC/DC100%2/2
not $lGap and $rGap
not $lGap
$rGap
Truth table100%3/3
not(A) and B
A= not $lGapB= $rGap
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 55 | ▶ | elsif ( $lGap and not $rGap) { $edge->[$i ]-- } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$lGap and not $rGap
MC/DC50%1/2
$lGap and not $rGap
$lGap
not $rGap
Truth table66%2/3
A and not(B)
A= $lGapB= not $rGap
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 3 | else { splice @$edge, $i-1, 2 } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | # Returns the index of the first edge that satisifies target <= edge. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | # Returns $#$edges+1 if target > the last edge. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | # Returns 0 if edges is empty. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | sub _bsearch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 756 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_bsearch: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 756 | my($edges, $target) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 756 | ▶ | @$edges or return 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | 681 | my $lower = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | 681 | my $upper = $#$edges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | 681 | ▶ | while ($lower+1 < $upper) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | 727 | my $mid = int(($lower + $upper) / 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 727 | ▶ | if ($target <= $edges->[$mid]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 264 | $upper = $mid; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 463 | $lower = $mid+1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | 681 | ▶ | $target <= $edges->[$lower] and return $lower; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | 493 | ▶ | $target <= $edges->[$upper] and return $upper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | 358 | $upper + 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | sub span_ord | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 24 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
span_ord: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | 24 | my($set, $n) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | 24 | my $i = _bsearch($set->{edges}, $n); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 24 | ▶ | ($set->{negInf} xor $i & 1) ? $i >> 1 : undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%4/4
$set->{"negInf"} xor $i & 1
MC/DC100%2/2
$set->{"negInf"} xor $i & 1
$set->{"negInf"}
$i & 1
Truth table100%4/4
A xor B
A= $set->{"negInf"}B= $i & 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | sub min | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | 26 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
min: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 26 | my $set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | 26 | ▶ | $set->empty and return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 23 | ▶ | $set->neg_inf and return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | 19 | $set->{edges}->[0]+1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | sub max | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | 26 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
max: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | 26 | my $set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 26 | ▶ | $set->empty and return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | 23 | ▶ | $set->pos_inf and return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | 19 | $set->{edges}->[-1] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | sub cover | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | 13 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cover: called CC=8 SCAR=20.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | 13 | my $set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | 13 | my $cover = $set->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 966 | 13 | my $edges = $set->{edges}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 967 | 13 | my $negInf = $set->{negInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 968 | 13 | my $posInf = $set->{posInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 969 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 970 | 13 | ▶ | if ($negInf and $posInf) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition100%3/3
$negInf and $posInf
MC/DC100%2/2
$negInf and $posInf
$negInf
$posInf
Truth table100%3/3
A and B
A= $negInfB= $posInf
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 971 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 972 | 2 | $cover->{negInf} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 973 | 2 | $cover->{posInf} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 974 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 975 | ▶ | elsif ($negInf and not $posInf) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$negInf and not $posInf
MC/DC50%1/2
$negInf and not $posInf
$negInf
not $posInf
Truth table66%2/3
A and not(B)
A= $negInfB= not $posInf
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 976 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 977 | 2 | $cover->{negInf} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 978 | 2 | $cover->{edges}[0] = $set->{edges}[-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 979 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 980 | ▶ | elsif (not $negInf and $posInf) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
not $negInf and $posInf
MC/DC50%1/2
not $negInf and $posInf
not $negInf
$posInf
Truth table66%2/3
not(A) and B
A= not $negInfB= $posInf
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 981 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 982 | 2 | $cover->{edges}[0] = $set->{edges}[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 983 | 2 | $cover->{posInf} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 984 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 985 | elsif (@$edges) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 986 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 987 | 5 | $cover->{edges}[0] = $set->{edges}[ 0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 988 | 5 | $cover->{edges}[1] = $set->{edges}[-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 989 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 990 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 991 | $cover | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 992 | 13 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 993 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 994 | 20 | *extent = \&cover; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 995 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 996 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 997 | sub holes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 998 | 13 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
holes: called CC=8 SCAR=20.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 999 | 13 | my $set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1000 | 13 | my $holes = $set->new($set); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1001 | 13 | my $edges = $holes->{edges}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1002 | 13 | my $negInf = $holes->{negInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1003 | 13 | my $posInf = $holes->{posInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1004 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1005 | 13 | ▶ | if ($negInf and $posInf) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition100%3/3
$negInf and $posInf
MC/DC100%2/2
$negInf and $posInf
$negInf
$posInf
Truth table100%3/3
A and B
A= $negInfB= $posInf
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1006 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1007 | 2 | $holes->{negInf} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1008 | 2 | $holes->{posInf} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1009 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1010 | ▶ | elsif ($negInf and not $posInf) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$negInf and not $posInf
MC/DC50%1/2
$negInf and not $posInf
$negInf
not $posInf
Truth table66%2/3
A and not(B)
A= $negInfB= not $posInf
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1011 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1012 | 2 | $holes->{negInf} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1013 | 2 | pop @$edges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1014 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1015 | ▶ | elsif (not $negInf and $posInf) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
not $negInf and $posInf
MC/DC50%1/2
not $negInf and $posInf
not $negInf
$posInf
Truth table66%2/3
not(A) and B
A= not $negInfB= $posInf
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1016 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1017 | 2 | shift @$edges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1018 | 2 | $holes->{posInf} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1019 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1020 | elsif (@$edges) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1021 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1022 | 5 | shift @$edges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1023 | 5 | pop @$edges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1024 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1025 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1026 | $holes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1027 | 13 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1028 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1029 | sub inset | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 37 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inset: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1031 | 37 | my($set, $n) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1032 | 37 | my $edges = $set->{edges}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1033 | 37 | my @edges = @$edges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1034 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1035 | 37 | my $inset = $set->new(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 37 | $inset->{negInf} = $set->{negInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1037 | 37 | $inset->{posInf} = $set->{posInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1038 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1039 | 37 | my @inset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1040 | 37 | my $nAbs = abs $n; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1041 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1042 | 37 | ▶ | if (@edges and ($inset->{negInf} xor $n < 0)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%7/7
@edges and $inset->{"negInf"} ^^ $n < 0
$inset->{"negInf"} xor $n < 0
MC/DC100%3/3
@edges and $inset->{"negInf"} ^^ $n < 0
@edges
$inset->{"negInf"}
$n < 0
Truth table100%5/5
A and B xor C
A= @edgesB= $inset->{"negInf"}C= $n < 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1043 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1044 | 13 | my $edge = shift @edges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1045 | 13 | push @inset, $edge - $nAbs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1046 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1047 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1048 | 37 | ▶ | while (@edges > 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1049 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1050 | 79 | my($lower, $upper) = splice(@edges, 0, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1051 | 79 | $lower += $nAbs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1052 | 79 | $upper -= $nAbs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1053 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1054 | 79 | ▶ | push @inset, $lower, $upper | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1055 | if $lower < $upper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1056 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1057 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1058 | 37 | ▶ | if (@edges) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1059 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1060 | 13 | my $edge = shift @edges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1061 | 13 | push @inset, $edge + $nAbs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1062 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1063 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1064 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1065 | 37 | $inset->{edges} = \@inset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1066 | 37 | $inset | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1067 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1068 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1069 | 20 | *trim = \&inset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1070 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1071 | sub pad | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1072 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pad: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1073 | 1 | my($set, $n) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1074 | 1 | $set->inset(-$n) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1075 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1076 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1077 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1078 | sub grep_set(&$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1079 | 45 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
grep_set: called CC=8 SCAR=20.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1080 | 45 | my($block, $set) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1081 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1082 | 45 | ▶ | return undef if $set->{negInf} or $set->{posInf}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$set->{"negInf"} or $set->{"posInf"}
MC/DC100%2/2
$set->{"negInf"} or $set->{"posInf"}
$set->{"negInf"}
$set->{"posInf"}
Truth table100%3/3
A or B
A= $set->{"negInf"}B= $set->{"posInf"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1083 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1084 | 30 | my @edges = @{$set->{edges}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1085 | 30 | my @sub_edges = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1086 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1087 | 30 | ▶ | while (@edges) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1088 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1089 | 35 | my($lower, $upper) = splice(@edges, 0, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1090 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1091 | 35 | ▶ | for (my $i=$lower+1; $i<=$upper; $i++) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1092 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1093 | 150 | local $_ = $i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1094 | 150 | ▶ | &$block() or next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1095 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1096 | 60 | ▶ | if (@sub_edges and $sub_edges[-1] == $i-1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@sub_edges and $sub_edges[-1] == $i - 1
MC/DC100%2/2
@sub_edges and $sub_edges[-1] == $i - 1
@sub_edges
$sub_edges[-1] == $i - 1
Truth table100%3/3
A and B
A= @sub_edgesB= $sub_edges[-1] == $i - 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1097 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1098 | 29 | $sub_edges[-1] = $i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1099 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1100 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1101 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1102 | 31 | push @sub_edges, $i-1, $i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1103 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1107 | 30 | my $sub_set = $set->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1108 | 30 | $sub_set->{edges} = \@sub_edges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1109 | 30 | $sub_set | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1113 | sub map_set(&$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1114 | 63 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
map_set: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1115 | 63 | my($block, $set) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1117 | 63 | ▶ | return undef if $set->{negInf} or $set->{posInf}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$set->{"negInf"} or $set->{"posInf"}
MC/DC100%2/2
$set->{"negInf"} or $set->{"posInf"}
$set->{"negInf"}
$set->{"posInf"}
Truth table100%3/3
A or B
A= $set->{"negInf"}B= $set->{"posInf"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1119 | 42 | my $map_set = $set->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1120 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1121 | 42 | my @edges = @{$set->{edges}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1122 | 42 | ▶ | while (@edges) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1123 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1124 | 49 | my($lower, $upper) = splice(@edges, 0, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1126 | 49 | my $domain; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1127 | 49 | ▶ | for ($domain=$lower+1; $domain<=$upper; $domain++) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1128 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1129 | 210 | local $_ = $domain; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1130 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1131 | 210 | my $range; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1132 | 210 | for $range (&$block()) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1133 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1134 | 210 | $map_set->insert($range); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1135 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1136 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1139 | $map_set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1140 | 42 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1143 | sub grep_spans(&$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1144 | 40 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
grep_spans: called CC=10 SCAR=23.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1145 | 40 | my($block, $set) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1146 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1147 | 40 | my @edges = @{$set->{edges}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1148 | 40 | my $sub_set = $set->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1149 | 40 | my @sub_edges = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1151 | 40 | ▶ | if ($set->{negInf} and $set->{posInf}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$set->{"negInf"} and $set->{"posInf"}
MC/DC100%2/2
$set->{"negInf"} and $set->{"posInf"}
$set->{"negInf"}
$set->{"posInf"}
Truth table100%3/3
A and B
A= $set->{"negInf"}B= $set->{"posInf"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1152 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1153 | 4 | local $_ = [ undef, undef ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1154 | 4 | ▶ | if (&$block()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1155 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1156 | 2 | $sub_set->{negInf} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1157 | 2 | $sub_set->{posInf} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1158 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1160 | elsif ($set->{negInf}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1161 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1162 | 4 | my $upper = shift @edges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1163 | 4 | local $_ = [ undef, $upper ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1164 | 4 | ▶ | if (&$block()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1165 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1166 | 2 | $sub_set->{negInf} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1167 | 2 | push @sub_edges, $upper; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1168 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1170 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1171 | 40 | ▶ | while (@edges > 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1172 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1173 | 40 | my($lower, $upper) = splice(@edges, 0, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1174 | 40 | local $_ = [ $lower+1, $upper ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1175 | 40 | ▶ | &$block() and push @sub_edges, $lower, $upper; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1178 | 40 | ▶ | if (@edges) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1179 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1180 | 8 | my $lower = shift @edges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1181 | 8 | local $_ = [ $lower+1, undef ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1182 | 8 | ▶ | if (&$block()) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1183 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1184 | 4 | $sub_set->{posInf} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1185 | 4 | push @sub_edges, $lower; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1186 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1187 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1188 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1189 | 40 | $sub_set->{edges} = \@sub_edges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1190 | 40 | $sub_set | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1193 | sub map_spans(&$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1194 | 60 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
map_spans: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1195 | 60 | my($block, $set) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1196 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1197 | 60 | my @edges = @{$set->{edges}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1198 | 60 | my @spans; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1200 | 60 | ▶ | if ($set->{negInf} and $set->{posInf}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%3/3
$set->{"negInf"} and $set->{"posInf"}
MC/DC100%2/2
$set->{"negInf"} and $set->{"posInf"}
$set->{"negInf"}
$set->{"posInf"}
Truth table100%3/3
A and B
A= $set->{"negInf"}B= $set->{"posInf"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1201 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1202 | 6 | local $_ = [ undef, undef ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1203 | 6 | push @spans, &$block(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1205 | elsif ($set->{negInf}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1206 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1207 | 6 | my $upper = shift @edges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1208 | 6 | local $_ = [ undef, $upper ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1209 | 6 | push @spans, &$block(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1210 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1211 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1212 | 60 | ▶ | while (@edges > 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1213 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1214 | 60 | my($lower, $upper) = splice(@edges, 0, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1215 | 60 | local $_ = [ $lower+1, $upper ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1216 | 60 | push @spans, &$block(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1217 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1218 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1219 | 60 | ▶ | if (@edges) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1220 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1221 | 12 | my $lower = shift @edges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1222 | 12 | local $_ = [ $lower+1, undef ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1223 | 12 | push @spans, &$block(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1226 | 60 | $set->new->_insert_spans(\@spans) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1227 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1228 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1230 | sub first($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1231 | 17 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
first: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1232 | 17 | my $set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1233 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1234 | 17 | $set->{iterator} = $set->min; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1235 | 17 | $set->{run}[0] = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1236 | 17 | ▶ | $set->{run}[1] = $#{$set->{edges}} ? 1 : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1238 | $set->{iterator} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1239 | 17 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1241 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1242 | sub last($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1243 | 17 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
last: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1244 | 17 | my $set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1246 | 17 | my $lastEdge = $#{$set->{edges}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1247 | 17 | $set->{iterator} = $set->max; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1248 | 17 | ▶ | $set->{run}[0] = $lastEdge ? $lastEdge-1 : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1249 | 17 | $set->{run}[1] = $lastEdge; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1250 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1251 | $set->{iterator} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1252 | 17 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1254 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1255 | sub start($$) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1256 | 58 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start: called CC=9 SCAR=22.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1257 | 58 | my($set, $start) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1259 | 58 | $set->{iterator} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1260 | 58 | ▶ | defined $start or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1262 | 58 | my $inSet = $set->{negInf}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1263 | 58 | my $edges = $set->{edges}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1265 | 58 | ▶ | for (my $i=0; $i<@$edges; $i++) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1266 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1267 | 171 | ▶ | if ($inSet) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1268 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1269 | 82 | ▶ | if ($start <= $$edges[$i]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1270 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1271 | 29 | $set->{iterator} = $start; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1272 | 29 | ▶ | $set->{run}[0] = $i ? $i-1 : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1273 | 29 | $set->{run}[1] = $i; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1274 | 29 | return $start; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1275 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1276 | 53 | $inSet = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1277 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1278 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1279 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1280 | 89 | ▶ | if ($start <= $$edges[$i]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1281 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1282 | 18 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1283 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1284 | 71 | $inSet = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1285 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1287 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1288 | 11 | ▶ | if ($inSet) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1289 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1290 | 8 | $set->{iterator} = $start; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1291 | 8 | ▶ | $set->{run}[0] = @$edges? $#$edges: undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1292 | 8 | $set->{run}[1] = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1293 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1295 | $set->{iterator} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1296 | 11 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1298 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1299 | 11 | ▶ | sub current($) { shift->{iterator} } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
current: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1300 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1302 | sub next($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1303 | 44 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1304 | 44 | my $set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1306 | 44 | ▶ | defined $set->{iterator} or return $set->first; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1307 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1308 | 42 | my $run1 = $set->{run}[1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1309 | 42 | ▶ | defined $run1 or return ++$set->{iterator}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1311 | 41 | my $edges = $set->{edges}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1312 | 41 | ▶ | $set->{iterator} < $edges->[$run1] and return ++$set->{iterator}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1313 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1314 | 13 | ▶ | if ($run1 < $#$edges-1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1315 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1316 | 4 | my $run0 = $run1 + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1317 | 4 | $set->{run} = [$run0, $run0+1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1318 | 4 | $set->{iterator} = $edges->[$run0]+1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1319 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1320 | elsif ($run1 < $#$edges) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1321 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1322 | 2 | my $run0 = $run1 + 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1323 | 2 | $set->{run} = [$run0, undef]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1324 | 2 | $set->{iterator} = $edges->[$run0]+1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1325 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1326 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1327 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1328 | 7 | $set->{iterator} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1329 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1330 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1331 | $set->{iterator} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1332 | 13 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1334 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1335 | sub prev($) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1336 | 39 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prev: called CC=6 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1337 | 39 | my $set = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1338 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1339 | 39 | ▶ | defined $set->{iterator} or return $set->last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1341 | 37 | my $run0 = $set->{run}[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1342 | 37 | ▶ | defined $run0 or return --$set->{iterator}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1344 | 36 | my $edges = $set->{edges}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1345 | 36 | ▶ | $set->{iterator} > $edges->[$run0]+1 and return --$set->{iterator}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1346 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1347 | 11 | ▶ | if ($run0 > 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1348 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1349 | 3 | my $run1 = $run0 - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1350 | 3 | $set->{run} = [$run1-1, $run1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1351 | 3 | $set->{iterator} = $edges->[$run1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1352 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1353 | elsif ($run0 > 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1354 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1355 | 1 | my $run1 = $run0 - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1356 | 1 | $set->{run} = [undef, $run1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1357 | 1 | $set->{iterator} = $edges->[$run1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1358 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1359 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1360 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1361 | 7 | $set->{iterator} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1362 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1364 | $set->{iterator} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1365 | 11 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1366 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1367 | sub at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1368 | 29 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
at: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1369 | 29 | my($set, $i) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1370 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1371 | 29 | ▶ | $i < 0 ? $set->_at_neg($i) : $set->_at_pos($i) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1372 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1373 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1374 | sub _at_pos | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1375 | 14 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_at_pos: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1376 | 14 | my($set, $i) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1378 | 14 | ▶ | $set->neg_inf and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1379 | croak "Set::IntSpan::at: negative infinite set\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1380 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1381 | 13 | my @edges = @{$set->{edges}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1382 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1383 | 13 | ▶ | while (@edges > 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1384 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1385 | 16 | my($lower, $upper) = splice(@edges, 0, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1386 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1387 | 16 | my $size = $upper - $lower; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1388 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1389 | 16 | ▶ | $i < $size and return $lower + 1 + $i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1390 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1391 | 10 | $i -= $size; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1392 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1393 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1394 | 7 | ▶ | @edges ? $edges[0] + 1 + $i : undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1395 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1397 | sub _at_neg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1398 | 15 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_at_neg: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1399 | 15 | my($set, $i) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1400 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1401 | 15 | ▶ | $set->pos_inf and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1402 | croak "Set::IntSpan::at: positive infinite set\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1404 | 14 | my @edges = @{$set->{edges}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1405 | 14 | $i++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1407 | 14 | ▶ | while (@edges > 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1408 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1409 | 19 | my($lower, $upper) = splice(@edges, -2, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1410 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1411 | 19 | my $size = $upper - $lower; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1412 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1413 | 19 | ▶ | -$i < $size and return $upper + $i; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1414 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1415 | 12 | $i += $size; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1416 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1417 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1418 | 7 | ▶ | @edges ? $edges[0] + $i : undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1419 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1420 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1421 | sub ord | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1422 | 16 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ord: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1423 | 16 | my($set, $n) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1424 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1425 | $set->{negInf} and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1426 | 16 | ▶ | croak "Set::IntSpan::ord: negative infinite set\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1427 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1428 | 15 | ▶ | defined $n or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1429 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1430 | 15 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1431 | 15 | my @edges = @{$set->{edges}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1432 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1433 | 15 | ▶ | while (@edges) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1434 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1435 | 21 | my($lower, $upper) = splice(@edges, 0, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1437 | 21 | ▶ | $n <= $lower and return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1438 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1439 | 17 | ▶ | if (defined $upper and $upper < $n) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $upper and $upper < $n
MC/DC100%2/2
defined $upper and $upper < $n
defined $upper
$upper < $n
Truth table100%3/3
A and B
A= defined $upperB= $upper < $n
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1440 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1441 | 9 | $i += $upper - $lower; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1442 | 9 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1443 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1444 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1445 | 8 | return $i + $n - $lower - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1446 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1447 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1448 | undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1449 | 3 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1450 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1451 | sub slice | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1452 | 35 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
slice: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1453 | 35 | my($set, $from, $to) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1454 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1455 | 35 | $set->{slicing} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1456 | 35 | my $slice = $set->_splice($from, $to - $from + 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1457 | 33 | $set->{slicing} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1458 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1459 | 33 | $slice | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1460 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1462 | sub _splice | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1463 | 233 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_splice: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1464 | 233 | my($set, $offset, $length) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1465 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1466 | 233 | ▶ | $offset < 0 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1467 | ? $set->_splice_neg($offset, $length) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1468 | : $set->_splice_pos($offset, $length) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1469 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1470 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1471 | sub _splice_pos | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1472 | 116 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_splice_pos: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1473 | 116 | my($set, $offset, $length) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1474 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1475 | 116 | ▶ | $set->neg_inf and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1476 | croak "Set::IntSpan::slice: negative infinite set\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1478 | 114 | my @edges = @{$set->{edges}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1479 | 114 | my $slice = new Set::IntSpan; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1480 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1481 | 114 | ▶ | while (@edges > 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1482 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1483 | 151 | my ($lower, $upper) = @edges[0,1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1484 | 151 | my $size = $upper - $lower; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1485 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1486 | 151 | ▶ | $offset < $size and last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1487 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1488 | 62 | splice(@edges, 0, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1489 | 62 | $offset -= $size; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1492 | @edges or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1493 | 114 | ▶ | return $slice; # empty set | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1494 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1495 | 102 | $edges[0] += $offset; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1496 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1497 | 102 | $slice->{edges} = $set->_splice_length(\@edges, $length); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1498 | 101 | $slice | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1499 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1500 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1501 | sub _splice_neg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1502 | 117 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_splice_neg: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1503 | 117 | my($set, $offset, $length) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1504 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1505 | 117 | ▶ | $set->pos_inf and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1506 | croak "Set::IntSpan::slice: positive infinite set\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1507 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1508 | 114 | my @edges = @{$set->{edges}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1509 | 114 | my $slice = new Set::IntSpan; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1510 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1511 | 114 | my @slice; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1512 | 114 | $offset++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1513 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1514 | 114 | ▶ | while (@edges > 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1515 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1516 | 193 | my ($lower, $upper) = @edges[-2,-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1517 | 193 | my $size = $upper - $lower; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1518 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1519 | 193 | ▶ | -$offset < $size and last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1520 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1521 | 101 | unshift @slice, splice(@edges, -2, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1522 | 101 | $offset += $size; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1523 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1524 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1525 | 114 | ▶ | if (@edges) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1526 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1527 | 100 | my $upper = pop @edges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1528 | 100 | unshift @slice, $upper+$offset-1, $upper; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1529 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1530 | elsif ($set->{slicing}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1531 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1532 | 2 | $length += $offset-1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1533 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1534 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1535 | 114 | $slice->{edges} = $set->_splice_length(\@slice, $length); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1536 | 114 | $slice | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1537 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1538 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1539 | sub _splice_length | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1540 | 216 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_splice_length: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1541 | 216 | my($set, $edges, $length) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1542 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1543 | 216 | ▶ | not defined $length and return $edges; # everything | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1544 | 193 | ▶ | $length<0 and return $set->_splice_length_neg($edges, -$length); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1545 | 115 | ▶ | $length>0 and return $set->_splice_length_pos($edges, $length); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1546 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1547 | 12 | [] # $length==0 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1548 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1549 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1550 | sub _splice_length_pos | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1551 | 103 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_splice_length_pos: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1552 | 103 | my($set, $edges, $length) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1553 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1554 | 103 | my @slice; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1555 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1556 | 103 | ▶ | while (@$edges > 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1557 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1558 | 125 | my ($lower, $upper) = @$edges[0,1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1559 | 125 | my $size = $upper - $lower; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1560 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1561 | 125 | ▶ | $length <= $size and last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1562 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1563 | 54 | push @slice, splice(@$edges, 0, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1564 | 54 | $length -= $size; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1565 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1566 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1567 | 103 | ▶ | if (@$edges) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1568 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1569 | 84 | my $lower = shift @$edges; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1570 | 84 | push @slice, $lower, $lower+$length; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1571 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1572 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1573 | \@slice | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1574 | 103 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1575 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1576 | sub _splice_length_neg | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1577 | 78 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_splice_length_neg: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1578 | 78 | my($set, $edges, $length) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1579 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1580 | 78 | ▶ | $set->pos_inf and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1581 | croak "Set::IntSpan::slice: positive infinite set\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1582 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1583 | 77 | ▶ | while (@$edges > 1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1584 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1585 | 126 | my($lower, $upper) = @$edges[-2,-1]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1586 | 126 | my $size = $upper - $lower; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1587 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1588 | 126 | ▶ | $length < $size and last; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1589 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1590 | 73 | splice(@$edges, -2, 2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1591 | 73 | $length -= $size; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1592 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1593 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1594 | 77 | ▶ | if (@$edges) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1595 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1596 | 53 | $edges->[-1] -= $length; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1597 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1598 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1599 | $edges | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1600 | 77 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1601 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1602 | 20 | 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1603 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 1604 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||