lib/List/Parseable.pm

filter: Statementstmt 72.9% 589 / 807 Branchbran 66.8% 524 / 784 Conditioncond 38.6% 138 / 357 MC/DCmcdc 21.5% 40 / 186 Subroutinesub 90.4% 19 / 21 Podpod 100% 7 / 7 totaltotal 60.9% 1317 / 2162 CC 558 SCAR 92.5
CC
558
Cov
64%
_operation
12043.6
errors
90.0
_isnum
44.9
CRAP 10380.2
↑ Summary
1 package List::Parseable;
2 # Copyright (c) 2008-2010 Sullivan Beck. All rights reserved.
3 # This program is free software; you can redistribute it and/or modify it
4 # under the same terms as Perl itself.
5  
6 ########################################################################
7 # TODO
8 ########################################################################
9  
10 # (type TYPE ELE0 ELE1 ...) extracts elements of the given TYPE
11 # (istype TYPE ELE0 ELE1 ...) true of all elements are of the given TYPE
12  
13 ########################################################################
14  
15 4 require 5.000;
16 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 4 ▶use Text::Balanced qw(extract_bracketed extract_tagged);
Subroutine BEGIN: called CC=1 SCAR=0.0
18 4 ▶use Sort::DataTypes 3.00 qw(sort_valid_method sort_by_method);
Subroutine BEGIN: called CC=1 SCAR=0.0
19 4 ▶use Storable qw(dclone);
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 4 our($VERSION);
23 4 $VERSION = "1.06";
24  
25 ########################################################################
26 # METHODS
27 ########################################################################
28  
29 146 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
30 146 my($class,%opts) = @_;
31  
32 146 my $self = { "err" => "ignore",
33 "warn" => "quiet"
34 };
35 146 bless $self,$class;
36  
37 146 return $self;
38 }
39  
40 0 ▶sub version {
Subroutine version: not called CC=1 SCAR=6.9
Pod documented
41 0 return $List::Parseable::VERSION;
42 }
43  
44 # $self = { err => exit|return|ignore
45 # warn => stdout|stderr|both|quiet
46 # }
47 #
48 0 ▶sub errors {
Subroutine errors: not called CC=9 SCAR=45.0
Pod documented
49 0 my($self,@opts) = @_;
50 0 foreach my $opt (@opts) {
51 0 ▶ if ($opt eq "exit" ||
Branch: 2 branches
BranchTrueFalseTotal
if ($opt eq 'exit' or $opt eq 'return' or $opt eq 'ignore') { } 0 0 0
elsif ($opt eq 'stderr' or $opt eq 'stdout' or $opt eq 'both' or $opt eq 'quiet') { } 0 0 0
Condition0%0/6
$opt eq "exit" or $opt eq "return" or $opt eq "ignore"
l!l&&r!l&&!r
000
$opt eq "exit" or $opt eq "return"
l!l&&r!l&&!r
000
MC/DC0%0/3
$opt eq "exit" or $opt eq "return" or $opt eq "ignore"
$opt eq "exit" $opt eq "return" $opt eq "ignore"
Truth table0%0/4
A or B or C
A= $opt eq "exit"B= $opt eq "return"C= $opt eq "ignore"
ABCresult
1XX1
01X1
0011
0000
52 $opt eq "return" ||
53 $opt eq "ignore") {
54 0 $$self{"err"} = $opt;
55  
56 ▶ } elsif ($opt eq "stderr" ||
Condition0%0/9
$opt eq "stderr" or $opt eq "stdout" or $opt eq "both" or $opt eq "quiet"
l!l&&r!l&&!r
000
$opt eq "stderr" or $opt eq "stdout" or $opt eq "both"
l!l&&r!l&&!r
000
$opt eq "stderr" or $opt eq "stdout"
l!l&&r!l&&!r
000
MC/DC0%0/4
$opt eq "stderr" or $opt eq "stdout" or $opt eq "both" or $opt eq "quiet"
$opt eq "stderr" $opt eq "stdout" $opt eq "both" $opt eq "quiet"
Truth table0%0/5
A or B or C or D
A= $opt eq "stderr"B= $opt eq "stdout"C= $opt eq "both"D= $opt eq "quiet"
ABCDresult
1XXX1
01XX1
001X1
00011
00000
57 $opt eq "stdout" ||
58 $opt eq "both" ||
59 $opt eq "quiet") {
60 0 $$self{"warn"} = $opt;
61  
62 } else {
63 0 die "ERROR: invalid error option: $opt\n";
64 }
65 }
66 }
67  
68 8 ▶sub list {
Subroutine list: called CC=1 SCAR=0.0
Pod documented
69 8 my($self,$name,@list) = @_;
70 8 $$self{"list"}{$name} = [ @list ];
71 }
72  
73 166 ▶sub string {
Subroutine string: called CC=1 SCAR=0.0
Pod documented
74 166 my($self,$name,$string) = @_;
75 166 my @list = _string($string);
76 166 $$self{"list"}{$name} = [ @list ];
77 }
78  
79 174 ▶sub eval {
Subroutine eval: called CC=1 SCAR=0.0
Pod documented
80 174 my($self,$name) = @_;
81 174 return _eval($self,@{ $$self{"list"}{$name} });
82 }
83  
84 1 ▶sub vars {
Subroutine vars: called CC=2 SCAR=6.9
Pod documented
85 1 my($self,%hash) = @_;
86 1 foreach my $var (keys %hash) {
87 8 $$self{"vars"}{$var} = $hash{$var};
88 }
89 }
90  
91 ########################################################################
92 # LIST PARSING
93 ########################################################################
94  
95 244 ▶sub _eval {
Subroutine _eval: called CC=8 SCAR=20.8
96 244 my($self,@list) = @_;
97  
98 # Step 1 - parse all children
99  
100 244 my @tmp;
101 244 foreach my $ele (@list) {
102 956 ▶ if (ref($ele) eq "ARRAY") {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $ele eq 'ARRAY') { } 70 886 956
elsif (ref $ele) { } 0 886 886
103 70 push(@tmp,_eval($self,@$ele));
104 } elsif (ref($ele)) {
105 0 die "ERROR: invalid list element";
106 } else {
107 886 push(@tmp,$ele);
108 }
109 }
110 244 @list = @tmp;
111  
112 # Step 2 - separate the list into operations and arguments
113  
114 244 my(@ops,@args);
115 244 ▶ while (@list) {
Branch: 1 branch
BranchTrueFalseTotal
if (@list) 468 1 469
116 468 my $ele = shift(@list);
117  
118 468 ▶ if (_operation($self,1,$ele)) {
Branch: 2 branches
BranchTrueFalseTotal
if (_operation($self, 1, $ele)) { } 225 243 468
elsif ($ele eq '--') { } 1 242 243
119 225 push(@ops,$ele);
120  
121 } elsif ($ele eq "--") {
122 1 @args = @list;
123 1 last;
124  
125 } else {
126 242 @args = ($ele,@list);
127 242 last;
128 }
129 }
130  
131 # Step 3 - perform operations
132  
133 244 ▶ while (@ops) {
Branch: 1 branch
BranchTrueFalseTotal
if (@ops) 225 244 469
134 225 my $op = pop(@ops);
135 225 @args = _operation($self,0,$op,@args);
136 }
137 244 return @args;
138 }
139  
140 ########################################################################
141 # STRING PARSING
142 ########################################################################
143  
144 # This parses a string which must contain a single list (though other
145 # lists may be nested inside it).
146 #
147 227 ▶sub _string {
Subroutine _string: called CC=15 SCAR=34.1
148 227 my($string) = @_;
149 227 my(@list);
150  
151 227 ▶ while ($string) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string) 227 227 454
152 227 ▶ next if ($string =~ s/^\s+//);
Branch: 1 branch
BranchTrueFalseTotal
if $string =~ s/^\s+// 0 227 227
153  
154 # Test to make sure that the string consists only of a single list
155 # and nothing else.
156 #
157 # string = "(: (- a-b):foo:bar )"
158 #
159 # match = "(- a-b):foo:bar"
160 # remainder = ""
161 # eledelim = ":"
162  
163 227 my($match,$remainder,$eledelim,$nestedchar) = __string_list($string,1);
164 227 ▶ if ($match eq "") {
Branch: 1 branch
BranchTrueFalseTotal
if ($match eq "") 0 227 227
165 0 die "ERROR: invalid list string (no list delimiter):\n $string";
166 }
167 227 ▶ if ($remainder ne "") {
Branch: 1 branch
BranchTrueFalseTotal
if ($remainder ne "") 0 227 227
168 0 die "ERROR: invalid list string (remainder):\n $string";
169 }
170 227 $string = "";
171  
172 # Each element in the list is either a nested list or a scalar element.
173  
174 227 ▶ while ($match ne "") {
Branch: 1 branch
BranchTrueFalseTotal
if ($match ne "") 915 227 1142
175 915 my($m,$r,$d,$n) = ("","","","");
176 915 ▶ ($m,$r,$d,$n) = __string_list($match,0) if (! $nestedchar);
Branch: 1 branch
BranchTrueFalseTotal
unless $nestedchar 909 6 915
177  
178 915 ▶ if ($m ne "") {
Branch: 1 branch
BranchTrueFalseTotal
if ($m ne '') { } 61 854 915
179  
180 # match = "(- a-b ):foo:bar"
181 #
182 # m = "(- a-b )"
183 # r = ":foo:bar"
184 # d = "-"
185  
186 61 ▶ if ($r && $eledelim && $r !~ s/^\Q$eledelim\E//) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r and $eledelim and not $r =~ s/^\Q$eledelim\E//) 0 61 61
Condition50%3/6
$r and $eledelim and not $r =~ s/^\Q$eledelim\E//
!ll&&!rl&&r
6100
$r and $eledelim
!ll&&!rl&&r
23380
MC/DC0%0/3
$r and $eledelim and not $r =~ s/^\Q$eledelim\E//
$r $eledelim not $r =~ s/^\Q$eledelim\E//
Truth table50%2/4
A and B and not(C)
A= $rB= $eledelimC= not $r =~ s/^\Q$eledelim\E//
ABCresult
0XX0
10X0
1100
1111
187 0 die "ERROR: invalid element contains list and scalar:\n $string\n";
188 }
189 61 push(@list,[ _string($m) ]);
190 61 $match = $r;
191  
192 # r = "foo:bar"
193 # @list = (... [ a, b ])
194 # match = "foo:bar"
195  
196 } else {
197  
198 # match = "foo:bar"
199  
200 854 ▶ if ($eledelim) {
Branch: 1 branch
BranchTrueFalseTotal
if ($eledelim) { } 0 854 854
201 0 ▶ if ($match =~ s/^(.*?)\Q$eledelim\E//) {
Branch: 1 branch
BranchTrueFalseTotal
if ($match =~ s/^(.*?)\Q$eledelim\E//) { } 0 0 0
202 0 my $val = $1;
203 0 ▶ $val = "" if (! defined $val);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $val 0 0 0
204 0 push(@list,$val);
205 0 ▶ push(@list,"") if ($match eq "");
Branch: 1 branch
BranchTrueFalseTotal
if $match eq "" 0 0 0
206 } else {
207 0 push(@list,$match);
208 0 $match = "";
209 }
210  
211 } else {
212 854 $match =~ s/(\S+)\s*//;
213 854 push(@list,$1);
214 }
215 }
216 }
217 }
218  
219 227 return @list;
220 }
221  
222 # Finds a list at the start of the string. Extracts it, removes the
223 # list delimiter (and optional element delimiter), and removes the
224 # list delimiters from the start and end of the extracted string. It
225 # returns:
226 #
227 # a string containing the list
228 # the rest (if any) of the string
229 # the element delimiter
230 # any special character (\) following the list delimiter
231 #
232 1136 ▶sub __string_list {
Subroutine __string_list: called CC=6 SCAR=18.0
233 1136 my($string,$strip) = @_;
234 1136 my($delim,$nested,$eledelim);
235  
236 1136 ▶ if ($string =~ /^\s*([\050\133\173])(\134)?([[:punct:]]\S*)?/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ /^\s*([\050\133\173])(\134)?([[:punct:]]\S*)?/) { } 288 848 1136
237  
238 288 my($delim,$nested,$eledelim) = ($1,$2,$3);
239 288 ▶ $nested = "" if (! $nested);
Branch: 1 branch
BranchTrueFalseTotal
unless $nested 286 2 288
240 288 ▶ $eledelim = "" if (! $eledelim);
Branch: 1 branch
BranchTrueFalseTotal
unless $eledelim 288 0 288
241 288 $string =~ s/^\s+//;
242 288 my($match,$remainder) = extract_bracketed($string,$delim);
243 288 ▶ if (! defined $match) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $match) 0 288 288
244 0 die "ERROR: invalid list string (incomplete list):\n $string";
245 }
246 288 $remainder =~ s/^\s+//;
247  
248 288 ▶ if ($strip) {
Branch: 1 branch
BranchTrueFalseTotal
if ($strip) 227 61 288
249 227 $match =~ s/^\Q$delim$nested$eledelim\E\s*//;
250 227 $match =~ s/\s*.$//;
251 }
252  
253 288 return($match,$remainder,$eledelim,$nested);
254  
255 } else {
256 848 return ("");
257 }
258 }
259  
260 ########################################################################
261 # OPERATIONS
262 ########################################################################
263  
264 709 ▶sub _operation {
Subroutine _operation: called CC=498 SCAR=94.0
265 709 my($self,$test,$op,@args) = @_;
266  
267 #
268 # Meta operations
269 #
270  
271 709 ▶ if ($op eq "scalar") {
Branch: 2 branches
BranchTrueFalseTotal
if ($op eq 'scalar') { } 4 705 709
elsif ($op eq 'list') { } 106 599 705
272 4 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 2 2 4
273 2 return @args;
274  
275 } elsif ($op eq "list") {
276 106 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 53 53 106
277 53 return [ @args ];
278 }
279  
280 #
281 # List => scalar operations
282 #
283  
284 599 ▶ if ($op eq "count") {
Branch: 11 branches
BranchTrueFalseTotal
if ($op eq 'count') { } 12 587 599
elsif ($op eq 'countval') { } 0 587 587
elsif ($op eq 'minval') { } 8 579 587
elsif ($op eq 'maxval') { } 2 577 579
elsif ($op eq 'nth') { } 10 567 577
elsif ($op eq 'case') { } 12 555 567
elsif ($op eq 'indexval') { } 4 551 555
elsif ($op eq 'rindexval') { } 4 547 551
elsif ($op eq 'join') { } 4 543 547
elsif ($op eq '+' or $op eq '*') { } 6 537 543
elsif ($op eq '-' or $op eq '/') { } 4 533 537
285 12 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 6 6 12
286 6 return $#args+1;
287  
288 } elsif ($op eq "countval") {
289 0 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 0 0 0
290 0 my $i = 0;
291 0 my $val = shift(@args);
292 0 foreach my $ele (@args) {
293 0 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) { } 0 0 0
294 0 ▶ return undef if (_error($self,$op,$ele));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $ele) 0 0 0
295 } else {
296 0 ▶ $i++ if ($val eq $ele);
Branch: 1 branch
BranchTrueFalseTotal
if $val eq $ele 0 0 0
297 }
298 }
299 0 return $i;
300  
301 } elsif ($op eq "minval") {
302 8 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 1 7 8
303 7 my $min = $args[0];
304 7 foreach my $val (@args) {
305 15 ▶ if (ref($val)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $val) { } 0 15 15
306 0 ▶ return undef if (_error($self,$op,$val));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $val) 0 0 0
307 } else {
308 15 ▶ $min = $val if ($val < $min);
Branch: 1 branch
BranchTrueFalseTotal
if $val < $min 0 15 15
309 }
310 }
311 7 return $min;
312  
313 } elsif ($op eq "maxval") {
314 2 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 1 1 2
315 1 my $max = $args[0];
316 1 foreach my $val (@args) {
317 3 ▶ if (ref($val)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $val) { } 0 3 3
318 0 ▶ return undef if (_error($self,$op,$val));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $val) 0 0 0
319 } else {
320 3 ▶ $max = $val if ($val > $max);
Branch: 1 branch
BranchTrueFalseTotal
if $val > $max 2 1 3
321 }
322 }
323 1 return $max;
324  
325 } elsif ($op eq "nth") {
326 10 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 5 5 10
327 5 my $n = shift(@args);
328 5 ▶ if (ref($n) ||
Branch: 1 branch
BranchTrueFalseTotal
if (ref $n or not $n =~ /^[-+]?\d+$/ or not _valid_index($n, $#args)) { } 1 4 5
Condition50%3/6
ref $n or not $n =~ /^[-+]?\d+$/ or not _valid_index($n, $#args)
l!l&&r!l&&!r
014
ref $n or not $n =~ /^[-+]?\d+$/
l!l&&r!l&&!r
005
MC/DC33%1/3
ref $n or not $n =~ /^[-+]?\d+$/ or not _valid_index($n, $#args)
ref $n not $n =~ /^[-+]?\d+$/ not _valid_index($n, $#args)
Truth table50%2/4
A or not(B) or not(C)
A= ref $nB= not $n =~ /^[-+]?\d+$/C= not _valid_index($n, $#args)
ABCresult
1XX1
01X1
0011
0000
329 $n !~ /^[-+]?\d+$/ ||
330 ! _valid_index($n,$#args)) {
331 1 _error($self,$op,$n);
332 1 return undef;
333 } else {
334 4 return $args[$n];
335 }
336  
337 } elsif ($op eq "case") {
338 12 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 6 6 12
339  
340 6 ▶ while ($#args > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($#args > 0) 14 2 16
341 14 my $test = shift(@args);
342 14 my $val = shift(@args);
343 14 ▶ if (ref($test)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $test) 0 14 14
344 0 _error($self,$op,$test);
345 0 return undef;
346 }
347 14 ▶ return $val if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 4 10 14
348 }
349 2 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 1 1 2
350 1 return $args[0];
351 }
352 1 return ();
353  
354 } elsif ($op eq "indexval") {
355 4 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 2 2 4
356 2 my $val = shift(@args);
357 2 ▶ if (ref($val)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $val) 0 2 2
358 0 _error($self,$op,$val);
359 0 return undef;
360 }
361 2 ▶ for (my $i=0; $i<=$#args; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#args) 7 1 8
362 7 ▶ return $i if (! ref($args[$i]) && $args[$i] eq $val);
Branch: 1 branch
BranchTrueFalseTotal
if not ref $args[$i] and $args[$i] eq $val 1 6 7
Condition66%2/3
not ref $args[$i] and $args[$i] eq $val
!ll&&!rl&&r
061
MC/DC50%1/2
not ref $args[$i] and $args[$i] eq $val
not ref $args[$i] $args[$i] eq $val
Truth table66%2/3
not(A) and B
A= not ref $args[$i]B= $args[$i] eq $val
ABresult
0X0
100
111
363 }
364 1 return -1;
365  
366 } elsif ($op eq "rindexval") {
367 4 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 2 2 4
368 2 my $val = shift(@args);
369 2 ▶ if (ref($val)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $val) 0 2 2
370 0 _error($self,$op,$val);
371 0 return undef;
372 }
373 2 ▶ for (my $i=$#args; $i>=0; $i--) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i >= 0) 7 1 8
374 7 ▶ return $i if (! ref($args[$i]) && $args[$i] eq $val);
Branch: 1 branch
BranchTrueFalseTotal
if not ref $args[$i] and $args[$i] eq $val 1 6 7
Condition66%2/3
not ref $args[$i] and $args[$i] eq $val
!ll&&!rl&&r
061
MC/DC50%1/2
not ref $args[$i] and $args[$i] eq $val
not ref $args[$i] $args[$i] eq $val
Truth table66%2/3
not(A) and B
A= not ref $args[$i]B= $args[$i] eq $val
ABresult
0X0
100
111
375 }
376 1 return -1;
377  
378 } elsif ($op eq "join") {
379 4 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 2 2 4
380 2 my $delim;
381 2 ▶ if ($args[0] eq "delim") {
Branch: 1 branch
BranchTrueFalseTotal
if ($args[0] eq 'delim') { } 1 1 2
382 1 shift(@args);
383 1 $delim = shift(@args);
384 1 ▶ if ($delim eq "_space_") {
Branch: 4 branches
BranchTrueFalseTotal
if ($delim eq '_space_') { } 0 1 1
elsif ($delim eq '_null_') { } 0 1 1
elsif ($delim eq '_tab_') { } 0 1 1
elsif ($delim eq '_nl_') { } 0 1 1
385 0 $delim = " ";
386 } elsif ($delim eq "_null_") {
387 0 $delim = "";
388 } elsif ($delim eq "_tab_") {
389 0 $delim = "\t";
390 } elsif ($delim eq "_nl_") {
391 0 $delim = "\n";
392 }
393 } else {
394 1 $delim = " ";
395 }
396  
397 2 my @list;
398 2 foreach my $ele (@args) {
399 6 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) { } 0 6 6
400 0 ▶ return undef if (_error($self,$op,$ele));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $ele) 0 0 0
401 } else {
402 6 push(@list,$ele);
403 }
404 }
405 2 return join($delim,@list);
406  
407 ▶ } elsif ($op eq "+" || $op eq "*") {
Condition100%3/3
$op eq "+" or $op eq "*"
l!l&&r!l&&!r
42537
MC/DC100%2/2
$op eq "+" or $op eq "*"
$op eq "+" $op eq "*"
Truth table100%3/3
A or B
A= $op eq "+"B= $op eq "*"
ABresult
1X1
011
000
408 6 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 3 3 6
409 3 ▶ my $ret = ($op eq "+" ? 0 : 1);
Branch: 1 branch
BranchTrueFalseTotal
$op eq '+' ? : 2 1 3
410 3 foreach my $ele (@args) {
411 9 ▶ if (ref($ele) ||
Branch: 2 branches
BranchTrueFalseTotal
if (ref $ele or not _isnum($ele)) { } 0 9 9
elsif ($op eq '+') { } 6 3 9
Condition33%1/3
ref $ele or not _isnum($ele)
l!l&&r!l&&!r
009
MC/DC0%0/2
ref $ele or not _isnum($ele)
ref $ele not _isnum($ele)
Truth table33%1/3
A or not(B)
A= ref $eleB= not _isnum($ele)
ABresult
1X1
011
000
412 ! _isnum($ele)) {
413 0 ▶ return undef if (_error($self,$op,$ele));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $ele) 0 0 0
414 } elsif ($op eq "+") {
415 6 $ret += $ele;
416 } else {
417 3 $ret *= $ele;
418 }
419 }
420 3 return $ret;
421  
422 ▶ } elsif ($op eq "-" || $op eq "/") {
Condition100%3/3
$op eq "-" or $op eq "/"
l!l&&r!l&&!r
22533
MC/DC100%2/2
$op eq "-" or $op eq "/"
$op eq "-" $op eq "/"
Truth table100%3/3
A or B
A= $op eq "-"B= $op eq "/"
ABresult
1X1
011
000
423 4 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 2 2 4
424 2 ▶ if ($#args != 1 ||
Branch: 1 branch
BranchTrueFalseTotal
if ($#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0]) or not _isnum($args[1])) 0 2 2
Condition33%4/12
$#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0]) or not _isnum($args[1])
l!l&&r!l&&!r
002
$#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0])
l!l&&r!l&&!r
002
$#args != 1 or ref $args[0] or ref $args[1]
l!l&&r!l&&!r
002
$#args != 1 or ref $args[0]
l!l&&r!l&&!r
002
MC/DC0%0/5
$#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0]) or not _isnum($args[1])
$#args != 1 ref $args[0] ref $args[1] not _isnum($args[0]) not _isnum($args[1])
Truth table16%1/6
A or B or C or not(D) or not(E)
A= $#args != 1B= ref $args[0]C= ref $args[1]D= not _isnum($args[0])E= not _isnum($args[1])
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
425 ref($args[0]) ||
426 ref($args[1]) ||
427 ! _isnum($args[0]) ||
428 ! _isnum($args[1])) {
429 0 _error($self,$op,\@args);
430 0 return undef;
431 }
432 2 ▶ if ($op eq "-") {
Branch: 1 branch
BranchTrueFalseTotal
if ($op eq '-') { } 1 1 2
433 1 return $args[0] - $args[1];
434 } else {
435 1 ▶ if ($args[1] == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args[1] == 0) 0 1 1
436 0 _error($self,$op,$args[1]);
437 0 return undef;
438 }
439 1 return $args[0] / $args[1];
440 }
441 }
442  
443 #
444 # List => boolean operations
445 #
446  
447 533 ▶ if ($op eq "mintrue") {
Branch: 28 branches
BranchTrueFalseTotal
if ($op eq 'mintrue') { } 9 524 533
elsif ($op eq 'maxtrue') { } 8 516 524
elsif ($op eq 'numtrue') { } 6 510 516
elsif ($op eq 'minfalse') { } 6 504 510
elsif ($op eq 'maxfalse') { } 9 495 504
elsif ($op eq 'numfalse') { } 6 489 495
elsif ($op eq 'and') { } 6 483 489
elsif ($op eq 'or') { } 6 477 483
elsif ($op eq 'not') { } 4 473 477
elsif ($op eq 'member') { } 4 469 473
elsif ($op eq 'absent') { } 4 465 469
elsif ($op eq '>') { } 2 463 465
elsif ($op eq '>=') { } 0 463 463
elsif ($op eq '==') { } 0 463 463
elsif ($op eq '<=') { } 0 463 463
elsif ($op eq '<') { } 2 461 463
elsif ($op eq '!=') { } 0 461 461
elsif ($op eq 'gt') { } 2 459 461
elsif ($op eq 'ge') { } 0 459 459
elsif ($op eq 'eq') { } 0 459 459
elsif ($op eq 'le') { } 0 459 459
elsif ($op eq 'lt') { } 2 457 459
elsif ($op eq 'ne') { } 0 457 457
elsif ($op eq 'if') { } 12 445 457
elsif ($op eq 'is_equal') { } 4 441 445
elsif ($op eq 'not_equal') { } 0 441 441
elsif ($op eq 'iff') { } 6 435 441
elsif ($op eq 'range' or $op eq 'rangeL' or $op eq 'rangeR' or $op eq 'rangeLR') { } 40 395 435
448 9 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 3 6 9
449 6 my $n = shift(@args);
450 6 my $i = 0;
451 6 foreach my $ele (@args) {
452 21 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) { } 0 21 21
453 0 ▶ return undef if (_error($self,$op,$ele));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $ele) 0 0 0
454 } else {
455 21 ▶ $i++ if ($ele);
Branch: 1 branch
BranchTrueFalseTotal
if $ele 11 10 21
456 }
457 }
458 6 ▶ return 1 if ($i >= $n);
Branch: 1 branch
BranchTrueFalseTotal
if $i >= $n 4 2 6
459 2 return 0;
460  
461 } elsif ($op eq "maxtrue") {
462 8 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 3 5 8
463 5 my $n = shift(@args);
464 5 my $i = 0;
465 5 foreach my $ele (@args) {
466 18 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) { } 0 18 18
467 0 ▶ return undef if (_error($self,$op,$ele));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $ele) 0 0 0
468 } else {
469 18 ▶ $i++ if ($ele);
Branch: 1 branch
BranchTrueFalseTotal
if $ele 8 10 18
470 }
471 }
472 5 ▶ return 1 if ($i <= $n);
Branch: 1 branch
BranchTrueFalseTotal
if $i <= $n 3 2 5
473 2 return 0;
474  
475 } elsif ($op eq "numtrue") {
476 6 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 3 3 6
477 3 my $n = shift(@args);
478 3 my $i = 0;
479 3 foreach my $ele (@args) {
480 12 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) { } 0 12 12
481 0 ▶ return undef if (_error($self,$op,$ele));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $ele) 0 0 0
482 } else {
483 12 ▶ $i++ if ($ele);
Branch: 1 branch
BranchTrueFalseTotal
if $ele 6 6 12
484 }
485 }
486 3 ▶ return 1 if ($i == $n);
Branch: 1 branch
BranchTrueFalseTotal
if $i == $n 1 2 3
487 2 return 0;
488  
489 } elsif ($op eq "minfalse") {
490 6 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 3 3 6
491 3 my $n = shift(@args);
492 3 my $i = 0;
493 3 foreach my $ele (@args) {
494 12 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) { } 0 12 12
495 0 ▶ return undef if (_error($self,$op,$ele));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $ele) 0 0 0
496 } else {
497 12 ▶ $i++ if (! $ele);
Branch: 1 branch
BranchTrueFalseTotal
unless $ele 6 6 12
498 }
499 }
500 3 ▶ return 1 if ($i >= $n);
Branch: 1 branch
BranchTrueFalseTotal
if $i >= $n 2 1 3
501 1 return 0;
502  
503 } elsif ($op eq "maxfalse") {
504 9 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 3 6 9
505 6 my $n = shift(@args);
506 6 my $i = 0;
507 6 foreach my $ele (@args) {
508 21 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) { } 0 21 21
509 0 ▶ return undef if (_error($self,$op,$ele));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $ele) 0 0 0
510 } else {
511 21 ▶ $i++ if (! $ele);
Branch: 1 branch
BranchTrueFalseTotal
unless $ele 10 11 21
512 }
513 }
514 6 ▶ return 1 if ($i <= $n);
Branch: 1 branch
BranchTrueFalseTotal
if $i <= $n 3 3 6
515 3 return 0;
516  
517 } elsif ($op eq "numfalse") {
518 6 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 3 3 6
519 3 my $n = shift(@args);
520 3 my $i = 0;
521 3 foreach my $ele (@args) {
522 12 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) { } 0 12 12
523 0 ▶ return undef if (_error($self,$op,$ele));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $ele) 0 0 0
524 } else {
525 12 ▶ $i++ if (! $ele);
Branch: 1 branch
BranchTrueFalseTotal
unless $ele 6 6 12
526 }
527 }
528 3 ▶ return 1 if ($i == $n);
Branch: 1 branch
BranchTrueFalseTotal
if $i == $n 1 2 3
529 2 return 0;
530  
531 } elsif ($op eq "and") {
532 6 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 3 3 6
533 3 return _operation($self,0,"maxfalse",0,@args);
534  
535 } elsif ($op eq "or") {
536 6 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 3 3 6
537 3 return _operation($self,0,"mintrue",1,@args);
538  
539 } elsif ($op eq "not") {
540 4 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 2 2 4
541 2 return _operation($self,0,"maxtrue",0,@args);
542  
543 } elsif ($op eq "member") {
544 4 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 2 2 4
545 2 my $val = shift(@args);
546 2 ▶ if (ref($val)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $val) 0 2 2
547 0 _error($self,$op,$val);
548 0 return undef;
549 }
550 2 foreach my $ele (@args) {
551 5 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) { } 0 5 5
552 0 ▶ return undef if (_error($self,$op,$ele));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $ele) 0 0 0
553 } else {
554 5 ▶ return 1 if ($val eq $ele);
Branch: 1 branch
BranchTrueFalseTotal
if $val eq $ele 1 4 5
555 }
556 }
557 1 return 0;
558  
559 } elsif ($op eq "absent") {
560 4 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 2 2 4
561 2 my $val = shift(@args);
562 2 ▶ if (ref($val)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $val) 0 2 2
563 0 _error($self,$op,$val);
564 0 return undef;
565 }
566 2 foreach my $ele (@args) {
567 5 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) { } 0 5 5
568 0 ▶ return undef if (_error($self,$op,$ele));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $ele) 0 0 0
569 } else {
570 5 ▶ return 0 if ($val eq $ele);
Branch: 1 branch
BranchTrueFalseTotal
if $val eq $ele 1 4 5
571 }
572 }
573 1 return 1;
574  
575 } elsif ($op eq ">") {
576 2 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 1 1 2
577 1 ▶ if ($#args != 1 ||
Branch: 1 branch
BranchTrueFalseTotal
if ($#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0]) or not _isnum($args[1])) 0 1 1
Condition33%4/12
$#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0]) or not _isnum($args[1])
l!l&&r!l&&!r
001
$#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0])
l!l&&r!l&&!r
001
$#args != 1 or ref $args[0] or ref $args[1]
l!l&&r!l&&!r
001
$#args != 1 or ref $args[0]
l!l&&r!l&&!r
001
MC/DC0%0/5
$#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0]) or not _isnum($args[1])
$#args != 1 ref $args[0] ref $args[1] not _isnum($args[0]) not _isnum($args[1])
Truth table16%1/6
A or B or C or not(D) or not(E)
A= $#args != 1B= ref $args[0]C= ref $args[1]D= not _isnum($args[0])E= not _isnum($args[1])
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
578 ref($args[0]) ||
579 ref($args[1]) ||
580 ! _isnum($args[0]) ||
581 ! _isnum($args[1])) {
582 0 _error($self,$op,\@args);
583 0 return undef;
584 }
585 1 ▶ return 1 if ($args[0] > $args[1]);
Branch: 1 branch
BranchTrueFalseTotal
if $args[0] > $args[1] 1 0 1
586 0 return 0;
587  
588 } elsif ($op eq ">=") {
589 0 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 0 0 0
590 0 ▶ if ($#args != 1 ||
Branch: 1 branch
BranchTrueFalseTotal
if ($#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0]) or not _isnum($args[1])) 0 0 0
Condition0%0/12
$#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0]) or not _isnum($args[1])
l!l&&r!l&&!r
000
$#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0])
l!l&&r!l&&!r
000
$#args != 1 or ref $args[0] or ref $args[1]
l!l&&r!l&&!r
000
$#args != 1 or ref $args[0]
l!l&&r!l&&!r
000
MC/DC0%0/5
$#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0]) or not _isnum($args[1])
$#args != 1 ref $args[0] ref $args[1] not _isnum($args[0]) not _isnum($args[1])
Truth table0%0/6
A or B or C or not(D) or not(E)
A= $#args != 1B= ref $args[0]C= ref $args[1]D= not _isnum($args[0])E= not _isnum($args[1])
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
591 ref($args[0]) ||
592 ref($args[1]) ||
593 ! _isnum($args[0]) ||
594 ! _isnum($args[1])) {
595 0 _error($self,$op,\@args);
596 0 return undef;
597 }
598 0 ▶ return 1 if ($args[0] >= $args[1]);
Branch: 1 branch
BranchTrueFalseTotal
if $args[0] >= $args[1] 0 0 0
599 0 return 0;
600  
601 } elsif ($op eq "==") {
602 0 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 0 0 0
603 0 ▶ if ($#args != 1 ||
Branch: 1 branch
BranchTrueFalseTotal
if ($#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0]) or not _isnum($args[1])) 0 0 0
Condition0%0/12
$#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0]) or not _isnum($args[1])
l!l&&r!l&&!r
000
$#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0])
l!l&&r!l&&!r
000
$#args != 1 or ref $args[0] or ref $args[1]
l!l&&r!l&&!r
000
$#args != 1 or ref $args[0]
l!l&&r!l&&!r
000
MC/DC0%0/5
$#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0]) or not _isnum($args[1])
$#args != 1 ref $args[0] ref $args[1] not _isnum($args[0]) not _isnum($args[1])
Truth table0%0/6
A or B or C or not(D) or not(E)
A= $#args != 1B= ref $args[0]C= ref $args[1]D= not _isnum($args[0])E= not _isnum($args[1])
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
604 ref($args[0]) ||
605 ref($args[1]) ||
606 ! _isnum($args[0]) ||
607 ! _isnum($args[1])) {
608 0 _error($self,$op,\@args);
609 0 return undef;
610 }
611 0 ▶ return 1 if ($args[0] == $args[1]);
Branch: 1 branch
BranchTrueFalseTotal
if $args[0] == $args[1] 0 0 0
612 0 return 0;
613  
614 } elsif ($op eq "<=") {
615 0 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 0 0 0
616 0 ▶ if ($#args != 1 ||
Branch: 1 branch
BranchTrueFalseTotal
if ($#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0]) or not _isnum($args[1])) 0 0 0
Condition0%0/12
$#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0]) or not _isnum($args[1])
l!l&&r!l&&!r
000
$#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0])
l!l&&r!l&&!r
000
$#args != 1 or ref $args[0] or ref $args[1]
l!l&&r!l&&!r
000
$#args != 1 or ref $args[0]
l!l&&r!l&&!r
000
MC/DC0%0/5
$#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0]) or not _isnum($args[1])
$#args != 1 ref $args[0] ref $args[1] not _isnum($args[0]) not _isnum($args[1])
Truth table0%0/6
A or B or C or not(D) or not(E)
A= $#args != 1B= ref $args[0]C= ref $args[1]D= not _isnum($args[0])E= not _isnum($args[1])
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
617 ref($args[0]) ||
618 ref($args[1]) ||
619 ! _isnum($args[0]) ||
620 ! _isnum($args[1])) {
621 0 _error($self,$op,\@args);
622 0 return undef;
623 }
624 0 ▶ return 1 if ($args[0] <= $args[1]);
Branch: 1 branch
BranchTrueFalseTotal
if $args[0] <= $args[1] 0 0 0
625 0 return 0;
626  
627 } elsif ($op eq "<") {
628 2 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 1 1 2
629 1 ▶ if ($#args != 1 ||
Branch: 1 branch
BranchTrueFalseTotal
if ($#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0]) or not _isnum($args[1])) 0 1 1
Condition33%4/12
$#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0]) or not _isnum($args[1])
l!l&&r!l&&!r
001
$#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0])
l!l&&r!l&&!r
001
$#args != 1 or ref $args[0] or ref $args[1]
l!l&&r!l&&!r
001
$#args != 1 or ref $args[0]
l!l&&r!l&&!r
001
MC/DC0%0/5
$#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0]) or not _isnum($args[1])
$#args != 1 ref $args[0] ref $args[1] not _isnum($args[0]) not _isnum($args[1])
Truth table16%1/6
A or B or C or not(D) or not(E)
A= $#args != 1B= ref $args[0]C= ref $args[1]D= not _isnum($args[0])E= not _isnum($args[1])
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
630 ref($args[0]) ||
631 ref($args[1]) ||
632 ! _isnum($args[0]) ||
633 ! _isnum($args[1])) {
634 0 _error($self,$op,\@args);
635 0 return undef;
636 }
637 1 ▶ return 1 if ($args[0] < $args[1]);
Branch: 1 branch
BranchTrueFalseTotal
if $args[0] < $args[1] 0 1 1
638 1 return 0;
639  
640 } elsif ($op eq "!=") {
641 0 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 0 0 0
642 0 ▶ if ($#args != 1 ||
Branch: 1 branch
BranchTrueFalseTotal
if ($#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0]) or not _isnum($args[1])) 0 0 0
Condition0%0/12
$#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0]) or not _isnum($args[1])
l!l&&r!l&&!r
000
$#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0])
l!l&&r!l&&!r
000
$#args != 1 or ref $args[0] or ref $args[1]
l!l&&r!l&&!r
000
$#args != 1 or ref $args[0]
l!l&&r!l&&!r
000
MC/DC0%0/5
$#args != 1 or ref $args[0] or ref $args[1] or not _isnum($args[0]) or not _isnum($args[1])
$#args != 1 ref $args[0] ref $args[1] not _isnum($args[0]) not _isnum($args[1])
Truth table0%0/6
A or B or C or not(D) or not(E)
A= $#args != 1B= ref $args[0]C= ref $args[1]D= not _isnum($args[0])E= not _isnum($args[1])
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
643 ref($args[0]) ||
644 ref($args[1]) ||
645 ! _isnum($args[0]) ||
646 ! _isnum($args[1])) {
647 0 _error($self,$op,\@args);
648 0 return undef;
649 }
650 0 ▶ return 1 if ($args[0] != $args[1]);
Branch: 1 branch
BranchTrueFalseTotal
if $args[0] != $args[1] 0 0 0
651 0 return 0;
652  
653 } elsif ($op eq "gt") {
654 2 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 1 1 2
655 1 ▶ if ($#args != 1 ||
Branch: 1 branch
BranchTrueFalseTotal
if ($#args != 1 or ref $args[0] or ref $args[1]) 0 1 1
Condition33%2/6
$#args != 1 or ref $args[0] or ref $args[1]
l!l&&r!l&&!r
001
$#args != 1 or ref $args[0]
l!l&&r!l&&!r
001
MC/DC0%0/3
$#args != 1 or ref $args[0] or ref $args[1]
$#args != 1 ref $args[0] ref $args[1]
Truth table25%1/4
A or B or C
A= $#args != 1B= ref $args[0]C= ref $args[1]
ABCresult
1XX1
01X1
0011
0000
656 ref($args[0]) ||
657 ref($args[1])) {
658 0 _error($self,$op,\@args);
659 0 return undef;
660 }
661 1 ▶ return 1 if ($args[0] gt $args[1]);
Branch: 1 branch
BranchTrueFalseTotal
if $args[0] gt $args[1] 0 1 1
662 1 return 0;
663  
664 } elsif ($op eq "ge") {
665 0 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 0 0 0
666 0 ▶ if ($#args != 1 ||
Branch: 1 branch
BranchTrueFalseTotal
if ($#args != 1 or ref $args[0] or ref $args[1]) 0 0 0
Condition0%0/6
$#args != 1 or ref $args[0] or ref $args[1]
l!l&&r!l&&!r
000
$#args != 1 or ref $args[0]
l!l&&r!l&&!r
000
MC/DC0%0/3
$#args != 1 or ref $args[0] or ref $args[1]
$#args != 1 ref $args[0] ref $args[1]
Truth table0%0/4
A or B or C
A= $#args != 1B= ref $args[0]C= ref $args[1]
ABCresult
1XX1
01X1
0011
0000
667 ref($args[0]) ||
668 ref($args[1])) {
669 0 _error($self,$op,\@args);
670 0 return undef;
671 }
672 0 ▶ return 1 if ($args[0] ge $args[1]);
Branch: 1 branch
BranchTrueFalseTotal
if $args[0] ge $args[1] 0 0 0
673 0 return 0;
674  
675 } elsif ($op eq "eq") {
676 0 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 0 0 0
677 0 ▶ if ($#args != 1 ||
Branch: 1 branch
BranchTrueFalseTotal
if ($#args != 1 or ref $args[0] or ref $args[1]) 0 0 0
Condition0%0/6
$#args != 1 or ref $args[0] or ref $args[1]
l!l&&r!l&&!r
000
$#args != 1 or ref $args[0]
l!l&&r!l&&!r
000
MC/DC0%0/3
$#args != 1 or ref $args[0] or ref $args[1]
$#args != 1 ref $args[0] ref $args[1]
Truth table0%0/4
A or B or C
A= $#args != 1B= ref $args[0]C= ref $args[1]
ABCresult
1XX1
01X1
0011
0000
678 ref($args[0]) ||
679 ref($args[1])) {
680 0 _error($self,$op,\@args);
681 0 return undef;
682 }
683 0 ▶ return 1 if ($args[0] eq $args[1]);
Branch: 1 branch
BranchTrueFalseTotal
if $args[0] eq $args[1] 0 0 0
684 0 return 0;
685  
686 } elsif ($op eq "le") {
687 0 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 0 0 0
688 0 ▶ if ($#args != 1 ||
Branch: 1 branch
BranchTrueFalseTotal
if ($#args != 1 or ref $args[0] or ref $args[1]) 0 0 0
Condition0%0/6
$#args != 1 or ref $args[0] or ref $args[1]
l!l&&r!l&&!r
000
$#args != 1 or ref $args[0]
l!l&&r!l&&!r
000
MC/DC0%0/3
$#args != 1 or ref $args[0] or ref $args[1]
$#args != 1 ref $args[0] ref $args[1]
Truth table0%0/4
A or B or C
A= $#args != 1B= ref $args[0]C= ref $args[1]
ABCresult
1XX1
01X1
0011
0000
689 ref($args[0]) ||
690 ref($args[1])) {
691 0 _error($self,$op,\@args);
692 0 return undef;
693 }
694 0 ▶ return 1 if ($args[0] le $args[1]);
Branch: 1 branch
BranchTrueFalseTotal
if $args[0] le $args[1] 0 0 0
695 0 return 0;
696  
697 } elsif ($op eq "lt") {
698 2 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 1 1 2
699 1 ▶ if ($#args != 1 ||
Branch: 1 branch
BranchTrueFalseTotal
if ($#args != 1 or ref $args[0] or ref $args[1]) 0 1 1
Condition33%2/6
$#args != 1 or ref $args[0] or ref $args[1]
l!l&&r!l&&!r
001
$#args != 1 or ref $args[0]
l!l&&r!l&&!r
001
MC/DC0%0/3
$#args != 1 or ref $args[0] or ref $args[1]
$#args != 1 ref $args[0] ref $args[1]
Truth table25%1/4
A or B or C
A= $#args != 1B= ref $args[0]C= ref $args[1]
ABCresult
1XX1
01X1
0011
0000
700 ref($args[0]) ||
701 ref($args[1])) {
702 0 _error($self,$op,\@args);
703 0 return undef;
704 }
705 1 ▶ return 1 if ($args[0] lt $args[1]);
Branch: 1 branch
BranchTrueFalseTotal
if $args[0] lt $args[1] 1 0 1
706 0 return 0;
707  
708 } elsif ($op eq "ne") {
709 0 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 0 0 0
710 0 ▶ if ($#args != 1 ||
Branch: 1 branch
BranchTrueFalseTotal
if ($#args != 1 or ref $args[0] or ref $args[1]) 0 0 0
Condition0%0/6
$#args != 1 or ref $args[0] or ref $args[1]
l!l&&r!l&&!r
000
$#args != 1 or ref $args[0]
l!l&&r!l&&!r
000
MC/DC0%0/3
$#args != 1 or ref $args[0] or ref $args[1]
$#args != 1 ref $args[0] ref $args[1]
Truth table0%0/4
A or B or C
A= $#args != 1B= ref $args[0]C= ref $args[1]
ABCresult
1XX1
01X1
0011
0000
711 ref($args[0]) ||
712 ref($args[1])) {
713 0 _error($self,$op,\@args);
714 0 return undef;
715 }
716 0 ▶ return 1 if ($args[0] ne $args[1]);
Branch: 1 branch
BranchTrueFalseTotal
if $args[0] ne $args[1] 0 0 0
717 0 return 0;
718  
719 } elsif ($op eq "if") {
720 12 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 6 6 12
721 6 ▶ if ($#args < 0 ||
Branch: 1 branch
BranchTrueFalseTotal
if ($#args < 0 or $#args > 2) 0 6 6
Condition33%1/3
$#args < 0 or $#args > 2
l!l&&r!l&&!r
006
MC/DC0%0/2
$#args < 0 or $#args > 2
$#args < 0 $#args > 2
Truth table33%1/3
A or B
A= $#args < 0B= $#args > 2
ABresult
1X1
011
000
722 $#args > 2) {
723 0 _error($self,$op,\@args);
724 0 return undef;
725 }
726 6 my $test = shift(@args);
727 6 ▶ if (ref($test)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $test) 0 6 6
728 0 _error($self,$op,$test);
729 0 return undef;
730 }
731 6 ▶ if ($test) {
Branch: 1 branch
BranchTrueFalseTotal
if ($test) { } 3 3 6
732 3 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) { } 2 1 3
733 2 return shift(@args);
734 } else {
735 1 return 1;
736 }
737 } else {
738 3 ▶ if ($#args == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($#args == 1) { } 1 2 3
739 1 return pop(@args);
740 } else {
741 2 return 0;
742 }
743 }
744  
745 } elsif ($op eq "is_equal") {
746 4 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 2 2 4
747 2 ▶ if ($#args != 1 ||
Branch: 1 branch
BranchTrueFalseTotal
if ($#args != 1 or not ref $args[0] or not ref $args[1]) 0 2 2
Condition33%2/6
$#args != 1 or not ref $args[0] or not ref $args[1]
l!l&&r!l&&!r
002
$#args != 1 or not ref $args[0]
l!l&&r!l&&!r
002
MC/DC0%0/3
$#args != 1 or not ref $args[0] or not ref $args[1]
$#args != 1 not ref $args[0] not ref $args[1]
Truth table25%1/4
A or not(B) or not(C)
A= $#args != 1B= not ref $args[0]C= not ref $args[1]
ABCresult
1XX1
01X1
0011
0000
748 ! ref($args[0]) ||
749 ! ref($args[1])) {
750 0 _error($self,$op,$test);
751 0 return undef;
752 }
753  
754 2 my %list1;
755 2 foreach my $ele (@{ $args[0] }) {
756 8 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) 0 8 8
757 0 _error($self,$op,$ele);
758 0 return undef;
759 }
760 8 $list1{$ele}++;
761 }
762  
763 2 my %list2;
764 2 foreach my $ele (@{ $args[1] }) {
765 7 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) 0 7 7
766 0 _error($self,$op,$ele);
767 0 return undef;
768 }
769 7 $list2{$ele}++;
770 }
771  
772 2 foreach my $ele (keys %list1) {
773 5 ▶ return 0 if (! exists $list2{$ele} || $list1{$ele} != $list2{$ele});
Branch: 1 branch
BranchTrueFalseTotal
if not exists $list2{$ele} or $list1{$ele} != $list2{$ele} 1 4 5
Condition66%2/3
not exists $list2{$ele} or $list1{$ele} != $list2{$ele}
l!l&&r!l&&!r
014
MC/DC50%1/2
not exists $list2{$ele} or $list1{$ele} != $list2{$ele}
not exists $list2{$ele} $list1{$ele} != $list2{$ele}
Truth table66%2/3
not(A) or B
A= not exists $list2{$ele}B= $list1{$ele} != $list2{$ele}
ABresult
1X1
011
000
774 }
775 1 foreach my $ele (keys %list2) {
776 3 ▶ return 0 if (! exists $list1{$ele} || $list1{$ele} != $list2{$ele});
Branch: 1 branch
BranchTrueFalseTotal
if not exists $list1{$ele} or $list1{$ele} != $list2{$ele} 0 3 3
Condition33%1/3
not exists $list1{$ele} or $list1{$ele} != $list2{$ele}
l!l&&r!l&&!r
003
MC/DC0%0/2
not exists $list1{$ele} or $list1{$ele} != $list2{$ele}
not exists $list1{$ele} $list1{$ele} != $list2{$ele}
Truth table33%1/3
not(A) or B
A= not exists $list1{$ele}B= $list1{$ele} != $list2{$ele}
ABresult
1X1
011
000
777 }
778 1 return 1;
779  
780 } elsif ($op eq "not_equal") {
781 0 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 0 0 0
782 0 my $val = _operation($self,0,"is_equal",@args);
783 0 ▶ if (defined $val) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $val) { } 0 0 0
784 0 ▶ return ($val ? 0 : 1);
Branch: 1 branch
BranchTrueFalseTotal
$val ? : 0 0 0
785 } else {
786 0 return undef;
787 }
788  
789 } elsif ($op eq "iff") {
790 6 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 3 3 6
791 3 my $t = 0;
792 3 my $u = 0;
793 3 foreach my $ele (@args) {
794 9 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) { } 0 9 9
795 0 ▶ return undef if (_error($self,$op,$ele));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $ele) 0 0 0
796 0 $u++;
797 } else {
798 9 ▶ $t++ if ($ele);
Branch: 1 branch
BranchTrueFalseTotal
if $ele 4 5 9
799 }
800 }
801 3 ▶ return 1 if ($t+$u == 0 || $t+$u == $#args + 1);
Branch: 1 branch
BranchTrueFalseTotal
if $t + $u == 0 or $t + $u == $#args + 1 2 1 3
Condition100%3/3
$t + $u == 0 or $t + $u == $#args + 1
l!l&&r!l&&!r
111
MC/DC100%2/2
$t + $u == 0 or $t + $u == $#args + 1
$t + $u == 0 $t + $u == $#args + 1
Truth table100%3/3
A or B
A= $t + $u == 0B= $t + $u == $#args + 1
ABresult
1X1
011
000
802 1 return 0;
803  
804 ▶ } elsif ($op eq "range" ||
Condition100%9/9
$op eq "range" or $op eq "rangeL" or $op eq "rangeR" or $op eq "rangeLR"
l!l&&r!l&&!r
3010395
$op eq "range" or $op eq "rangeL" or $op eq "rangeR"
l!l&&r!l&&!r
2010405
$op eq "range" or $op eq "rangeL"
l!l&&r!l&&!r
1010415
MC/DC100%4/4
$op eq "range" or $op eq "rangeL" or $op eq "rangeR" or $op eq "rangeLR"
$op eq "range" $op eq "rangeL" $op eq "rangeR" $op eq "rangeLR"
Truth table100%5/5
A or B or C or D
A= $op eq "range"B= $op eq "rangeL"C= $op eq "rangeR"D= $op eq "rangeLR"
ABCDresult
1XXX1
01XX1
001X1
00011
00000
805 $op eq "rangeL" ||
806 $op eq "rangeR" ||
807 $op eq "rangeLR") {
808 40 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 20 20 40
809 20 ▶ if ($#args != 2 ||
Branch: 1 branch
BranchTrueFalseTotal
if ($#args != 2 or ref $args[0] or ref $args[1] or ref $args[2] or not _isnum($args[0]) or not _isnum($args[1]) or not _isnum($args[2]) or $args[1] > $args[2]) 0 20 20
Condition33%7/21
$#args != 2 or ref $args[0] or ref $args[1] or ref $args[2] or not _isnum($args[0]) or not _isnum($args[1]) or not _isnum($args[2]) or $args[1] > $args[2]
l!l&&r!l&&!r
0020
$#args != 2 or ref $args[0] or ref $args[1] or ref $args[2] or not _isnum($args[0]) or not _isnum($args[1]) or not _isnum($args[2])
l!l&&r!l&&!r
0020
$#args != 2 or ref $args[0] or ref $args[1] or ref $args[2] or not _isnum($args[0]) or not _isnum($args[1])
l!l&&r!l&&!r
0020
$#args != 2 or ref $args[0] or ref $args[1] or ref $args[2] or not _isnum($args[0])
l!l&&r!l&&!r
0020
$#args != 2 or ref $args[0] or ref $args[1] or ref $args[2]
l!l&&r!l&&!r
0020
$#args != 2 or ref $args[0] or ref $args[1]
l!l&&r!l&&!r
0020
$#args != 2 or ref $args[0]
l!l&&r!l&&!r
0020
MC/DC0%0/8
$#args != 2 or ref $args[0] or ref $args[1] or ref $args[2] or not _isnum($args[0]) or not _isnum($args[1]) or not _isnum($args[2]) or $args[1] > $args[2]
$#args != 2 ref $args[0] ref $args[1] ref $args[2] not _isnum($args[0]) not _isnum($args[1]) not _isnum($args[2]) $args[1] > $args[2]
Truth table11%1/9
A or B or C or D or not(E) or not(F) or not(G) or H
A= $#args != 2B= ref $args[0]C= ref $args[1]D= ref $args[2]E= not _isnum($args[0])F= not _isnum($args[1])G= not _isnum($args[2])H= $args[1] > $args[2]
ABCDEFGHresult
1XXXXXXX1
01XXXXXX1
001XXXXX1
0001XXXX1
00001XXX1
000001XX1
0000001X1
000000011
000000000
810 ref($args[0]) ||
811 ref($args[1]) ||
812 ref($args[2]) ||
813 ! _isnum($args[0]) ||
814 ! _isnum($args[1]) ||
815 ! _isnum($args[2]) ||
816 $args[1] > $args[2]) {
817 0 _error($self,$op,[@args]);
818 }
819 20 my($n,$x,$y) = @args;
820 20 ▶ return 0 if ($n < $x ||
Branch: 1 branch
BranchTrueFalseTotal
if $n < $x or $n == $x and $op eq "rangeL" || $op eq "rangeLR" or $n > $y or $n == $y and $op eq "rangeR" || $op eq "rangeLR" 12 8 20
Condition100%21/21
$n < $x or $n == $x and $op eq "rangeL" || $op eq "rangeLR" or $n > $y or $n == $y and $op eq "rangeR" || $op eq "rangeLR"
l!l&&r!l&&!r
1028
$n < $x or $n == $x and $op eq "rangeL" || $op eq "rangeLR" or $n > $y
l!l&&r!l&&!r
6410
$n < $x or $n == $x and $op eq "rangeL" || $op eq "rangeLR"
l!l&&r!l&&!r
4214
$n == $x and $op eq "rangeL" || $op eq "rangeLR"
!ll&&!rl&&r
1222
$op eq "rangeL" or $op eq "rangeLR"
l!l&&r!l&&!r
112
$n == $y and $op eq "rangeR" || $op eq "rangeLR"
!ll&&!rl&&r
622
$op eq "rangeR" or $op eq "rangeLR"
l!l&&r!l&&!r
112
MC/DC100%8/8
$n < $x or $n == $x and $op eq "rangeL" || $op eq "rangeLR" or $n > $y or $n == $y and $op eq "rangeR" || $op eq "rangeLR"
$n < $x $n == $x $op eq "rangeL" $op eq "rangeLR" $n > $y $n == $y $op eq "rangeR" $op eq "rangeLR"
Truth table69%9/13
A or B and C or D or E or F and G or H
A= $n < $xB= $n == $xC= $op eq "rangeL"D= $op eq "rangeLR"E= $n > $yF= $n == $yG= $op eq "rangeR"H= $op eq "rangeLR"
ABCDEFGHresult
1XXXXXXX1
011XXXXX1
0101XXXX1
00XX1XXX1
01001XXX1
00XX011X1
00XX01011
0100011X1
010001011
00XX00XX0
00XX01000
010000XX0
010001000
821 ($n == $x && ($op eq "rangeL" || $op eq "rangeLR")) ||
822 $n > $y ||
823 ($n == $y && ($op eq "rangeR" || $op eq "rangeLR")));
824 8 return 1;
825  
826 }
827  
828 #
829 # List => list operations
830 #
831  
832 395 ▶ if ($op eq "flatten") {
Branch: 24 branches
BranchTrueFalseTotal
if ($op eq 'flatten') { } 2 393 395
elsif ($op eq 'union') { } 2 391 393
elsif ($op eq 'sort') { } 2 389 391
elsif ($op eq 'sort_by_method') { } 4 385 389
elsif ($op eq 'unique') { } 4 381 385
elsif ($op eq 'compact') { } 4 377 381
elsif ($op eq 'true') { } 2 375 377
elsif ($op eq 'pop') { } 0 375 375
elsif ($op eq 'shift') { } 0 375 375
elsif ($op eq 'pad') { } 0 375 375
elsif ($op eq 'padchar') { } 4 371 375
elsif ($op eq 'column') { } 2 369 371
elsif ($op eq 'reverse') { } 2 367 369
elsif ($op eq 'rotate') { } 4 363 367
elsif ($op eq 'delete') { } 2 361 363
elsif ($op eq 'clear') { } 2 359 361
elsif ($op eq 'append') { } 2 357 359
elsif ($op eq 'prepend') { } 2 355 357
elsif ($op eq 'splice') { } 8 347 355
elsif ($op eq 'slice') { } 4 343 347
elsif ($op eq 'fill') { } 28 315 343
elsif ($op eq 'difference' or $op eq 'd_difference') { } 6 309 315
elsif ($op eq 'intersection' or $op eq 'd_intersection') { } 4 305 309
elsif ($op eq 'symdiff' or $op eq 'd_symdiff') { } 4 301 305
833 2 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 1 1 2
834 1 return _flatten(@args);
835  
836 } elsif ($op eq "union") {
837 2 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 1 1 2
838 1 my @ret;
839 1 foreach my $ele (@args) {
840 3 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) { } 2 1 3
841 2 push(@ret,@$ele);
842 } else {
843 1 push(@ret,$ele);
844 }
845 }
846 1 return @ret;
847  
848 } elsif ($op eq "sort") {
849 2 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 1 1 2
850 1 my @list;
851 1 foreach my $ele (@args) {
852 3 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) { } 0 3 3
853 0 ▶ return undef if (_error($self,$op,$ele));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $ele) 0 0 0
854 } else {
855 3 push(@list,$ele);
856 }
857 }
858  
859 1 sort_by_method("alphabetic",\@list);
860 1 return @list;
861  
862 } elsif ($op eq "sort_by_method") {
863 4 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 2 2 4
864 2 ▶ if (ref($args[0]) ||
Branch: 2 branches
BranchTrueFalseTotal
if (ref $args[0] or not sort_valid_method($args[0])) { } 0 2 2
elsif (not ref $args[1]) { } 0 2 2
Condition33%1/3
ref $args[0] or not sort_valid_method($args[0])
l!l&&r!l&&!r
002
MC/DC0%0/2
ref $args[0] or not sort_valid_method($args[0])
ref $args[0] not sort_valid_method($args[0])
Truth table33%1/3
A or not(B)
A= ref $args[0]B= not sort_valid_method($args[0])
ABresult
1X1
011
000
865 ! sort_valid_method($args[0])) {
866 0 _error($self,$op,$args[0]);
867 0 return undef;
868  
869 } elsif (! ref($args[1])) {
870 0 _error($self,$op,$args[1]);
871 0 return undef;
872  
873 } else {
874 2 sort_by_method(@args);
875 }
876 2 return @{ $args[1] };
877  
878 } elsif ($op eq "unique") {
879 4 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 1 3 4
880 3 my %ele = ();
881 3 my @ret = ();
882 3 foreach my $ele (_flatten(@args)) {
883 10 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) { } 0 10 10
884 0 ▶ return undef if (_error($self,$op,$ele));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $ele) 0 0 0
885 } else {
886 10 ▶ if (! exists $ele{$ele}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $ele{$ele}) 7 3 10
887 7 push(@ret,$ele);
888 7 $ele{$ele} = 1;
889 }
890 }
891 }
892 3 return @ret;
893  
894 } elsif ($op eq "compact") {
895 4 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 2 2 4
896 2 my @ret = ();
897 2 foreach my $ele (_flatten(@args)) {
898 10 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) { } 0 10 10
899 0 ▶ return undef if (_error($self,$op,$ele));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $ele) 0 0 0
900 } else {
901 10 ▶ next if (! defined $ele || $ele eq "");
Branch: 1 branch
BranchTrueFalseTotal
if not defined $ele or $ele eq "" 2 8 10
Condition66%2/3
not defined $ele or $ele eq ""
l!l&&r!l&&!r
028
MC/DC50%1/2
not defined $ele or $ele eq ""
not defined $ele $ele eq ""
Truth table66%2/3
not(A) or B
A= not defined $eleB= $ele eq ""
ABresult
1X1
011
000
902 8 push(@ret,$ele);
903 }
904 }
905 2 return @ret;
906  
907 } elsif ($op eq "true") {
908 2 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 1 1 2
909 1 my @ret = ();
910 1 foreach my $ele (_flatten(@args)) {
911 5 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) { } 0 5 5
912 0 ▶ return undef if (_error($self,$op,$ele));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $ele) 0 0 0
913 } else {
914 5 ▶ push(@ret,$ele) if ($ele);
Branch: 1 branch
BranchTrueFalseTotal
if $ele 3 2 5
915 }
916 }
917 1 return @ret;
918  
919 } elsif ($op eq "pop") {
920 0 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 0 0 0
921 0 pop(@args);
922 0 return @args;
923  
924 } elsif ($op eq "shift") {
925 0 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 0 0 0
926 0 shift(@args);
927 0 return @args;
928  
929 } elsif ($op eq "pad") {
930 0 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 0 0 0
931 0 ▶ if (ref $args[0] ||
Branch: 1 branch
BranchTrueFalseTotal
if (ref $args[0] or not $args[0] =~ /^[-+]?\d+$/) { } 0 0 0
Condition0%0/3
ref $args[0] or not $args[0] =~ /^[-+]?\d+$/
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $args[0] or not $args[0] =~ /^[-+]?\d+$/
ref $args[0] not $args[0] =~ /^[-+]?\d+$/
Truth table0%0/3
A or not(B)
A= ref $args[0]B= not $args[0] =~ /^[-+]?\d+$/
ABresult
1X1
011
000
932 $args[0] !~ /^[-+]?\d+$/) {
933 0 ▶ return undef if (_error($self,$op,$args[0]));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $args[0]) 0 0 0
934  
935 } else {
936 0 my $len = shift(@args);
937 0 my @ret;
938 0 foreach my $ele (@args) {
939 0 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) { } 0 0 0
940 0 ▶ return undef if (_error($self,$op,$ele));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $ele) 0 0 0
941 } else {
942 0 my $val = $ele;
943 0 ▶ if ($len >= 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($len >= 0) { } 0 0 0
944 0 $val .= " "x($len-length($val));
945 } else {
946 0 $val = " "x(-$len-length($val)) . $val;
947 }
948 0 push(@ret,$val);
949 }
950 }
951 0 return @ret;
952 }
953  
954 } elsif ($op eq "padchar") {
955 4 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 2 2 4
956 2 ▶ if (ref($args[0]) ||
Branch: 2 branches
BranchTrueFalseTotal
if (ref $args[0] or not $args[0] =~ /^[-+]?\d+$/) { } 0 2 2
elsif (ref $args[1] or length $args[1] != 1) { } 0 2 2
Condition33%1/3
ref $args[0] or not $args[0] =~ /^[-+]?\d+$/
l!l&&r!l&&!r
002
MC/DC0%0/2
ref $args[0] or not $args[0] =~ /^[-+]?\d+$/
ref $args[0] not $args[0] =~ /^[-+]?\d+$/
Truth table33%1/3
A or not(B)
A= ref $args[0]B= not $args[0] =~ /^[-+]?\d+$/
ABresult
1X1
011
000
957 $args[0] !~ /^[-+]?\d+$/) {
958 0 ▶ return undef if (_error($self,$op,$args[0]));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $args[0]) 0 0 0
959  
960 ▶ } elsif (ref($args[1]) ||
Condition33%1/3
ref $args[1] or length $args[1] != 1
l!l&&r!l&&!r
002
MC/DC0%0/2
ref $args[1] or length $args[1] != 1
ref $args[1] length $args[1] != 1
Truth table33%1/3
A or B
A= ref $args[1]B= length $args[1] != 1
ABresult
1X1
011
000
961 length($args[1]) != 1) {
962 0 ▶ return undef if (_error($self,$op,$args[1]));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $args[1]) 0 0 0
963  
964 } else {
965 2 my $len = shift(@args);
966 2 my $c = shift(@args);
967 2 my @ret;
968 2 foreach my $ele (@args) {
969 8 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) { } 0 8 8
970 0 ▶ return undef if (_error($self,$op,$ele));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $ele) 0 0 0
971 } else {
972 8 my $val = $ele;
973 8 ▶ if ($len >= 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($len >= 0) { } 4 4 8
974 4 $val .= $c x ($len-length($val));
975 } else {
976 4 $val = $c x (-$len-length($val)) . $val;
977 }
978 8 push(@ret,$val);
979 }
980 }
981 2 return @ret;
982 }
983  
984 } elsif ($op eq "column") {
985 2 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 1 1 2
986 1 my $n = shift(@args);
987 1 ▶ if (ref($n) ||
Branch: 1 branch
BranchTrueFalseTotal
if (ref $n or not $n =~ /^[-+]?\d+$/) 0 1 1
Condition33%1/3
ref $n or not $n =~ /^[-+]?\d+$/
l!l&&r!l&&!r
001
MC/DC0%0/2
ref $n or not $n =~ /^[-+]?\d+$/
ref $n not $n =~ /^[-+]?\d+$/
Truth table33%1/3
A or not(B)
A= ref $nB= not $n =~ /^[-+]?\d+$/
ABresult
1X1
011
000
988 $n !~ /^[-+]?\d+$/) {
989 0 _error($self,$op,$n);
990 0 return undef;
991 }
992  
993 1 my @ret;
994 1 foreach my $ele (@args) {
995 3 ▶ if (! ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $ele) { } 0 3 3
996 0 ▶ return undef if (_error($self,$op,$ele));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $ele) 0 0 0
997 } else {
998 3 ▶ push(@ret,$$ele[$n]) if (defined $$ele[$n]);
Branch: 1 branch
BranchTrueFalseTotal
if defined $ele->[$n] 2 1 3
999 }
1000 }
1001 1 return @ret;
1002  
1003 } elsif ($op eq "reverse") {
1004 2 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 1 1 2
1005 1 return reverse(@args);
1006  
1007 } elsif ($op eq "rotate") {
1008 4 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 2 2 4
1009 2 my $n = shift(@args);
1010 2 ▶ if (ref($n) || $n !~ /^[-+]?\d+$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $n or not $n =~ /^[-+]?\d+$/) 0 2 2
Condition33%1/3
ref $n or not $n =~ /^[-+]?\d+$/
l!l&&r!l&&!r
002
MC/DC0%0/2
ref $n or not $n =~ /^[-+]?\d+$/
ref $n not $n =~ /^[-+]?\d+$/
Truth table33%1/3
A or not(B)
A= ref $nB= not $n =~ /^[-+]?\d+$/
ABresult
1X1
011
000
1011 0 _error($self,$op,$n);
1012 0 return undef;
1013 }
1014 2 my $dir = 1;
1015 2 ▶ if ($n < 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n < 0) 1 1 2
1016 1 $dir = 0;
1017 1 $n *= -1;
1018 }
1019 2 ▶ if ($dir) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dir) { } 1 1 2
1020 1 ▶ for (my $i=0; $i<$n; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $n) 2 1 3
1021 2 push(@args,shift(@args));
1022 }
1023 } else {
1024 1 ▶ for (my $i=0; $i<$n; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $n) 2 1 3
1025 2 unshift(@args,pop(@args));
1026 }
1027 }
1028 2 return @args;
1029  
1030 } elsif ($op eq "delete") {
1031 2 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 1 1 2
1032 1 my $val = shift(@args);
1033 1 ▶ if (ref($val)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $val) 0 1 1
1034 0 _error($self,$op,$val);
1035 0 return undef;
1036 }
1037  
1038 1 my @ret;
1039 1 foreach my $ele (@args) {
1040 6 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) { } 0 6 6
1041 0 ▶ return undef if (_error($self,$op,$ele));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $ele) 0 0 0
1042 } else {
1043 6 ▶ push(@ret,$ele) unless ($ele eq $val);
Branch: 1 branch
BranchTrueFalseTotal
unless $ele eq $val 3 3 6
1044 }
1045 }
1046 1 return @ret;
1047  
1048 } elsif ($op eq "clear") {
1049 2 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 1 1 2
1050 1 return ();
1051  
1052 } elsif ($op eq "append") {
1053 2 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 1 1 2
1054 1 my $str = shift(@args);
1055 1 ▶ if (ref($str)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $str) 0 1 1
1056 0 _error($self,$op,$str);
1057 0 return undef;
1058 }
1059  
1060 1 my @ret;
1061 1 foreach my $ele (@args) {
1062 3 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) { } 0 3 3
1063 0 ▶ return undef if (_error($self,$op,$ele));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $ele) 0 0 0
1064 } else {
1065 3 push(@ret,"$ele$str");
1066 }
1067 }
1068 1 return @ret;
1069  
1070 } elsif ($op eq "prepend") {
1071 2 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 1 1 2
1072 1 my $str = shift(@args);
1073 1 ▶ if (ref($str)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $str) 0 1 1
1074 0 _error($self,$op,$str);
1075 0 return undef;
1076 }
1077  
1078 1 my @ret;
1079 1 foreach my $ele (@args) {
1080 3 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) { } 0 3 3
1081 0 ▶ return undef if (_error($self,$op,$ele));
Branch: 1 branch
BranchTrueFalseTotal
if _error($self, $op, $ele) 0 0 0
1082 } else {
1083 3 push(@ret,"$str$ele");
1084 }
1085 }
1086 1 return @ret;
1087  
1088 } elsif ($op eq "splice") {
1089 8 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 4 4 8
1090 4 my $list = shift(@args);
1091 4 ▶ if (! ref($list)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $list) 0 4 4
1092 0 _error($self,$op,$list);
1093 0 return undef;
1094 }
1095 4 my @list = @$list;
1096 4 my $n = shift(@args);
1097 4 ▶ if (ref($n) ||
Branch: 1 branch
BranchTrueFalseTotal
if (ref $n or not $n =~ /^[-+]?\d+$/ or not _valid_index($n, $#list)) 0 4 4
Condition33%2/6
ref $n or not $n =~ /^[-+]?\d+$/ or not _valid_index($n, $#list)
l!l&&r!l&&!r
004
ref $n or not $n =~ /^[-+]?\d+$/
l!l&&r!l&&!r
004
MC/DC0%0/3
ref $n or not $n =~ /^[-+]?\d+$/ or not _valid_index($n, $#list)
ref $n not $n =~ /^[-+]?\d+$/ not _valid_index($n, $#list)
Truth table25%1/4
A or not(B) or not(C)
A= ref $nB= not $n =~ /^[-+]?\d+$/C= not _valid_index($n, $#list)
ABCresult
1XX1
01X1
0011
0000
1098 $n !~ /^[-+]?\d+$/ ||
1099 ! _valid_index($n,$#list)) {
1100 0 _error($self,$op,$n);
1101 0 return undef;
1102 }
1103 4 my $len = shift(@args);
1104 4 ▶ if (ref($len) || $len !~ /^\d+$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $len or not $len =~ /^\d+$/) 0 4 4
Condition33%1/3
ref $len or not $len =~ /^\d+$/
l!l&&r!l&&!r
004
MC/DC0%0/2
ref $len or not $len =~ /^\d+$/
ref $len not $len =~ /^\d+$/
Truth table33%1/3
A or not(B)
A= ref $lenB= not $len =~ /^\d+$/
ABresult
1X1
011
000
1105 0 _error($self,$op,$len);
1106 0 return undef;
1107 }
1108 4 splice(@list,$n,$len,@args);
1109 4 return @list;
1110  
1111 } elsif ($op eq "slice") {
1112 4 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 2 2 4
1113 2 my $n = shift(@args);
1114 2 ▶ if (ref($n) ||
Branch: 1 branch
BranchTrueFalseTotal
if (ref $n or not $n =~ /^[-+]?\d+$/ or not _valid_index($n, $#args - 1)) 0 2 2
Condition33%2/6
ref $n or not $n =~ /^[-+]?\d+$/ or not _valid_index($n, $#args - 1)
l!l&&r!l&&!r
002
ref $n or not $n =~ /^[-+]?\d+$/
l!l&&r!l&&!r
002
MC/DC0%0/3
ref $n or not $n =~ /^[-+]?\d+$/ or not _valid_index($n, $#args - 1)
ref $n not $n =~ /^[-+]?\d+$/ not _valid_index($n, $#args - 1)
Truth table25%1/4
A or not(B) or not(C)
A= ref $nB= not $n =~ /^[-+]?\d+$/C= not _valid_index($n, $#args - 1)
ABCresult
1XX1
01X1
0011
0000
1115 $n !~ /^[-+]?\d+$/ ||
1116 ! _valid_index($n,$#args - 1)) {
1117 0 _error($self,$op,$n);
1118 0 return undef;
1119 }
1120 2 my $len = shift(@args);
1121 2 ▶ if (ref($len) || $len !~ /^\d+$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $len or not $len =~ /^\d+$/) 0 2 2
Condition33%1/3
ref $len or not $len =~ /^\d+$/
l!l&&r!l&&!r
002
MC/DC0%0/2
ref $len or not $len =~ /^\d+$/
ref $len not $len =~ /^\d+$/
Truth table33%1/3
A or not(B)
A= ref $lenB= not $len =~ /^\d+$/
ABresult
1X1
011
000
1122 0 _error($self,$op,$len);
1123 0 return undef;
1124 }
1125 2 return splice(@args,$n,$len);
1126  
1127 } elsif ($op eq "fill") {
1128 28 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 14 14 28
1129 14 ▶ if ($#args < 0 ||
Branch: 1 branch
BranchTrueFalseTotal
if ($#args < 0 or $#args > 3) 0 14 14
Condition33%1/3
$#args < 0 or $#args > 3
l!l&&r!l&&!r
0014
MC/DC0%0/2
$#args < 0 or $#args > 3
$#args < 0 $#args > 3
Truth table33%1/3
A or B
A= $#args < 0B= $#args > 3
ABresult
1X1
011
000
1130 $#args > 3) {
1131 0 _error($self,$op,\@args);
1132 0 return undef;
1133 }
1134 14 my $list = shift(@args);
1135 14 ▶ if (! ref($list)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $list) 0 14 14
1136 0 _error($self,$op,$list);
1137 0 return undef;
1138 }
1139 14 my @list = @$list;
1140  
1141 14 my $n;
1142 14 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) { } 13 1 14
1143 13 $n = shift(@args);
1144 } else {
1145 1 $n = 0;
1146 }
1147 14 ▶ if (ref($n) || $n !~ /^[-+]?\d+$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $n or not $n =~ /^[-+]?\d+$/) 0 14 14
Condition33%1/3
ref $n or not $n =~ /^[-+]?\d+$/
l!l&&r!l&&!r
0014
MC/DC0%0/2
ref $n or not $n =~ /^[-+]?\d+$/
ref $n not $n =~ /^[-+]?\d+$/
Truth table33%1/3
A or not(B)
A= ref $nB= not $n =~ /^[-+]?\d+$/
ABresult
1X1
011
000
1148 0 _error($self,$op,$n);
1149 0 return undef;
1150 }
1151  
1152 14 my $len;
1153 14 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 9 5 14
1154 9 $len = shift(@args);
1155 9 ▶ if (ref($len) || $len !~ /^[-+]?\d+$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $len or not $len =~ /^[-+]?\d+$/) 0 9 9
Condition33%1/3
ref $len or not $len =~ /^[-+]?\d+$/
l!l&&r!l&&!r
009
MC/DC0%0/2
ref $len or not $len =~ /^[-+]?\d+$/
ref $len not $len =~ /^[-+]?\d+$/
Truth table33%1/3
A or not(B)
A= ref $lenB= not $len =~ /^[-+]?\d+$/
ABresult
1X1
011
000
1156 0 _error($self,$op,$len);
1157 0 return undef;
1158 }
1159 9 ▶ return @list if (! $len);
Branch: 1 branch
BranchTrueFalseTotal
unless $len 0 9 9
1160 }
1161  
1162 14 my $val = "";
1163 14 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 2 12 14
1164 2 $val = shift(@args);
1165 }
1166  
1167 # Translate (N,LEN) to (X,Y) where X is index of
1168 # the first element to set and Y is the index of
1169 # the last element to set, and negative indexes
1170 # now refer to elements to add on the left.
1171  
1172 14 my($x,$y);
1173  
1174 14 ▶ if (! defined $len) {
Branch: 2 branches
BranchTrueFalseTotal
if (not defined $len) { } 5 9 14
elsif ($len < 0) { } 1 8 9
1175 5 ▶ if ($n < 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n < 0) { } 2 3 5
1176 2 $x = $n + $#list + 1;
1177 } else {
1178 3 $x = $n;
1179 }
1180 5 ▶ if ($x < 0) {
Branch: 2 branches
BranchTrueFalseTotal
if ($x < 0) { } 1 4 5
elsif ($x > $#list) { } 1 3 4
1181 1 $y = $x;
1182 } elsif ($x > $#list) {
1183 1 $y = $x;
1184 } else {
1185 3 $y = $#list;
1186 }
1187  
1188 } elsif ($len < 0) {
1189 1 ▶ if ($n < 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n < 0) { } 0 1 1
1190 0 $y = $n + $#list + 1;
1191 } else {
1192 1 $y = $n;
1193 }
1194 1 $x = $y + $len + 1;
1195 1 $len *= -1;
1196  
1197 } else {
1198 8 ▶ if ($n < 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n < 0) { } 4 4 8
1199 4 $x = $n + $#list + 1;
1200 } else {
1201 4 $x = $n;
1202 }
1203 8 $y = $x + $len - 1;
1204 }
1205  
1206 # If $x refers to elements left of the list, add them
1207 # and adjust ($x,$y) accordingly.
1208  
1209 14 ▶ while ($x < 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($x < 0) 8 14 22
1210 8 unshift(@list,"");
1211 8 $x++;
1212 8 $y++;
1213 }
1214  
1215 14 ▶ while ($y > $#list) {
Branch: 1 branch
BranchTrueFalseTotal
if ($y > $#list) 8 14 22
1216 8 push(@list,"");
1217 }
1218  
1219 # Now set the list range to the value.
1220  
1221 14 ▶ if (ref($val)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $val) { } 0 14 14
1222 0 ▶ for (my $i=$x; $i<=$y; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $y) 0 0 0
1223 0 $list[$i] = dclone($val);
1224 }
1225  
1226 } else {
1227 14 ▶ for (my $i=$x; $i<=$y; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $y) 28 14 42
1228 28 $list[$i] = $val;
1229 }
1230 }
1231  
1232 14 return @list;
1233  
1234 ▶ } elsif ($op eq "difference" || $op eq "d_difference") {
Condition100%3/3
$op eq "difference" or $op eq "d_difference"
l!l&&r!l&&!r
42309
MC/DC100%2/2
$op eq "difference" or $op eq "d_difference"
$op eq "difference" $op eq "d_difference"
Truth table100%3/3
A or B
A= $op eq "difference"B= $op eq "d_difference"
ABresult
1X1
011
000
1235 6 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 3 3 6
1236 3 ▶ if (! ref($args[0]) ||
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $args[0] and ref $args[1]) 0 3 3
Condition33%1/3
ref $args[0] and ref $args[1]
!ll&&!rl&&r
003
MC/DC0%0/2
ref $args[0] and ref $args[1]
ref $args[0] ref $args[1]
Truth table33%1/3
A and B
A= ref $args[0]B= ref $args[1]
ABresult
0X0
100
111
1237 ! ref($args[1])) {
1238 0 _error($self,$op,[@args]);
1239 0 return undef;
1240 }
1241 3 my @list1 = @{ $args[0] };
1242 3 my @list2 = @{ $args[1] };
1243  
1244 3 my %list2;
1245 3 foreach my $ele (@list2) {
1246 3 $list2{$ele}++;
1247 }
1248  
1249 3 my @ret;
1250 3 foreach my $ele (@list1) {
1251 11 ▶ if ($op eq "difference") {
Branch: 1 branch
BranchTrueFalseTotal
if ($op eq 'difference') { } 7 4 11
1252 7 ▶ push(@ret,$ele) if (! exists $list2{$ele});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $list2{$ele} 4 3 7
1253 } else {
1254 4 ▶ if (exists $list2{$ele} && $list2{$ele} > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $list2{$ele} and $list2{$ele} > 0) { } 1 3 4
Condition100%3/3
exists $list2{$ele} and $list2{$ele} > 0
!ll&&!rl&&r
211
MC/DC100%2/2
exists $list2{$ele} and $list2{$ele} > 0
exists $list2{$ele} $list2{$ele} > 0
Truth table100%3/3
A and B
A= exists $list2{$ele}B= $list2{$ele} > 0
ABresult
0X0
100
111
1255 1 $list2{$ele}--;
1256 } else {
1257 3 push(@ret,$ele);
1258 }
1259 }
1260 }
1261 3 return @ret;
1262  
1263 ▶ } elsif ($op eq "intersection" || $op eq "d_intersection") {
Condition100%3/3
$op eq "intersection" or $op eq "d_intersection"
l!l&&r!l&&!r
22305
MC/DC100%2/2
$op eq "intersection" or $op eq "d_intersection"
$op eq "intersection" $op eq "d_intersection"
Truth table100%3/3
A or B
A= $op eq "intersection"B= $op eq "d_intersection"
ABresult
1X1
011
000
1264 4 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 2 2 4
1265 2 ▶ if (! ref($args[0]) ||
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $args[0] and ref $args[1]) 0 2 2
Condition33%1/3
ref $args[0] and ref $args[1]
!ll&&!rl&&r
002
MC/DC0%0/2
ref $args[0] and ref $args[1]
ref $args[0] ref $args[1]
Truth table33%1/3
A and B
A= ref $args[0]B= ref $args[1]
ABresult
0X0
100
111
1266 ! ref($args[1])) {
1267 0 _error($self,$op,[@args]);
1268 0 return undef;
1269 }
1270 2 my @list1 = @{ $args[0] };
1271 2 my @list2 = @{ $args[1] };
1272  
1273 2 my %list2;
1274 2 foreach my $ele (@list2) {
1275 8 $list2{$ele}++;
1276 }
1277  
1278 2 my @ret;
1279 2 foreach my $ele (@list1) {
1280 8 ▶ if (exists $list2{$ele} && $list2{$ele} > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $list2{$ele} and $list2{$ele} > 0) 6 2 8
Condition66%2/3
exists $list2{$ele} and $list2{$ele} > 0
!ll&&!rl&&r
206
MC/DC50%1/2
exists $list2{$ele} and $list2{$ele} > 0
exists $list2{$ele} $list2{$ele} > 0
Truth table66%2/3
A and B
A= exists $list2{$ele}B= $list2{$ele} > 0
ABresult
0X0
100
111
1281 6 $list2{$ele}--;
1282 6 push(@ret,$ele);
1283 }
1284 }
1285 2 ▶ @ret = _operation($self,0,"unique",@ret) if ($op eq "intersection");
Branch: 1 branch
BranchTrueFalseTotal
if $op eq "intersection" 1 1 2
1286 2 return @ret;
1287  
1288 ▶ } elsif ($op eq "symdiff" || $op eq "d_symdiff") {
Condition100%3/3
$op eq "symdiff" or $op eq "d_symdiff"
l!l&&r!l&&!r
22301
MC/DC100%2/2
$op eq "symdiff" or $op eq "d_symdiff"
$op eq "symdiff" $op eq "d_symdiff"
Truth table100%3/3
A or B
A= $op eq "symdiff"B= $op eq "d_symdiff"
ABresult
1X1
011
000
1289 4 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 2 2 4
1290 2 ▶ if (! ref($args[0]) ||
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $args[0] and ref $args[1]) 0 2 2
Condition33%1/3
ref $args[0] and ref $args[1]
!ll&&!rl&&r
002
MC/DC0%0/2
ref $args[0] and ref $args[1]
ref $args[0] ref $args[1]
Truth table33%1/3
A and B
A= ref $args[0]B= ref $args[1]
ABresult
0X0
100
111
1291 ! ref($args[1])) {
1292 0 _error($self,$op,[@args]);
1293 0 return undef;
1294 }
1295 2 my @list1 = @{ $args[0] };
1296 2 my @list2 = @{ $args[1] };
1297  
1298 2 my %list1;
1299 2 foreach my $ele (@list1) {
1300 8 $list1{$ele}++;
1301 }
1302 2 my %list2;
1303 2 foreach my $ele (@list2) {
1304 8 $list2{$ele}++;
1305 }
1306  
1307 2 my @ret;
1308 2 ▶ if ($op eq "symdiff") {
Branch: 1 branch
BranchTrueFalseTotal
if ($op eq 'symdiff') { } 1 1 2
1309 1 foreach my $ele (@list1) {
1310 4 ▶ push(@ret,$ele) unless (exists $list2{$ele});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $list2{$ele} 1 3 4
1311 }
1312 1 foreach my $ele (@list2) {
1313 4 ▶ push(@ret,$ele) unless (exists $list1{$ele});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $list1{$ele} 0 4 4
1314 }
1315 1 @ret = _operation($self,0,"unique",@ret);
1316  
1317 } else {
1318 1 foreach my $ele (keys %list1) {
1319 3 ▶ if (exists $list2{$ele}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $list2{$ele}) 2 1 3
1320 2 my $min = _operation($self,0,"minval",$list1{$ele},$list2{$ele});
1321 2 $list1{$ele} -= $min;
1322 2 $list2{$ele} -= $min;
1323 }
1324 }
1325 1 foreach my $ele (@list2) {
1326 4 ▶ if (exists $list1{$ele}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $list1{$ele}) 4 0 4
1327 4 my $min = _operation($self,0,"minval",$list1{$ele},$list2{$ele});
1328 4 $list1{$ele} -= $min;
1329 4 $list2{$ele} -= $min;
1330 }
1331 }
1332 1 foreach my $ele (@list1) {
1333 4 ▶ push(@ret,$ele), $list1{$ele}-- if ($list1{$ele}>0);
Branch: 1 branch
BranchTrueFalseTotal
if $list1{$ele} > 0 1 3 4
1334 }
1335 1 foreach my $ele (@list2) {
1336 4 ▶ push(@ret,$ele), $list2{$ele}-- if ($list2{$ele}>0);
Branch: 1 branch
BranchTrueFalseTotal
if $list2{$ele} > 0 1 3 4
1337 }
1338 }
1339  
1340 2 return @ret;
1341  
1342 }
1343  
1344 #
1345 # Variable operations
1346 #
1347  
1348 301 ▶ if ($op eq "getvar") {
Branch: 6 branches
BranchTrueFalseTotal
if ($op eq 'getvar') { } 36 265 301
elsif ($op eq 'setvar') { } 4 261 265
elsif ($op eq 'default') { } 4 257 261
elsif ($op eq 'unsetvar') { } 2 255 257
elsif ($op eq 'pushvar' or $op eq 'unshiftvar') { } 8 247 255
elsif ($op eq 'popvar' or $op eq 'shiftvar') { } 4 243 247
1349 36 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 18 18 36
1350 return undef if ($#args != 0 ||
1351 ref($args[0]) ||
1352 18 ▶ ! exists $$self{"vars"}{$args[0]});
Branch: 1 branch
BranchTrueFalseTotal
if $#args != 0 or ref $args[0] or not exists $self->{"vars"}{$args[0]} 4 14 18
Condition50%3/6
$#args != 0 or ref $args[0] or not exists $self->{"vars"}{$args[0]}
l!l&&r!l&&!r
0414
$#args != 0 or ref $args[0]
l!l&&r!l&&!r
0018
MC/DC33%1/3
$#args != 0 or ref $args[0] or not exists $self->{"vars"}{$args[0]}
$#args != 0 ref $args[0] not exists $self->{"vars"}{$args[0]}
Truth table50%2/4
A or B or not(C)
A= $#args != 0B= ref $args[0]C= not exists $self->{"vars"}{$args[0]}
ABCresult
1XX1
01X1
0011
0000
1353 14 ▶ if (ref($$self{"vars"}{$args[0]})) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->{'vars'}{$args[0]}) { } 9 5 14
1354 9 return @{ $$self{"vars"}{$args[0]} };
1355 } else {
1356 5 return $$self{"vars"}{$args[0]};
1357 }
1358  
1359 } elsif ($op eq "setvar") {
1360 4 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 2 2 4
1361 2 ▶ return undef if ($#args != 1 ||
Branch: 1 branch
BranchTrueFalseTotal
if $#args != 1 or ref $args[0] 0 2 2
Condition33%1/3
$#args != 1 or ref $args[0]
l!l&&r!l&&!r
002
MC/DC0%0/2
$#args != 1 or ref $args[0]
$#args != 1 ref $args[0]
Truth table33%1/3
A or B
A= $#args != 1B= ref $args[0]
ABresult
1X1
011
000
1362 ref($args[0]));
1363 2 $$self{"vars"}{$args[0]} = $args[1];
1364 2 return $$self{"vars"}{$args[0]};
1365  
1366 } elsif ($op eq "default") {
1367 4 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 2 2 4
1368 2 ▶ return undef if ($#args != 1 ||
Branch: 1 branch
BranchTrueFalseTotal
if $#args != 1 or ref $args[0] 0 2 2
Condition33%1/3
$#args != 1 or ref $args[0]
l!l&&r!l&&!r
002
MC/DC0%0/2
$#args != 1 or ref $args[0]
$#args != 1 ref $args[0]
Truth table33%1/3
A or B
A= $#args != 1B= ref $args[0]
ABresult
1X1
011
000
1369 ref($args[0]));
1370 $$self{"vars"}{$args[0]} = $args[1]
1371 2 ▶ unless (exists $$self{"vars"}{$args[0]});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $self->{"vars"}{$args[0]} 1 1 2
1372 2 return $$self{"vars"}{$args[0]};
1373  
1374 } elsif ($op eq "unsetvar") {
1375 2 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 1 1 2
1376 1 ▶ return undef if ($#args != 0 ||
Branch: 1 branch
BranchTrueFalseTotal
if $#args != 0 or ref $args[0] 0 1 1
Condition33%1/3
$#args != 0 or ref $args[0]
l!l&&r!l&&!r
001
MC/DC0%0/2
$#args != 0 or ref $args[0]
$#args != 0 ref $args[0]
Truth table33%1/3
A or B
A= $#args != 0B= ref $args[0]
ABresult
1X1
011
000
1377 ref($args[0]));
1378 1 ▶ delete $$self{"vars"}{$args[0]} if (exists $$self{"vars"}{$args[0]});
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"vars"}{$args[0]} 1 0 1
1379 1 return undef;
1380  
1381 ▶ } elsif ($op eq "pushvar" || $op eq "unshiftvar") {
Condition100%3/3
$op eq "pushvar" or $op eq "unshiftvar"
l!l&&r!l&&!r
44247
MC/DC100%2/2
$op eq "pushvar" or $op eq "unshiftvar"
$op eq "pushvar" $op eq "unshiftvar"
Truth table100%3/3
A or B
A= $op eq "pushvar"B= $op eq "unshiftvar"
ABresult
1X1
011
000
1382 8 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 4 4 8
1383 4 ▶ return undef if ($#args != 1 ||
Branch: 1 branch
BranchTrueFalseTotal
if $#args != 1 or ref $args[0] 0 4 4
Condition33%1/3
$#args != 1 or ref $args[0]
l!l&&r!l&&!r
004
MC/DC0%0/2
$#args != 1 or ref $args[0]
$#args != 1 ref $args[0]
Truth table33%1/3
A or B
A= $#args != 1B= ref $args[0]
ABresult
1X1
011
000
1384 ref($args[0]));
1385 4 my $var = $args[0];
1386 4 ▶ if ($op eq "pushvar") {
Branch: 1 branch
BranchTrueFalseTotal
if ($op eq 'pushvar') { } 2 2 4
1387 2 ▶ if (exists $$self{"vars"}{$var}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'vars'}{$var}) { } 1 1 2
1388 1 ▶ if (ref($$self{"vars"}{$var})) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->{'vars'}{$var}) { } 1 0 1
1389 1 push @{ $$self{"vars"}{$var} },$args[1];
1390 } else {
1391 0 $$self{"vars"}{$var} = [ $$self{"vars"}{$var}, $args[1] ];
1392 }
1393 } else {
1394 1 $$self{"vars"}{$var} = [ $args[1] ];
1395 }
1396 } else {
1397 2 ▶ if (exists $$self{"vars"}{$var}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $self->{'vars'}{$var}) { } 1 1 2
1398 1 ▶ if (ref($$self{"vars"}{$var})) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->{'vars'}{$var}) { } 1 0 1
1399 1 unshift @{ $$self{"vars"}{$var} },$args[1];
1400 } else {
1401 0 $$self{"vars"}{$var} = [ $args[1], $$self{"vars"}{$var} ];
1402 }
1403 } else {
1404 1 $$self{"vars"}{$var} = [ $args[1] ];
1405 }
1406 }
1407 4 return undef;
1408  
1409 ▶ } elsif ($op eq "popvar" || $op eq "shiftvar") {
Condition100%3/3
$op eq "popvar" or $op eq "shiftvar"
l!l&&r!l&&!r
22243
MC/DC100%2/2
$op eq "popvar" or $op eq "shiftvar"
$op eq "popvar" $op eq "shiftvar"
Truth table100%3/3
A or B
A= $op eq "popvar"B= $op eq "shiftvar"
ABresult
1X1
011
000
1410 4 ▶ return 1 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 2 2 4
1411  
1412 return undef if ($#args != 0 ||
1413 ref($args[0]) ||
1414 ! exists $$self{"vars"}{$args[0]} ||
1415 2 ▶ ! ref($$self{"vars"}{$args[0]}));
Branch: 1 branch
BranchTrueFalseTotal
if $#args != 0 or ref $args[0] or not exists $self->{"vars"}{$args[0]} or not ref $self->{"vars"}{$args[0]} 0 2 2
Condition33%3/9
$#args != 0 or ref $args[0] or not exists $self->{"vars"}{$args[0]} or not ref $self->{"vars"}{$args[0]}
l!l&&r!l&&!r
002
$#args != 0 or ref $args[0] or not exists $self->{"vars"}{$args[0]}
l!l&&r!l&&!r
002
$#args != 0 or ref $args[0]
l!l&&r!l&&!r
002
MC/DC0%0/4
$#args != 0 or ref $args[0] or not exists $self->{"vars"}{$args[0]} or not ref $self->{"vars"}{$args[0]}
$#args != 0 ref $args[0] not exists $self->{"vars"}{$args[0]} not ref $self->{"vars"}{$args[0]}
Truth table20%1/5
A or B or not(C) or not(D)
A= $#args != 0B= ref $args[0]C= not exists $self->{"vars"}{$args[0]}D= not ref $self->{"vars"}{$args[0]}
ABCDresult
1XXX1
01XX1
001X1
00011
00000
1416 2 ▶ if ($op eq "popvar") {
Branch: 1 branch
BranchTrueFalseTotal
if ($op eq 'popvar') { } 1 1 2
1417 1 return pop @{ $$self{"vars"}{$args[0]} };
1418 } else {
1419 1 return shift @{ $$self{"vars"}{$args[0]} };
1420 }
1421  
1422 }
1423  
1424 #
1425 # Error
1426 #
1427  
1428 243 ▶ return 0 if ($test);
Branch: 1 branch
BranchTrueFalseTotal
if $test 243 0 243
1429 0 die "ERROR: impossible error: _operation: $op";
1430 }
1431  
1432 ########################################################################
1433 # MISC
1434 ########################################################################
1435  
1436 10 ▶sub _flatten {
Subroutine _flatten: called CC=3 SCAR=11.0
1437 10 my(@list) = @_;
1438  
1439 10 my @ret = ();
1440 10 foreach my $ele (@list) {
1441 33 ▶ if (ref($ele) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele eq 'ARRAY') { } 3 30 33
1442 3 push(@ret,_flatten(@$ele));
1443 } else {
1444 30 push(@ret,$ele);
1445 }
1446 }
1447  
1448 10 return @ret;
1449 }
1450  
1451 # This tests a list index ($n) to see if it is valid for a list
1452 # containing $length+1 elements (i.e. $#list was passwd in as
1453 # the second element).
1454 #
1455 # List index can go from 0 to $length or -($length+1) to -1.
1456 #
1457 11 ▶sub _valid_index {
Subroutine _valid_index: called CC=5 SCAR=16.1
1458 11 my($n,$length) = @_;
1459 11 ▶ return 1 if ($n >= 0 && $n <= $length);
Branch: 1 branch
BranchTrueFalseTotal
if $n >= 0 and $n <= $length 8 3 11
Condition100%3/3
$n >= 0 and $n <= $length
!ll&&!rl&&r
218
MC/DC100%2/2
$n >= 0 and $n <= $length
$n >= 0 $n <= $length
Truth table100%3/3
A and B
A= $n >= 0B= $n <= $length
ABresult
0X0
100
111
1460 3 ▶ return 1 if ($n >= -($length+1) && $n <= -1);
Branch: 1 branch
BranchTrueFalseTotal
if $n >= -($length + 1) and $n <= -1 2 1 3
Condition66%2/3
$n >= -($length + 1) and $n <= -1
!ll&&!rl&&r
012
MC/DC50%1/2
$n >= -($length + 1) and $n <= -1
$n >= -($length + 1) $n <= -1
Truth table66%2/3
A and B
A= $n >= -($length + 1)B= $n <= -1
ABresult
0X0
100
111
1461 1 return 0;
1462 }
1463  
1464 1 ▶sub _ele_to_string {
Subroutine _ele_to_string: called CC=3 SCAR=15.1
1465 1 my($ele) = @_;
1466  
1467 1 ▶ if (ref($ele)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $ele) { } 0 1 1
1468 0 my @string = ();
1469 0 foreach my $e (@$ele) {
1470 0 push(@string,_ele_to_string($e));
1471 }
1472 0 return '[ ' . join(" ",@string) . ' ]';
1473  
1474 } else {
1475 1 return $ele;
1476 }
1477 }
1478  
1479 1 ▶sub _error {
Subroutine _error: called CC=7 SCAR=24.0
1480 1 my($self,$op,$ele) = @_;
1481 1 my $string = _ele_to_string($ele);
1482  
1483 1 ▶ if ($$self{"warn"} eq "stderr" || $$self{"warn"} eq "both") {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"warn"} eq "stderr" or $self->{"warn"} eq "both") 0 1 1
Condition33%1/3
$self->{"warn"} eq "stderr" or $self->{"warn"} eq "both"
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->{"warn"} eq "stderr" or $self->{"warn"} eq "both"
$self->{"warn"} eq "stderr" $self->{"warn"} eq "both"
Truth table33%1/3
A or B
A= $self->{"warn"} eq "stderr"B= $self->{"warn"} eq "both"
ABresult
1X1
011
000
1484 0 warn "WARNING: invalid argument: $op: $string\n";
1485 }
1486  
1487 1 ▶ if ($$self{"warn"} eq "stdout" || $$self{"warn"} eq "both") {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"warn"} eq "stdout" or $self->{"warn"} eq "both") 0 1 1
Condition33%1/3
$self->{"warn"} eq "stdout" or $self->{"warn"} eq "both"
l!l&&r!l&&!r
001
MC/DC0%0/2
$self->{"warn"} eq "stdout" or $self->{"warn"} eq "both"
$self->{"warn"} eq "stdout" $self->{"warn"} eq "both"
Truth table33%1/3
A or B
A= $self->{"warn"} eq "stdout"B= $self->{"warn"} eq "both"
ABresult
1X1
011
000
1488 0 print "WARNING: invalid argument: $op: $string\n";
1489 }
1490  
1491 1 ▶ exit if ($$self{"err"} eq "exit");
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"err"} eq "exit" 0 1 1
1492 1 ▶ return 1 if ($$self{"err"} eq "return");
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"err"} eq "return" 0 1 1
1493 1 return 0;
1494 }
1495  
1496 ########################################################################
1497 # FROM MY PERSONAL LIBRARIES
1498 ########################################################################
1499  
1500 77 ▶sub _isnum {
Subroutine _isnum: called CC=12 SCAR=38.0
1501 77 my($n,$low,$high)=@_;
1502 77 ▶ return undef if (! defined $n);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $n 0 77 77
1503 77 ▶ return 0 if ($n !~ /^\s*([+-]?)\s*(\d+\.?\d*)\s*$/ and
Branch: 1 branch
BranchTrueFalseTotal
unless $n =~ /^\s*([+-]?)\s*(\d+\.?\d*)\s*$/ or $n =~ /^\s*([+-]?)\s*(\.\d+)\s*$/ 0 77 77
Condition33%1/3
$n =~ /^\s*([+-]?)\s*(\d+\.?\d*)\s*$/ or $n =~ /^\s*([+-]?)\s*(\.\d+)\s*$/
l!l&&r!l&&!r
7700
MC/DC0%0/2
$n =~ /^\s*([+-]?)\s*(\d+\.?\d*)\s*$/ or $n =~ /^\s*([+-]?)\s*(\.\d+)\s*$/
$n =~ /^\s*([+-]?)\s*(\d+\.?\d*)\s*$/ $n =~ /^\s*([+-]?)\s*(\.\d+)\s*$/
Truth table33%1/3
A or B
A= $n =~ /^\s*([+-]?)\s*(\d+\.?\d*)\s*$/B= $n =~ /^\s*([+-]?)\s*(\.\d+)\s*$/
ABresult
1X1
011
000
1504 $n !~ /^\s*([+-]?)\s*(\.\d+)\s*$/);
1505 77 $n="$1$2";
1506 77 ▶ if (defined $low and length($low)>0) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $low and length $low > 0) 0 77 77
Condition33%1/3
defined $low and length $low > 0
!ll&&!rl&&r
7700
MC/DC0%0/2
defined $low and length $low > 0
defined $low length $low > 0
Truth table33%1/3
A and B
A= defined $lowB= length $low > 0
ABresult
0X0
100
111
1507 0 ▶ return undef if (! _isnum($low));
Branch: 1 branch
BranchTrueFalseTotal
unless _isnum($low) 0 0 0
1508 0 ▶ return 0 if ($n<$low);
Branch: 1 branch
BranchTrueFalseTotal
if $n < $low 0 0 0
1509 }
1510 77 ▶ if (defined $high and length($high)>0) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $high and length $high > 0) 0 77 77
Condition33%1/3
defined $high and length $high > 0
!ll&&!rl&&r
7700
MC/DC0%0/2
defined $high and length $high > 0
defined $high length $high > 0
Truth table33%1/3
A and B
A= defined $highB= length $high > 0
ABresult
0X0
100
111
1511 0 ▶ return undef if (! _isnum($high));
Branch: 1 branch
BranchTrueFalseTotal
unless _isnum($high) 0 0 0
1512 0 ▶ return 0 if ($n>$high);
Branch: 1 branch
BranchTrueFalseTotal
if $n > $high 0 0 0
1513 }
1514 77 return 1;
1515 }
1516  
1517 4 1;
1518 # Local Variables:
1519 # mode: cperl
1520 # indent-tabs-mode: nil
1521 # cperl-indent-level: 3
1522 # cperl-continued-statement-offset: 2
1523 # cperl-continued-brace-offset: 0
1524 # cperl-brace-offset: 0
1525 # cperl-brace-imaginary-offset: 0
1526 # cperl-label-offset: -2
1527 # End:
↑ Summary