| 1 | package List::Compare::Base::_Auxiliary; | ||||||||||||||||||||||||||||
| 2 | 52 | our $VERSION = 0.55; | |||||||||||||||||||||||||||
| 3 | 52 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 52 | our @ISA = qw(Exporter); | |||||||||||||||||||||||||||
| 5 | 52 | our @EXPORT_OK = qw| | |||||||||||||||||||||||||||
| 6 | _validate_2_seenhashes | ||||||||||||||||||||||||||||
| 7 | _validate_seen_hash | ||||||||||||||||||||||||||||
| 8 | _validate_multiple_seenhashes | ||||||||||||||||||||||||||||
| 9 | _calculate_array_seen_only | ||||||||||||||||||||||||||||
| 10 | _calculate_seen_only | ||||||||||||||||||||||||||||
| 11 | _calculate_intermediate | ||||||||||||||||||||||||||||
| 12 | _calculate_union_only | ||||||||||||||||||||||||||||
| 13 | _calculate_union_seen_only | ||||||||||||||||||||||||||||
| 14 | _calculate_sharedref | ||||||||||||||||||||||||||||
| 15 | _subset_subengine | ||||||||||||||||||||||||||||
| 16 | _chart_engine_regular | ||||||||||||||||||||||||||||
| 17 | _chart_engine_multiple | ||||||||||||||||||||||||||||
| 18 | _equivalent_subengine | ||||||||||||||||||||||||||||
| 19 | _index_message1 | ||||||||||||||||||||||||||||
| 20 | _index_message2 | ||||||||||||||||||||||||||||
| 21 | _index_message3 | ||||||||||||||||||||||||||||
| 22 | _index_message4 | ||||||||||||||||||||||||||||
| 23 | _prepare_listrefs | ||||||||||||||||||||||||||||
| 24 | _subset_engine_multaccel | ||||||||||||||||||||||||||||
| 25 | _calc_seen | ||||||||||||||||||||||||||||
| 26 | _calc_seen1 | ||||||||||||||||||||||||||||
| 27 | _equiv_engine | ||||||||||||||||||||||||||||
| 28 | _argument_checker_0 | ||||||||||||||||||||||||||||
| 29 | _argument_checker | ||||||||||||||||||||||||||||
| 30 | _argument_checker_1 | ||||||||||||||||||||||||||||
| 31 | _argument_checker_2 | ||||||||||||||||||||||||||||
| 32 | _argument_checker_3 | ||||||||||||||||||||||||||||
| 33 | _argument_checker_3a | ||||||||||||||||||||||||||||
| 34 | _argument_checker_4 | ||||||||||||||||||||||||||||
| 35 | _alt_construct_tester | ||||||||||||||||||||||||||||
| 36 | _alt_construct_tester_1 | ||||||||||||||||||||||||||||
| 37 | _alt_construct_tester_2 | ||||||||||||||||||||||||||||
| 38 | _alt_construct_tester_3 | ||||||||||||||||||||||||||||
| 39 | _alt_construct_tester_4 | ||||||||||||||||||||||||||||
| 40 | _alt_construct_tester_5 | ||||||||||||||||||||||||||||
| 41 | |; | ||||||||||||||||||||||||||||
| 42 | 52 | our %EXPORT_TAGS = ( | |||||||||||||||||||||||||||
| 43 | calculate => [ qw( | ||||||||||||||||||||||||||||
| 44 | _calculate_array_seen_only | ||||||||||||||||||||||||||||
| 45 | _calculate_seen_only | ||||||||||||||||||||||||||||
| 46 | _calculate_intermediate | ||||||||||||||||||||||||||||
| 47 | _calculate_union_only | ||||||||||||||||||||||||||||
| 48 | _calculate_union_seen_only | ||||||||||||||||||||||||||||
| 49 | _calculate_sharedref | ||||||||||||||||||||||||||||
| 50 | ) ], | ||||||||||||||||||||||||||||
| 51 | checker => [ qw( | ||||||||||||||||||||||||||||
| 52 | _argument_checker_0 | ||||||||||||||||||||||||||||
| 53 | _argument_checker | ||||||||||||||||||||||||||||
| 54 | _argument_checker_1 | ||||||||||||||||||||||||||||
| 55 | _argument_checker_2 | ||||||||||||||||||||||||||||
| 56 | _argument_checker_3 | ||||||||||||||||||||||||||||
| 57 | _argument_checker_3a | ||||||||||||||||||||||||||||
| 58 | _argument_checker_4 | ||||||||||||||||||||||||||||
| 59 | ) ], | ||||||||||||||||||||||||||||
| 60 | tester => [ qw( | ||||||||||||||||||||||||||||
| 61 | _alt_construct_tester | ||||||||||||||||||||||||||||
| 62 | _alt_construct_tester_1 | ||||||||||||||||||||||||||||
| 63 | _alt_construct_tester_2 | ||||||||||||||||||||||||||||
| 64 | _alt_construct_tester_3 | ||||||||||||||||||||||||||||
| 65 | _alt_construct_tester_4 | ||||||||||||||||||||||||||||
| 66 | _alt_construct_tester_5 | ||||||||||||||||||||||||||||
| 67 | ) ], | ||||||||||||||||||||||||||||
| 68 | ); | ||||||||||||||||||||||||||||
| 69 | 52 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 70 | 52 | local $^W =1; | |||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 52 | my $bad_lists_msg = q{If argument is single hash ref, you must have a 'lists' key whose value is an array ref}; | |||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 27 | ▶ | sub _validate_2_seenhashes { | ||||||||||||||||||||||||||
|
Subroutine
_validate_2_seenhashes: called CC=13 SCAR=25.6
| |||||||||||||||||||||||||||||
| 75 | 27 | my ($refL, $refR) = @_; | |||||||||||||||||||||||||||
| 76 | 27 | my (%seenL, %seenR, %badentriesL, %badentriesR); | |||||||||||||||||||||||||||
| 77 | 27 | foreach (keys %$refL) { | |||||||||||||||||||||||||||
| 78 | 144 | ▶ | if (${$refL}{$_} =~ /^\d+$/ and ${$refL}{$_} > 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
do {
$refL
}->{$_} =~ /^\d+$/ and do {
$refL
}->{$_} > 0
MC/DC100%2/2
do {
$refL
}->{$_} =~ /^\d+$/ and do {
$refL
}->{$_} > 0
do {
$refL
}->{$_} =~ /^\d+$/
do {
$refL
}->{$_} > 0
Truth table100%3/3
A and B
A= do {
$refL
}->{$_} =~ /^\d+$/B= do {
$refL
}->{$_} > 0
| |||||||||||||||||||||||||||||
| 79 | 142 | $seenL{$_} = ${$refL}{$_}; | |||||||||||||||||||||||||||
| 80 | } else { | ||||||||||||||||||||||||||||
| 81 | 2 | $badentriesL{$_} = ${$refL}{$_}; | |||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | 27 | foreach (keys %$refR) { | |||||||||||||||||||||||||||
| 85 | 133 | ▶ | if (${$refR}{$_} =~ /^\d+$/ and ${$refR}{$_} > 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
do {
$refR
}->{$_} =~ /^\d+$/ and do {
$refR
}->{$_} > 0
MC/DC100%2/2
do {
$refR
}->{$_} =~ /^\d+$/ and do {
$refR
}->{$_} > 0
do {
$refR
}->{$_} =~ /^\d+$/
do {
$refR
}->{$_} > 0
Truth table100%3/3
A and B
A= do {
$refR
}->{$_} =~ /^\d+$/B= do {
$refR
}->{$_} > 0
| |||||||||||||||||||||||||||||
| 86 | 131 | $seenR{$_} = ${$refR}{$_}; | |||||||||||||||||||||||||||
| 87 | } else { | ||||||||||||||||||||||||||||
| 88 | 2 | $badentriesR{$_} = ${$refR}{$_}; | |||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||
| 91 | 27 | my $msg = q{}; | |||||||||||||||||||||||||||
| 92 | 27 | ▶ | if ( (keys %badentriesL) or (keys %badentriesR) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
keys %badentriesL or keys %badentriesR
MC/DC100%2/2
keys %badentriesL or keys %badentriesR
keys %badentriesL
keys %badentriesR
Truth table100%3/3
A or B
A= keys %badentriesLB= keys %badentriesR
| |||||||||||||||||||||||||||||
| 93 | 4 | $msg .= "\nValues in a 'seen-hash' may only be positive integers.\n"; | |||||||||||||||||||||||||||
| 94 | 4 | $msg .= " These elements have invalid values:\n"; | |||||||||||||||||||||||||||
| 95 | 4 | ▶ | if (keys %badentriesL) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 96 | 2 | $msg .= " First hash in arguments:\n"; | |||||||||||||||||||||||||||
| 97 | $msg .= " Key: $_\tValue: $badentriesL{$_}\n" | ||||||||||||||||||||||||||||
| 98 | 2 | foreach (sort keys %badentriesL); | |||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||
| 100 | 4 | ▶ | if (keys %badentriesR) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 101 | 2 | $msg .= " Second hash in arguments:\n"; | |||||||||||||||||||||||||||
| 102 | $msg .= " Key: $_\tValue: $badentriesR{$_}\n" | ||||||||||||||||||||||||||||
| 103 | 2 | foreach (sort keys %badentriesR); | |||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||
| 105 | 4 | $msg .= "Correct invalid values before proceeding"; | |||||||||||||||||||||||||||
| 106 | 4 | croak "$msg: $!"; | |||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||
| 108 | 23 | return (\%seenL, \%seenR); | |||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | 441 | ▶ | sub _validate_seen_hash { | ||||||||||||||||||||||||||
|
Subroutine
_validate_seen_hash: called CC=14 SCAR=26.4
| |||||||||||||||||||||||||||||
| 112 | 441 | ▶ | if (@_ > 2) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 113 | 206 | _validate_multiple_seenhashes( [@_] ); | |||||||||||||||||||||||||||
| 114 | } else { | ||||||||||||||||||||||||||||
| 115 | 235 | my ($l, $r) = @_; | |||||||||||||||||||||||||||
| 116 | 235 | my (%badentriesL, %badentriesR); | |||||||||||||||||||||||||||
| 117 | 235 | foreach (keys %$l) { | |||||||||||||||||||||||||||
| 118 | 20 | $badentriesL{$_} = ${$l}{$_} | |||||||||||||||||||||||||||
| 119 | 1450 | ▶ | unless (${$l}{$_} =~ /^\d+$/ and ${$l}{$_} > 0); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
do {
$l
}->{$_} =~ /^\d+$/ and do {
$l
}->{$_} > 0
MC/DC100%2/2
do {
$l
}->{$_} =~ /^\d+$/ and do {
$l
}->{$_} > 0
do {
$l
}->{$_} =~ /^\d+$/
do {
$l
}->{$_} > 0
Truth table100%3/3
A and B
A= do {
$l
}->{$_} =~ /^\d+$/B= do {
$l
}->{$_} > 0
| |||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||
| 121 | 235 | foreach (keys %$r) { | |||||||||||||||||||||||||||
| 122 | 20 | $badentriesR{$_} = ${$r}{$_} | |||||||||||||||||||||||||||
| 123 | 1423 | ▶ | unless (${$r}{$_} =~ /^\d+$/ and ${$r}{$_} > 0); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
do {
$r
}->{$_} =~ /^\d+$/ and do {
$r
}->{$_} > 0
MC/DC100%2/2
do {
$r
}->{$_} =~ /^\d+$/ and do {
$r
}->{$_} > 0
do {
$r
}->{$_} =~ /^\d+$/
do {
$r
}->{$_} > 0
Truth table100%3/3
A and B
A= do {
$r
}->{$_} =~ /^\d+$/B= do {
$r
}->{$_} > 0
| |||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||
| 125 | 235 | my $msg = q{}; | |||||||||||||||||||||||||||
| 126 | 235 | ▶ | if ( (keys %badentriesL) or (keys %badentriesR) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
keys %badentriesL or keys %badentriesR
MC/DC100%2/2
keys %badentriesL or keys %badentriesR
keys %badentriesL
keys %badentriesR
Truth table100%3/3
A or B
A= keys %badentriesLB= keys %badentriesR
| |||||||||||||||||||||||||||||
| 127 | 22 | $msg .= "\nValues in a 'seen-hash' must be numeric.\n"; | |||||||||||||||||||||||||||
| 128 | 22 | $msg .= " These elements have invalid values:\n"; | |||||||||||||||||||||||||||
| 129 | 22 | ▶ | if (keys %badentriesL) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 130 | 20 | $msg .= " First hash in arguments:\n"; | |||||||||||||||||||||||||||
| 131 | $msg .= " Key: $_\tValue: $badentriesL{$_}\n" | ||||||||||||||||||||||||||||
| 132 | 20 | foreach (sort keys %badentriesL); | |||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||
| 134 | 22 | ▶ | if (keys %badentriesR) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 135 | 20 | $msg .= " Second hash in arguments:\n"; | |||||||||||||||||||||||||||
| 136 | $msg .= " Key: $_\tValue: $badentriesR{$_}\n" | ||||||||||||||||||||||||||||
| 137 | 20 | foreach (sort keys %badentriesR); | |||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||
| 139 | 22 | $msg .= "Correct invalid values before proceeding"; | |||||||||||||||||||||||||||
| 140 | 22 | croak "$msg: $!"; | |||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | 206 | ▶ | sub _validate_multiple_seenhashes { | ||||||||||||||||||||||||||
|
Subroutine
_validate_multiple_seenhashes: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||
| 146 | 206 | my $hashrefsref = shift; | |||||||||||||||||||||||||||
| 147 | 206 | my (%badentries); | |||||||||||||||||||||||||||
| 148 | 206 | ▶ | for (my $i = 0; $i <= $#{$hashrefsref}; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 149 | 1040 | foreach my $k (keys %{$hashrefsref->[$i]}) { | |||||||||||||||||||||||||||
| 150 | 5588 | ▶ | unless ($hashrefsref->[$i]->{$k} =~ /^\d+$/ and $hashrefsref->[$i]->{$k} > 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$hashrefsref->[$i]{$k} =~ /^\d+$/ and $hashrefsref->[$i]{$k} > 0
MC/DC100%2/2
$hashrefsref->[$i]{$k} =~ /^\d+$/ and $hashrefsref->[$i]{$k} > 0
$hashrefsref->[$i]{$k} =~ /^\d+$/
$hashrefsref->[$i]{$k} > 0
Truth table100%3/3
A and B
A= $hashrefsref->[$i]{$k} =~ /^\d+$/B= $hashrefsref->[$i]{$k} > 0
| |||||||||||||||||||||||||||||
| 151 | 2 | $badentries{$i}{$k} = $hashrefsref->[$i]->{$k}; | |||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||
| 155 | 206 | my $msg = q{}; | |||||||||||||||||||||||||||
| 156 | 206 | ▶ | if (scalar(keys %badentries)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 157 | 2 | $msg .= "\nValues in a 'seen-hash' must be positive integers.\n"; | |||||||||||||||||||||||||||
| 158 | 2 | $msg .= " These elements have invalid values:\n\n"; | |||||||||||||||||||||||||||
| 159 | 2 | foreach my $b (sort keys %badentries) { | |||||||||||||||||||||||||||
| 160 | 2 | $msg .= " Hash $b:\n"; | |||||||||||||||||||||||||||
| 161 | 2 | foreach my $val (sort keys %{$badentries{$b}}) { | |||||||||||||||||||||||||||
| 162 | 2 | $msg .= " Bad key-value pair: $val\t$badentries{$b}->{$val}\n"; | |||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||
| 165 | 2 | $msg .= "Correct invalid values before proceeding"; | |||||||||||||||||||||||||||
| 166 | 2 | croak "$msg: $!"; | |||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | 6052 | ▶ | sub _list_builder { | ||||||||||||||||||||||||||
|
Subroutine
_list_builder: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 171 | 6052 | my ($aref, $x) = @_; | |||||||||||||||||||||||||||
| 172 | 6052 | ▶ | if (ref(${$aref}[$x]) eq 'HASH') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 173 | 4072 | return keys %{${$aref}[$x]}; | |||||||||||||||||||||||||||
| 174 | } else { | ||||||||||||||||||||||||||||
| 175 | 1980 | return @{${$aref}[$x]}; | |||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | 136 | ▶ | sub _calculate_array_seen_only { | ||||||||||||||||||||||||||
|
Subroutine
_calculate_array_seen_only: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 180 | 136 | my $aref = shift; | |||||||||||||||||||||||||||
| 181 | 136 | my (@seen); | |||||||||||||||||||||||||||
| 182 | 136 | ▶ | for (my $i = 0; $i <= $#{$aref}; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 183 | 608 | my %seenthis = (); | |||||||||||||||||||||||||||
| 184 | 608 | foreach my $el ( _list_builder($aref, $i) ) { | |||||||||||||||||||||||||||
| 185 | 3564 | $seenthis{$el}++; | |||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||
| 187 | 608 | push @seen, \%seenthis; | |||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||
| 189 | 136 | return \@seen; | |||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | 901 | ▶ | sub _calculate_seen_only { | ||||||||||||||||||||||||||
|
Subroutine
_calculate_seen_only: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 193 | 901 | my $aref = shift; | |||||||||||||||||||||||||||
| 194 | 901 | my (%seen); | |||||||||||||||||||||||||||
| 195 | 901 | ▶ | for (my $i = 0; $i <= $#{$aref}; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 196 | 3786 | my %seenthis = (); | |||||||||||||||||||||||||||
| 197 | 3786 | foreach my $h ( _list_builder($aref, $i) ) { | |||||||||||||||||||||||||||
| 198 | 21918 | $seenthis{$h}++; | |||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||
| 200 | 3786 | $seen{$i} = \%seenthis; | |||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||
| 202 | 901 | return \%seen; | |||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||
| 205 | 32 | ▶ | sub _calculate_intermediate { | ||||||||||||||||||||||||||
|
Subroutine
_calculate_intermediate: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 206 | 32 | my $aref = shift; | |||||||||||||||||||||||||||
| 207 | 32 | my $aseenref = _calculate_array_seen_only($aref); | |||||||||||||||||||||||||||
| 208 | 32 | my @vals = sort { scalar(keys(%{$a})) <=> scalar(keys(%{$b})) } @{$aseenref}; | |||||||||||||||||||||||||||
| 209 | 32 | my %intermediate = map { $_ => 1 } keys %{$vals[0]}; | |||||||||||||||||||||||||||
| 210 | 32 | for my $l ( 1..$#vals ) { | |||||||||||||||||||||||||||
| 211 | 384 | %intermediate = map { $_ => 1 } | |||||||||||||||||||||||||||
| 212 | 736 | grep { exists $intermediate{$_} } | |||||||||||||||||||||||||||
| 213 | 128 | keys %{$vals[$l]}; | |||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||
| 215 | 32 | return \%intermediate; | |||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | 225 | ▶ | sub _calculate_union_only { | ||||||||||||||||||||||||||
|
Subroutine
_calculate_union_only: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 219 | 225 | my $aref = shift; | |||||||||||||||||||||||||||
| 220 | 225 | my (%union); | |||||||||||||||||||||||||||
| 221 | 225 | ▶ | for (my $i = 0; $i <= $#{$aref}; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 222 | 930 | foreach my $h ( _list_builder($aref, $i) ) { | |||||||||||||||||||||||||||
| 223 | 5470 | $union{$h}++; | |||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||
| 226 | 225 | return \%union; | |||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | 160 | ▶ | sub _calculate_union_seen_only { | ||||||||||||||||||||||||||
|
Subroutine
_calculate_union_seen_only: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 230 | 160 | my $aref = shift; | |||||||||||||||||||||||||||
| 231 | 160 | my (%union, %seen); | |||||||||||||||||||||||||||
| 232 | 160 | ▶ | for (my $i = 0; $i <= $#{$aref}; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 233 | 728 | my %seenthis = (); | |||||||||||||||||||||||||||
| 234 | 728 | foreach my $h ( _list_builder($aref, $i) ) { | |||||||||||||||||||||||||||
| 235 | 4276 | $seenthis{$h}++; | |||||||||||||||||||||||||||
| 236 | 4276 | $union{$h}++; | |||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||
| 238 | 728 | $seen{$i} = \%seenthis; | |||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||
| 240 | 160 | return (\%union, \%seen); | |||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | 176 | ▶ | sub _calculate_sharedref { | ||||||||||||||||||||||||||
|
Subroutine
_calculate_sharedref: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||
| 244 | 176 | my $seenrefsref = shift; | |||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | 176 | my %intermediate = (); | |||||||||||||||||||||||||||
| 247 | 176 | for my $href (@{$seenrefsref}) { | |||||||||||||||||||||||||||
| 248 | 736 | my %this = map { $_ => 1 } keys(%{$href}); | |||||||||||||||||||||||||||
| 249 | 736 | for my $k (keys %this) {; | |||||||||||||||||||||||||||
| 250 | 4128 | $intermediate{$k}++; | |||||||||||||||||||||||||||
| 251 | }; | ||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||
| 254 | 176 | my $sharedref; | |||||||||||||||||||||||||||
| 255 | 176 | for my $k (keys %intermediate) { | |||||||||||||||||||||||||||
| 256 | 1664 | ▶ | $sharedref->{$k}++ if $intermediate{$k} > 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||
| 258 | 176 | return $sharedref; | |||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | 1364 | ▶ | sub _is_list_subset { | ||||||||||||||||||||||||||
|
Subroutine
_is_list_subset: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 262 | 1364 | my ( $subset, $superset ) = @_; | |||||||||||||||||||||||||||
| 263 | # return false if the superset value is false | ||||||||||||||||||||||||||||
| 264 | # for any subset value. | ||||||||||||||||||||||||||||
| 265 | # note that this does *not* validate overlap of | ||||||||||||||||||||||||||||
| 266 | # the keys; it validates the truth of supserset | ||||||||||||||||||||||||||||
| 267 | # values. | ||||||||||||||||||||||||||||
| 268 | 1364 | ▶ | $superset->{ $_ } or return 0 for keys %$subset; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 269 | 440 | return 1; | |||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | 204 | ▶ | sub _subset_subengine { | ||||||||||||||||||||||||||
|
Subroutine
_subset_subengine: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||
| 273 | 204 | my $aref = shift; | |||||||||||||||||||||||||||
| 274 | 204 | my (@xsubset); | |||||||||||||||||||||||||||
| 275 | 204 | my %seen = %{_calculate_seen_only($aref)}; | |||||||||||||||||||||||||||
| 276 | 204 | foreach my $i (keys %seen) { | |||||||||||||||||||||||||||
| 277 | 796 | foreach my $j (keys %seen) { | |||||||||||||||||||||||||||
| 278 | 3524 | ▶ | if ( $i eq $j ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 279 | 796 | $xsubset[$i][$j] = 1; | |||||||||||||||||||||||||||
| 280 | } | ||||||||||||||||||||||||||||
| 281 | elsif ( $i gt $j ) { | ||||||||||||||||||||||||||||
| 282 | 1364 | ▶ | if ( scalar(keys %{ $seen{$i} }) == scalar(keys %{ $seen{$j} }) ){ | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 283 | 300 | $xsubset[$i][$j] = _is_list_subset($seen{$i}, $seen{$j}); | |||||||||||||||||||||||||||
| 284 | 300 | $xsubset[$j][$i] = $xsubset[$i][$j]; | |||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||
| 286 | 1064 | elsif ( scalar(keys %{ $seen{$i} }) < scalar(keys %{ $seen{$j} }) ){ | |||||||||||||||||||||||||||
| 287 | 1052 | $xsubset[$i][$j] = _is_list_subset($seen{$i}, $seen{$j}); | |||||||||||||||||||||||||||
| 288 | 1052 | $xsubset[$j][$i] = 0; | |||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||
| 290 | else { | ||||||||||||||||||||||||||||
| 291 | 12 | $xsubset[$j][$i] = _is_list_subset($seen{$j}, $seen{$i}); | |||||||||||||||||||||||||||
| 292 | 12 | $xsubset[$i][$j] = 0; | |||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||
| 297 | 204 | return \@xsubset; | |||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||
| 299 | 32 | ▶ | sub _chart_engine_regular { | ||||||||||||||||||||||||||
|
Subroutine
_chart_engine_regular: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 300 | 32 | my $aref = shift; | |||||||||||||||||||||||||||
| 301 | 32 | my @sub_or_eqv = @$aref; | |||||||||||||||||||||||||||
| 302 | 32 | my $title = shift; | |||||||||||||||||||||||||||
| 303 | 32 | my ($v, $w, $t); | |||||||||||||||||||||||||||
| 304 | 32 | print "\n"; | |||||||||||||||||||||||||||
| 305 | 32 | print $title, ' Relationships', "\n\n"; | |||||||||||||||||||||||||||
| 306 | 32 | print ' Right: 0 1', "\n\n"; | |||||||||||||||||||||||||||
| 307 | 32 | print 'Left: 0: 1 ', $sub_or_eqv[0], "\n\n"; | |||||||||||||||||||||||||||
| 308 | 32 | print ' 1: ', $sub_or_eqv[1], ' 1', "\n\n"; | |||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | 48 | ▶ | sub _chart_engine_multiple { | ||||||||||||||||||||||||||
|
Subroutine
_chart_engine_multiple: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||
| 312 | 48 | my $aref = shift; | |||||||||||||||||||||||||||
| 313 | 48 | my @sub_or_eqv = @$aref; | |||||||||||||||||||||||||||
| 314 | 48 | my $title = shift; | |||||||||||||||||||||||||||
| 315 | 48 | my ($v, $w, $t); | |||||||||||||||||||||||||||
| 316 | 48 | print "\n"; | |||||||||||||||||||||||||||
| 317 | 48 | print $title, ' Relationships', "\n\n"; | |||||||||||||||||||||||||||
| 318 | 48 | print ' Right:'; | |||||||||||||||||||||||||||
| 319 | 48 | ▶ | for ($v = 0; $v <= $#sub_or_eqv; $v++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 320 | 216 | print ' ', $v; | |||||||||||||||||||||||||||
| 321 | } | ||||||||||||||||||||||||||||
| 322 | 48 | print "\n\n"; | |||||||||||||||||||||||||||
| 323 | 48 | print 'Left: 0:'; | |||||||||||||||||||||||||||
| 324 | 48 | my @firstrow = @{$sub_or_eqv[0]}; | |||||||||||||||||||||||||||
| 325 | 48 | ▶ | for ($t = 0; $t <= $#firstrow; $t++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 326 | 216 | print ' ', $firstrow[$t]; | |||||||||||||||||||||||||||
| 327 | } | ||||||||||||||||||||||||||||
| 328 | 48 | print "\n\n"; | |||||||||||||||||||||||||||
| 329 | 48 | ▶ | for ($w = 1; $w <= $#sub_or_eqv; $w++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 330 | 168 | my $length_left = length($w); | |||||||||||||||||||||||||||
| 331 | 168 | my $x = ''; | |||||||||||||||||||||||||||
| 332 | 168 | print ' ' x (8 - $length_left), $w, ':'; | |||||||||||||||||||||||||||
| 333 | 168 | my @row = @{$sub_or_eqv[$w]}; | |||||||||||||||||||||||||||
| 334 | 168 | ▶ | for ($x = 0; $x <= $#row; $x++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 335 | 816 | print ' ', $row[$x]; | |||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||
| 337 | 168 | print "\n\n"; | |||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||
| 339 | 48 | 1; # force return true value | |||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||
| 342 | 76 | ▶ | sub _equivalent_subengine { | ||||||||||||||||||||||||||
|
Subroutine
_equivalent_subengine: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||
| 343 | 76 | my $aref = shift; | |||||||||||||||||||||||||||
| 344 | 76 | my @xsubset = @{_subset_subengine($aref)}; | |||||||||||||||||||||||||||
| 345 | 76 | my (@xequivalent); | |||||||||||||||||||||||||||
| 346 | 76 | ▶ | for (my $f = 0; $f <= $#xsubset; $f++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 347 | 296 | ▶ | for (my $g = 0; $g <= $#xsubset; $g++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 348 | 1312 | $xequivalent[$f][$g] = 0; | |||||||||||||||||||||||||||
| 349 | 1312 | ▶ | $xequivalent[$f][$g] = 1 | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$xsubset[$f][$g] and $xsubset[$g][$f]
MC/DC100%2/2
$xsubset[$f][$g] and $xsubset[$g][$f]
$xsubset[$f][$g]
$xsubset[$g][$f]
Truth table100%3/3
A and B
A= $xsubset[$f][$g]B= $xsubset[$g][$f]
| |||||||||||||||||||||||||||||
| 350 | if ($xsubset[$f][$g] and $xsubset[$g][$f]); | ||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||
| 353 | 76 | return \@xequivalent; | |||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | 170 | ▶ | sub _index_message1 { | ||||||||||||||||||||||||||
|
Subroutine
_index_message1: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 357 | 170 | my ($index, $dataref) = @_; | |||||||||||||||||||||||||||
| 358 | 170 | my $method = (caller(1))[3]; | |||||||||||||||||||||||||||
| 359 | croak "Argument to method $method must be the array index of the target list \n in list of arrays passed as arguments to the constructor: $!" | ||||||||||||||||||||||||||||
| 360 | unless ( | ||||||||||||||||||||||||||||
| 361 | $index =~ /^\d+$/ | ||||||||||||||||||||||||||||
| 362 | 170 | ▶ | and $index <= ${$dataref}{'maxindex'} | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$index =~ /^\d+$/ and $index <= do {
$dataref
}->{"maxindex"}
MC/DC100%2/2
$index =~ /^\d+$/ and $index <= do {
$dataref
}->{"maxindex"}
$index =~ /^\d+$/
$index <= do {
$dataref
}->{"maxindex"}
Truth table100%3/3
A and B
A= $index =~ /^\d+$/B= $index <= do {
$dataref
}->{"maxindex"}
| |||||||||||||||||||||||||||||
| 363 | ); | ||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||
| 366 | 135 | ▶ | sub _index_message2 { | ||||||||||||||||||||||||||
|
Subroutine
_index_message2: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||
| 367 | 135 | my $dataref = shift; | |||||||||||||||||||||||||||
| 368 | 135 | my ($index_left, $index_right); | |||||||||||||||||||||||||||
| 369 | 135 | my $method = (caller(1))[3]; | |||||||||||||||||||||||||||
| 370 | 135 | ▶ | croak "Method $method requires 2 arguments: $!" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@_ == 0 or @_ == 2
MC/DC100%2/2
@_ == 0 or @_ == 2
@_ == 0
@_ == 2
Truth table100%3/3
A or B
A= @_ == 0B= @_ == 2
| |||||||||||||||||||||||||||||
| 371 | unless (@_ == 0 || @_ == 2); | ||||||||||||||||||||||||||||
| 372 | 123 | ▶ | if (@_ == 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 373 | 18 | $index_left = 0; | |||||||||||||||||||||||||||
| 374 | 18 | $index_right = 1; | |||||||||||||||||||||||||||
| 375 | } else { | ||||||||||||||||||||||||||||
| 376 | 105 | ($index_left, $index_right) = @_; | |||||||||||||||||||||||||||
| 377 | 105 | foreach ($index_left, $index_right) { | |||||||||||||||||||||||||||
| 378 | croak "Each argument to method $method must be a valid array index for the target list \n in list of arrays passed as arguments to the constructor: $!" | ||||||||||||||||||||||||||||
| 379 | unless ( | ||||||||||||||||||||||||||||
| 380 | $_ =~ /^\d+$/ | ||||||||||||||||||||||||||||
| 381 | 199 | ▶ | and $_ <= ${$dataref}{'maxindex'} | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$_ =~ /^\d+$/ and $_ <= do {
$dataref
}->{"maxindex"}
MC/DC100%2/2
$_ =~ /^\d+$/ and $_ <= do {
$dataref
}->{"maxindex"}
$_ =~ /^\d+$/
$_ <= do {
$dataref
}->{"maxindex"}
Truth table100%3/3
A and B
A= $_ =~ /^\d+$/B= $_ <= do {
$dataref
}->{"maxindex"}
| |||||||||||||||||||||||||||||
| 382 | ); | ||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||
| 385 | 112 | return ($index_left, $index_right); | |||||||||||||||||||||||||||
| 386 | } | ||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||
| 388 | 170 | ▶ | sub _index_message3 { | ||||||||||||||||||||||||||
|
Subroutine
_index_message3: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 389 | 170 | my ($index, $maxindex) = @_; | |||||||||||||||||||||||||||
| 390 | 170 | my $method = (caller(1))[3]; | |||||||||||||||||||||||||||
| 391 | 170 | ▶ | croak "Argument to method $method must be the array index of the target list \n in list of arrays passed as arguments to the constructor: $!" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$index =~ /^\d+$/ and $index <= $maxindex
MC/DC100%2/2
$index =~ /^\d+$/ and $index <= $maxindex
$index =~ /^\d+$/
$index <= $maxindex
Truth table100%3/3
A and B
A= $index =~ /^\d+$/B= $index <= $maxindex
| |||||||||||||||||||||||||||||
| 392 | unless ( | ||||||||||||||||||||||||||||
| 393 | $index =~ /^\d+$/ | ||||||||||||||||||||||||||||
| 394 | and $index <= $maxindex | ||||||||||||||||||||||||||||
| 395 | ); | ||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||
| 398 | 126 | ▶ | sub _index_message4 { | ||||||||||||||||||||||||||
|
Subroutine
_index_message4: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||
| 399 | 126 | my $maxindex = shift; | |||||||||||||||||||||||||||
| 400 | 126 | my ($index_left, $index_right); | |||||||||||||||||||||||||||
| 401 | 126 | my $method = (caller(1))[3]; | |||||||||||||||||||||||||||
| 402 | 126 | ▶ | croak "Method $method requires 2 arguments: $!" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@_ == 0 or @_ == 2
MC/DC100%2/2
@_ == 0 or @_ == 2
@_ == 0
@_ == 2
Truth table100%3/3
A or B
A= @_ == 0B= @_ == 2
| |||||||||||||||||||||||||||||
| 403 | unless (@_ == 0 || @_ == 2); | ||||||||||||||||||||||||||||
| 404 | 114 | ▶ | if (@_ == 0) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 405 | 16 | $index_left = 0; | |||||||||||||||||||||||||||
| 406 | 16 | $index_right = 1; | |||||||||||||||||||||||||||
| 407 | } else { | ||||||||||||||||||||||||||||
| 408 | 98 | ($index_left, $index_right) = @_; | |||||||||||||||||||||||||||
| 409 | 98 | foreach ($index_left, $index_right) { | |||||||||||||||||||||||||||
| 410 | 186 | ▶ | croak "Each argument to method $method must be a valid array index for the target list \n in list of arrays passed as arguments to the constructor: $!" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$_ =~ /^\d+$/ and $_ <= $maxindex
MC/DC100%2/2
$_ =~ /^\d+$/ and $_ <= $maxindex
$_ =~ /^\d+$/
$_ <= $maxindex
Truth table100%3/3
A and B
A= $_ =~ /^\d+$/B= $_ <= $maxindex
| |||||||||||||||||||||||||||||
| 411 | unless ( | ||||||||||||||||||||||||||||
| 412 | $_ =~ /^\d+$/ | ||||||||||||||||||||||||||||
| 413 | and $_ <= $maxindex | ||||||||||||||||||||||||||||
| 414 | ); | ||||||||||||||||||||||||||||
| 415 | } | ||||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||
| 417 | 104 | return ($index_left, $index_right); | |||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||
| 420 | 752 | ▶ | sub _prepare_listrefs { | ||||||||||||||||||||||||||
|
Subroutine
_prepare_listrefs: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 421 | 752 | my $dataref = shift; | |||||||||||||||||||||||||||
| 422 | 752 | delete ${$dataref}{'unsort'}; | |||||||||||||||||||||||||||
| 423 | 752 | my (@listrefs); | |||||||||||||||||||||||||||
| 424 | 752 | foreach my $lref (sort {$a <=> $b} keys %{$dataref}) { | |||||||||||||||||||||||||||
| 425 | 3788 | push(@listrefs, ${$dataref}{$lref}); | |||||||||||||||||||||||||||
| 426 | }; | ||||||||||||||||||||||||||||
| 427 | 752 | return \@listrefs; | |||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||
| 430 | 64 | ▶ | sub _subset_engine_multaccel { | ||||||||||||||||||||||||||
|
Subroutine
_subset_engine_multaccel: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 431 | 64 | my $dataref = shift; | |||||||||||||||||||||||||||
| 432 | 64 | my $aref = _prepare_listrefs($dataref); | |||||||||||||||||||||||||||
| 433 | 64 | my ($index_left, $index_right) = _index_message4($#{$aref}, @_); | |||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||
| 435 | 56 | my $xsubsetref = _subset_subengine($aref); | |||||||||||||||||||||||||||
| 436 | 56 | return ${$xsubsetref}[$index_left][$index_right]; | |||||||||||||||||||||||||||
| 437 | } | ||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||
| 439 | 718 | ▶ | sub _calc_seen { | ||||||||||||||||||||||||||
|
Subroutine
_calc_seen: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 440 | 718 | my ($refL, $refR) = @_; | |||||||||||||||||||||||||||
| 441 | # We've already guaranteed that args are both array refs or both hash | ||||||||||||||||||||||||||||
| 442 | # refs. So checking the left-hand one is sufficient. | ||||||||||||||||||||||||||||
| 443 | 718 | ▶ | if (ref($refL) eq 'ARRAY') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 444 | 365 | my (%seenL, %seenR); | |||||||||||||||||||||||||||
| 445 | 365 | foreach (@$refL) { $seenL{$_}++ } | |||||||||||||||||||||||||||
| 446 | 365 | foreach (@$refR) { $seenR{$_}++ } | |||||||||||||||||||||||||||
| 447 | 365 | return (\%seenL, \%seenR); | |||||||||||||||||||||||||||
| 448 | } else { | ||||||||||||||||||||||||||||
| 449 | 353 | return ($refL, $refR); | |||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||
| 453 | 56 | ▶ | sub _equiv_engine { | ||||||||||||||||||||||||||
|
Subroutine
_equiv_engine: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||
| 454 | 56 | my ($hrefL, $hrefR) = @_; | |||||||||||||||||||||||||||
| 455 | 56 | my (%intersection, %Lonly, %Ronly, %LorRonly); | |||||||||||||||||||||||||||
| 456 | 56 | my $LequivalentR_status = 0; | |||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||
| 458 | 56 | foreach (keys %{$hrefL}) { | |||||||||||||||||||||||||||
| 459 | 312 | ▶ | exists ${$hrefR}{$_} ? $intersection{$_}++ : $Lonly{$_}++; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||
| 462 | 56 | foreach (keys %{$hrefR}) { | |||||||||||||||||||||||||||
| 463 | 296 | ▶ | $Ronly{$_}++ unless (exists $intersection{$_}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||
| 466 | 56 | $LorRonly{$_}++ foreach ( (keys %Lonly), (keys %Ronly) ); | |||||||||||||||||||||||||||
| 467 | 56 | ▶ | $LequivalentR_status = 1 if ( (keys %LorRonly) == 0); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 468 | 56 | return $LequivalentR_status; | |||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||
| 471 | 889 | ▶ | sub _argument_checker_0 { | ||||||||||||||||||||||||||
|
Subroutine
_argument_checker_0: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||
| 472 | 889 | my @args = @_; | |||||||||||||||||||||||||||
| 473 | 889 | my $first_ref = ref($args[0]); | |||||||||||||||||||||||||||
| 474 | 889 | my @temp = @args[1..$#args]; | |||||||||||||||||||||||||||
| 475 | 889 | my ($testing); | |||||||||||||||||||||||||||
| 476 | 889 | my $condition = 1; | |||||||||||||||||||||||||||
| 477 | 889 | ▶ | while (defined ($testing = shift(@temp)) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 478 | 2083 | ▶ | unless (ref($testing) eq $first_ref) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 479 | 18 | $condition = 0; | |||||||||||||||||||||||||||
| 480 | 18 | last; | |||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||
| 483 | 889 | ▶ | croak "Arguments must be either all array references or all hash references: $!" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 484 | unless $condition; | ||||||||||||||||||||||||||||
| 485 | 871 | ▶ | _validate_seen_hash(@args) if $first_ref eq 'HASH'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 486 | 849 | return (@args); | |||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||
| 489 | 842 | ▶ | sub _argument_checker { | ||||||||||||||||||||||||||
|
Subroutine
_argument_checker: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 490 | 842 | my $argref = shift; | |||||||||||||||||||||||||||
| 491 | 842 | ▶ | croak "'$argref' must be an array ref" unless ref($argref) eq 'ARRAY'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 492 | 806 | my @args = _argument_checker_0(@{$argref}); | |||||||||||||||||||||||||||
| 493 | 770 | return (@args); | |||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||
| 496 | 267 | ▶ | sub _argument_checker_1 { | ||||||||||||||||||||||||||
|
Subroutine
_argument_checker_1: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 497 | 267 | my $argref = shift; | |||||||||||||||||||||||||||
| 498 | 267 | my @args = @{$argref}; | |||||||||||||||||||||||||||
| 499 | 267 | ▶ | croak "Subroutine call requires 2 references as arguments: $!" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 500 | unless @args == 2; | ||||||||||||||||||||||||||||
| 501 | 264 | return (_argument_checker($args[0]), ${$args[1]}[0]); | |||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||
| 504 | 18 | ▶ | sub _argument_checker_2 { | ||||||||||||||||||||||||||
|
Subroutine
_argument_checker_2: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 505 | 18 | my $argref = shift; | |||||||||||||||||||||||||||
| 506 | 18 | my @args = @$argref; | |||||||||||||||||||||||||||
| 507 | 18 | ▶ | croak "Subroutine call requires 2 references as arguments: $!" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 508 | unless @args == 2; | ||||||||||||||||||||||||||||
| 509 | 16 | return (_argument_checker($args[0]), $args[1]); | |||||||||||||||||||||||||||
| 510 | } | ||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||
| 512 | # _argument_checker_3 is currently set-up to handle either 1 or 2 arguments | ||||||||||||||||||||||||||||
| 513 | # in get_unique and get_complement | ||||||||||||||||||||||||||||
| 514 | # The first argument is an arrayref holding refs to lists ('unsorted' has been | ||||||||||||||||||||||||||||
| 515 | # stripped off). | ||||||||||||||||||||||||||||
| 516 | # The second argument is an arrayref holding a single item (index number of | ||||||||||||||||||||||||||||
| 517 | # item being tested) | ||||||||||||||||||||||||||||
| 518 | # Note: Currently we're only checking for the quantity of arguments -- not | ||||||||||||||||||||||||||||
| 519 | # their types. This should be fixed. | ||||||||||||||||||||||||||||
| 520 | 115 | ▶ | sub _argument_checker_3 { | ||||||||||||||||||||||||||
|
Subroutine
_argument_checker_3: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 521 | 115 | my $argref = shift; | |||||||||||||||||||||||||||
| 522 | 115 | my @args = @{$argref}; | |||||||||||||||||||||||||||
| 523 | 115 | ▶ | if (@args == 1) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 524 | 65 | return (_argument_checker($args[0]), 0); | |||||||||||||||||||||||||||
| 525 | } elsif (@args == 2) { | ||||||||||||||||||||||||||||
| 526 | 40 | return (_argument_checker($args[0]), ${$args[1]}[0]); | |||||||||||||||||||||||||||
| 527 | } else { | ||||||||||||||||||||||||||||
| 528 | 10 | croak "Subroutine call requires 1 or 2 references as arguments: $!"; | |||||||||||||||||||||||||||
| 529 | } | ||||||||||||||||||||||||||||
| 530 | } | ||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||
| 532 | 34 | ▶ | sub _argument_checker_3a { | ||||||||||||||||||||||||||
|
Subroutine
_argument_checker_3a: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 533 | 34 | my $argref = shift; | |||||||||||||||||||||||||||
| 534 | 34 | my @args = @{$argref}; | |||||||||||||||||||||||||||
| 535 | 34 | ▶ | if (@args == 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 536 | 32 | return [ _argument_checker($args[0]) ]; | |||||||||||||||||||||||||||
| 537 | } else { | ||||||||||||||||||||||||||||
| 538 | 2 | croak "Subroutine call requires exactly 1 reference as argument: $!"; | |||||||||||||||||||||||||||
| 539 | } | ||||||||||||||||||||||||||||
| 540 | } | ||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||
| 542 | 136 | ▶ | sub _argument_checker_4 { | ||||||||||||||||||||||||||
|
Subroutine
_argument_checker_4: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||
| 543 | 136 | my $argref = shift; | |||||||||||||||||||||||||||
| 544 | 136 | my @args = @{$argref}; | |||||||||||||||||||||||||||
| 545 | 136 | ▶ | if (@args == 1) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 546 | 84 | return (_argument_checker($args[0]), [0,1]); | |||||||||||||||||||||||||||
| 547 | } elsif (@args == 2) { | ||||||||||||||||||||||||||||
| 548 | 49 | ▶ | if (@{$args[1]} == 2) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 549 | 44 | my $last_index = $#{$args[0]}; | |||||||||||||||||||||||||||
| 550 | 44 | foreach my $i (@{$args[1]}) { | |||||||||||||||||||||||||||
| 551 | 80 | ▶ | croak "No element in index position $i in list of list references passed as first argument to function: $!" | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$i =~ /^\d+$/ and $i <= $last_index
MC/DC100%2/2
$i =~ /^\d+$/ and $i <= $last_index
$i =~ /^\d+$/
$i <= $last_index
Truth table100%3/3
A and B
A= $i =~ /^\d+$/B= $i <= $last_index
| |||||||||||||||||||||||||||||
| 552 | unless ($i =~ /^\d+$/ and $i <= $last_index); | ||||||||||||||||||||||||||||
| 553 | } | ||||||||||||||||||||||||||||
| 554 | 36 | return (_argument_checker($args[0]), $args[1]); | |||||||||||||||||||||||||||
| 555 | } else { | ||||||||||||||||||||||||||||
| 556 | 5 | croak "Must provide index positions corresponding to two lists: $!"; | |||||||||||||||||||||||||||
| 557 | } | ||||||||||||||||||||||||||||
| 558 | } else { | ||||||||||||||||||||||||||||
| 559 | 3 | croak "Subroutine call requires 1 or 2 references as arguments: $!"; | |||||||||||||||||||||||||||
| 560 | } | ||||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||
| 563 | 706 | ▶ | sub _calc_seen1 { | ||||||||||||||||||||||||||
|
Subroutine
_calc_seen1: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 564 | 706 | my @listrefs = @_; | |||||||||||||||||||||||||||
| 565 | # _calc_seen1() is applied after _argument_checker(), which checks to make | ||||||||||||||||||||||||||||
| 566 | # sure that the references in its output are either all arrayrefs | ||||||||||||||||||||||||||||
| 567 | # or all seenhashrefs | ||||||||||||||||||||||||||||
| 568 | # hence, _calc_seen1 only needs to determine whether it's dealing with | ||||||||||||||||||||||||||||
| 569 | # arrayrefs or seenhashrefs, then, if arrayrefs, calculate seenhashes | ||||||||||||||||||||||||||||
| 570 | 706 | ▶ | if (ref($listrefs[0]) eq 'ARRAY') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 571 | 368 | my (@seenrefs); | |||||||||||||||||||||||||||
| 572 | 368 | foreach my $aref (@listrefs) { | |||||||||||||||||||||||||||
| 573 | 1250 | my (%seenthis); | |||||||||||||||||||||||||||
| 574 | 1250 | foreach my $j (@{$aref}) { | |||||||||||||||||||||||||||
| 575 | 8088 | $seenthis{$j}++; | |||||||||||||||||||||||||||
| 576 | } | ||||||||||||||||||||||||||||
| 577 | 1250 | push(@seenrefs, \%seenthis); | |||||||||||||||||||||||||||
| 578 | } | ||||||||||||||||||||||||||||
| 579 | 368 | return \@seenrefs; | |||||||||||||||||||||||||||
| 580 | } else { | ||||||||||||||||||||||||||||
| 581 | 338 | return \@listrefs; | |||||||||||||||||||||||||||
| 582 | } | ||||||||||||||||||||||||||||
| 583 | } | ||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||
| 585 | # _alt_construct_tester prepares for _argument_checker in | ||||||||||||||||||||||||||||
| 586 | # get_union get_intersection get_symmetric_difference get_shared get_nonintersection | ||||||||||||||||||||||||||||
| 587 | 317 | ▶ | sub _alt_construct_tester { | ||||||||||||||||||||||||||
|
Subroutine
_alt_construct_tester: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||
| 588 | 317 | my @args = @_; | |||||||||||||||||||||||||||
| 589 | 317 | my ($argref, $unsorted); | |||||||||||||||||||||||||||
| 590 | 317 | ▶ | if (@args == 1 and (ref($args[0]) eq 'HASH')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@args == 1 and ref $args[0] eq "HASH"
MC/DC100%2/2
@args == 1 and ref $args[0] eq "HASH"
@args == 1
ref $args[0] eq "HASH"
Truth table100%3/3
A and B
A= @args == 1B= ref $args[0] eq "HASH"
| |||||||||||||||||||||||||||||
| 591 | 144 | my $hashref = shift; | |||||||||||||||||||||||||||
| 592 | croak "$bad_lists_msg: $!" | ||||||||||||||||||||||||||||
| 593 | 144 | unless ( ${$hashref}{'lists'} | |||||||||||||||||||||||||||
| 594 | 144 | ▶ | and (ref(${$hashref}{'lists'}) eq 'ARRAY') ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
do {
$hashref
}->{"lists"} and ref do {
$hashref
}->{"lists"} eq "ARRAY"
MC/DC100%2/2
do {
$hashref
}->{"lists"} and ref do {
$hashref
}->{"lists"} eq "ARRAY"
do {
$hashref
}->{"lists"}
ref do {
$hashref
}->{"lists"} eq "ARRAY"
Truth table100%3/3
A and B
A= do {
$hashref
}->{"lists"}B= ref do {
$hashref
}->{"lists"} eq "ARRAY"
| |||||||||||||||||||||||||||||
| 595 | 116 | $argref = ${$hashref}{'lists'}; | |||||||||||||||||||||||||||
| 596 | 116 | ▶ | $unsorted = ${$hashref}{'unsorted'} ? 1 : ''; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 597 | } else { | ||||||||||||||||||||||||||||
| 598 | 173 | ▶ | $unsorted = shift(@args) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$args[0] eq "-u" or $args[0] eq "--unsorted"
MC/DC100%2/2
$args[0] eq "-u" or $args[0] eq "--unsorted"
$args[0] eq "-u"
$args[0] eq "--unsorted"
Truth table100%3/3
A or B
A= $args[0] eq "-u"B= $args[0] eq "--unsorted"
| |||||||||||||||||||||||||||||
| 599 | if ($args[0] eq '-u' or $args[0] eq '--unsorted'); | ||||||||||||||||||||||||||||
| 600 | 173 | $argref = shift(@args); | |||||||||||||||||||||||||||
| 601 | } | ||||||||||||||||||||||||||||
| 602 | 289 | return ($argref, $unsorted); | |||||||||||||||||||||||||||
| 603 | } | ||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||
| 605 | # _alt_construct_tester_1 prepares for _argument_checker_1 in | ||||||||||||||||||||||||||||
| 606 | # is_member_which is_member_which_ref is_member_any | ||||||||||||||||||||||||||||
| 607 | 276 | ▶ | sub _alt_construct_tester_1 { | ||||||||||||||||||||||||||
|
Subroutine
_alt_construct_tester_1: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||
| 608 | 276 | my @args = @_; | |||||||||||||||||||||||||||
| 609 | 276 | my ($argref); | |||||||||||||||||||||||||||
| 610 | 276 | ▶ | if (@args == 1 and (ref($args[0]) eq 'HASH')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@args == 1 and ref $args[0] eq "HASH"
MC/DC100%2/2
@args == 1 and ref $args[0] eq "HASH"
@args == 1
ref $args[0] eq "HASH"
Truth table100%3/3
A and B
A= @args == 1B= ref $args[0] eq "HASH"
| |||||||||||||||||||||||||||||
| 611 | 119 | my (@returns); | |||||||||||||||||||||||||||
| 612 | 119 | my $hashref = $args[0]; | |||||||||||||||||||||||||||
| 613 | croak "$bad_lists_msg: $!" | ||||||||||||||||||||||||||||
| 614 | 119 | unless ( ${$hashref}{'lists'} | |||||||||||||||||||||||||||
| 615 | 119 | ▶ | and (ref(${$hashref}{'lists'}) eq 'ARRAY') ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
do {
$hashref
}->{"lists"} and ref do {
$hashref
}->{"lists"} eq "ARRAY"
MC/DC100%2/2
do {
$hashref
}->{"lists"} and ref do {
$hashref
}->{"lists"} eq "ARRAY"
do {
$hashref
}->{"lists"}
ref do {
$hashref
}->{"lists"} eq "ARRAY"
Truth table100%3/3
A and B
A= do {
$hashref
}->{"lists"}B= ref do {
$hashref
}->{"lists"} eq "ARRAY"
| |||||||||||||||||||||||||||||
| 616 | croak "If argument is single hash ref, you must have an 'item' key: $!" | ||||||||||||||||||||||||||||
| 617 | 113 | ▶ | unless ${$hashref}{'item'}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 618 | 110 | @returns = ( ${$hashref}{'lists'}, [${$hashref}{'item'}] ); | |||||||||||||||||||||||||||
| 619 | 110 | $argref = \@returns; | |||||||||||||||||||||||||||
| 620 | } else { | ||||||||||||||||||||||||||||
| 621 | 157 | $argref = \@args; | |||||||||||||||||||||||||||
| 622 | } | ||||||||||||||||||||||||||||
| 623 | 267 | return $argref; | |||||||||||||||||||||||||||
| 624 | } | ||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||
| 626 | # _alt_construct_tester_2 prepares for _argument_checker_2 in | ||||||||||||||||||||||||||||
| 627 | # are_members_which are_members_any | ||||||||||||||||||||||||||||
| 628 | 26 | ▶ | sub _alt_construct_tester_2 { | ||||||||||||||||||||||||||
|
Subroutine
_alt_construct_tester_2: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||
| 629 | 26 | my @args = @_; | |||||||||||||||||||||||||||
| 630 | 26 | ▶ | if (@args == 1 and (ref($args[0]) eq 'HASH')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@args == 1 and ref $args[0] eq "HASH"
MC/DC100%2/2
@args == 1 and ref $args[0] eq "HASH"
@args == 1
ref $args[0] eq "HASH"
Truth table100%3/3
A and B
A= @args == 1B= ref $args[0] eq "HASH"
| |||||||||||||||||||||||||||||
| 631 | 16 | my $hashref = $args[0]; | |||||||||||||||||||||||||||
| 632 | croak "$bad_lists_msg: $!" | ||||||||||||||||||||||||||||
| 633 | 16 | unless ( ${$hashref}{'lists'} | |||||||||||||||||||||||||||
| 634 | 16 | ▶ | and (ref(${$hashref}{'lists'}) eq 'ARRAY') ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
do {
$hashref
}->{"lists"} and ref do {
$hashref
}->{"lists"} eq "ARRAY"
MC/DC100%2/2
do {
$hashref
}->{"lists"} and ref do {
$hashref
}->{"lists"} eq "ARRAY"
do {
$hashref
}->{"lists"}
ref do {
$hashref
}->{"lists"} eq "ARRAY"
Truth table100%3/3
A and B
A= do {
$hashref
}->{"lists"}B= ref do {
$hashref
}->{"lists"} eq "ARRAY"
| |||||||||||||||||||||||||||||
| 635 | croak "If argument is single hash ref, you must have an 'items' key whose value is an array ref: $!" | ||||||||||||||||||||||||||||
| 636 | 12 | unless ( ${$hashref}{'items'} | |||||||||||||||||||||||||||
| 637 | 12 | ▶ | and (ref(${$hashref}{'items'}) eq 'ARRAY') ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
do {
$hashref
}->{"items"} and ref do {
$hashref
}->{"items"} eq "ARRAY"
MC/DC100%2/2
do {
$hashref
}->{"items"} and ref do {
$hashref
}->{"items"} eq "ARRAY"
do {
$hashref
}->{"items"}
ref do {
$hashref
}->{"items"} eq "ARRAY"
Truth table100%3/3
A and B
A= do {
$hashref
}->{"items"}B= ref do {
$hashref
}->{"items"} eq "ARRAY"
| |||||||||||||||||||||||||||||
| 638 | 8 | return [ (${$hashref}{'lists'}, ${$hashref}{'items'}) ]; | |||||||||||||||||||||||||||
| 639 | } else { | ||||||||||||||||||||||||||||
| 640 | 10 | return \@args; | |||||||||||||||||||||||||||
| 641 | } | ||||||||||||||||||||||||||||
| 642 | } | ||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||
| 644 | # _alt_construct_tester_3 prepares for _argument_checker_3 in | ||||||||||||||||||||||||||||
| 645 | # get_unique get_complement | ||||||||||||||||||||||||||||
| 646 | 157 | ▶ | sub _alt_construct_tester_3 { | ||||||||||||||||||||||||||
|
Subroutine
_alt_construct_tester_3: called CC=9 SCAR=22.0
| |||||||||||||||||||||||||||||
| 647 | 157 | my @args = @_; | |||||||||||||||||||||||||||
| 648 | 157 | my ($argref, $unsorted); | |||||||||||||||||||||||||||
| 649 | 157 | ▶ | if (@args == 1 and (ref($args[0]) eq 'HASH')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@args == 1 and ref $args[0] eq "HASH"
MC/DC100%2/2
@args == 1 and ref $args[0] eq "HASH"
@args == 1
ref $args[0] eq "HASH"
Truth table100%3/3
A and B
A= @args == 1B= ref $args[0] eq "HASH"
| |||||||||||||||||||||||||||||
| 650 | 68 | my (@returns); | |||||||||||||||||||||||||||
| 651 | 68 | my $hashref = $args[0]; | |||||||||||||||||||||||||||
| 652 | croak "$bad_lists_msg: $!" | ||||||||||||||||||||||||||||
| 653 | 68 | unless ( ${$hashref}{'lists'} | |||||||||||||||||||||||||||
| 654 | 68 | ▶ | and (ref(${$hashref}{'lists'}) eq 'ARRAY') ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
do {
$hashref
}->{"lists"} and ref do {
$hashref
}->{"lists"} eq "ARRAY"
MC/DC100%2/2
do {
$hashref
}->{"lists"} and ref do {
$hashref
}->{"lists"} eq "ARRAY"
do {
$hashref
}->{"lists"}
ref do {
$hashref
}->{"lists"} eq "ARRAY"
Truth table100%3/3
A and B
A= do {
$hashref
}->{"lists"}B= ref do {
$hashref
}->{"lists"} eq "ARRAY"
| |||||||||||||||||||||||||||||
| 655 | 60 | @returns = defined ${$hashref}{'item'} | |||||||||||||||||||||||||||
| 656 | 16 | ? (${$hashref}{'lists'}, [${$hashref}{'item'}]) | |||||||||||||||||||||||||||
| 657 | 60 | ▶ | : (${$hashref}{'lists'}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 658 | 60 | $argref = \@returns; | |||||||||||||||||||||||||||
| 659 | 60 | ▶ | $unsorted = ${$hashref}{'unsorted'} ? 1 : ''; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 660 | } else { | ||||||||||||||||||||||||||||
| 661 | 89 | ▶ | $unsorted = shift(@args) if ($args[0] eq '-u' or $args[0] eq '--unsorted'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$args[0] eq "-u" or $args[0] eq "--unsorted"
MC/DC100%2/2
$args[0] eq "-u" or $args[0] eq "--unsorted"
$args[0] eq "-u"
$args[0] eq "--unsorted"
Truth table100%3/3
A or B
A= $args[0] eq "-u"B= $args[0] eq "--unsorted"
| |||||||||||||||||||||||||||||
| 662 | 89 | $argref = \@args; | |||||||||||||||||||||||||||
| 663 | } | ||||||||||||||||||||||||||||
| 664 | 149 | return ($argref, $unsorted); | |||||||||||||||||||||||||||
| 665 | } | ||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||
| 667 | # _alt_construct_tester_4 prepares for _argument_checker_4 in | ||||||||||||||||||||||||||||
| 668 | # is_LsubsetR is_RsubsetL is_LequivalentR is_LdisjointR | ||||||||||||||||||||||||||||
| 669 | 146 | ▶ | sub _alt_construct_tester_4 { | ||||||||||||||||||||||||||
|
Subroutine
_alt_construct_tester_4: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||
| 670 | 146 | my @args = @_; | |||||||||||||||||||||||||||
| 671 | 146 | my ($argref); | |||||||||||||||||||||||||||
| 672 | 146 | ▶ | if (@args == 1 and (ref($args[0]) eq 'HASH')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@args == 1 and ref $args[0] eq "HASH"
MC/DC100%2/2
@args == 1 and ref $args[0] eq "HASH"
@args == 1
ref $args[0] eq "HASH"
Truth table100%3/3
A and B
A= @args == 1B= ref $args[0] eq "HASH"
| |||||||||||||||||||||||||||||
| 673 | 70 | my (@returns); | |||||||||||||||||||||||||||
| 674 | 70 | my $hashref = $args[0]; | |||||||||||||||||||||||||||
| 675 | croak "$bad_lists_msg: $!" | ||||||||||||||||||||||||||||
| 676 | 70 | unless ( ${$hashref}{'lists'} | |||||||||||||||||||||||||||
| 677 | 70 | ▶ | and (ref(${$hashref}{'lists'}) eq 'ARRAY') ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
do {
$hashref
}->{"lists"} and ref do {
$hashref
}->{"lists"} eq "ARRAY"
MC/DC100%2/2
do {
$hashref
}->{"lists"} and ref do {
$hashref
}->{"lists"} eq "ARRAY"
do {
$hashref
}->{"lists"}
ref do {
$hashref
}->{"lists"} eq "ARRAY"
Truth table100%3/3
A and B
A= do {
$hashref
}->{"lists"}B= ref do {
$hashref
}->{"lists"} eq "ARRAY"
| |||||||||||||||||||||||||||||
| 678 | 60 | @returns = defined ${$hashref}{'pair'} | |||||||||||||||||||||||||||
| 679 | 18 | ? (${$hashref}{'lists'}, ${$hashref}{'pair'}) | |||||||||||||||||||||||||||
| 680 | 60 | ▶ | : (${$hashref}{'lists'}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 681 | 60 | $argref = \@returns; | |||||||||||||||||||||||||||
| 682 | } else { | ||||||||||||||||||||||||||||
| 683 | 76 | $argref = \@args; | |||||||||||||||||||||||||||
| 684 | } | ||||||||||||||||||||||||||||
| 685 | 136 | return $argref; | |||||||||||||||||||||||||||
| 686 | } | ||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||
| 688 | # _alt_construct_tester_5 prepares for _argument_checker in | ||||||||||||||||||||||||||||
| 689 | # print_subset_chart print_equivalence_chart | ||||||||||||||||||||||||||||
| 690 | 22 | ▶ | sub _alt_construct_tester_5 { | ||||||||||||||||||||||||||
|
Subroutine
_alt_construct_tester_5: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||
| 691 | 22 | my @args = @_; | |||||||||||||||||||||||||||
| 692 | 22 | my ($argref); | |||||||||||||||||||||||||||
| 693 | 22 | ▶ | if (@args == 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 694 | 20 | ▶ | if (ref($args[0]) eq 'HASH') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 695 | 12 | my $hashref = shift; | |||||||||||||||||||||||||||
| 696 | croak "Need to define 'lists' key properly: $!" | ||||||||||||||||||||||||||||
| 697 | 12 | unless ( ${$hashref}{'lists'} | |||||||||||||||||||||||||||
| 698 | 12 | ▶ | and (ref(${$hashref}{'lists'}) eq 'ARRAY') ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
do {
$hashref
}->{"lists"} and ref do {
$hashref
}->{"lists"} eq "ARRAY"
MC/DC100%2/2
do {
$hashref
}->{"lists"} and ref do {
$hashref
}->{"lists"} eq "ARRAY"
do {
$hashref
}->{"lists"}
ref do {
$hashref
}->{"lists"} eq "ARRAY"
Truth table100%3/3
A and B
A= do {
$hashref
}->{"lists"}B= ref do {
$hashref
}->{"lists"} eq "ARRAY"
| |||||||||||||||||||||||||||||
| 699 | 8 | $argref = ${$hashref}{'lists'}; | |||||||||||||||||||||||||||
| 700 | } else { | ||||||||||||||||||||||||||||
| 701 | 8 | $argref = shift(@args); | |||||||||||||||||||||||||||
| 702 | } | ||||||||||||||||||||||||||||
| 703 | } else { | ||||||||||||||||||||||||||||
| 704 | 2 | croak "Subroutine call requires exactly 1 reference as argument: $!"; | |||||||||||||||||||||||||||
| 705 | } | ||||||||||||||||||||||||||||
| 706 | 16 | return $argref; | |||||||||||||||||||||||||||
| 707 | } | ||||||||||||||||||||||||||||
| 708 | |||||||||||||||||||||||||||||
| 709 | 52 | 1; | |||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||
| 711 | __END__ | ||||||||||||||||||||||||||||