Branch Coverage

blib/lib/Jmespath/Functions.pm
Criterion Covered Total %
branch 220 254 86.6


line true false branch
56 2 8 if scalar @args < 1 or scalar @args > 1
61 1 7 if &JSON::is_bool($arg)
66 1 6 unless &looks_like_number($arg)
75 3 3 if ref $values ne 'ARRAY'
79 2 8 unless &looks_like_number($_)
88 1 5 if &JSON::is_bool($subject)
92 3 2 if (ref $subject eq 'ARRAY') { }
2 0 elsif (ref $subject eq '') { }
94 2 4 if $_ eq $search
99 1 1 if $subject =~ /$search/u
107 0 5 unless defined $value
111 1 4 unless &looks_like_number($value)
120 1 5 if &looks_like_number($suffix)
124 3 2 if $subject =~ /$suffix$/u
130 4 21 unless defined $left or defined $right
131 45 239 unless defined $left and defined $right
134 56 183 if (ref $left eq 'JSON::PP::Boolean' or ref $right eq 'JSON::PP::Boolean')
136 8 48 if (ref $left eq 'JSON::PP::Boolean' and ref $right eq 'JSON::PP::Boolean')
138 4 4 if $left == $right
146 43 140 if (ref $left eq 'HASH' or ref $right eq 'HASH')
147 11 32 if (ref $left eq 'HASH' and ref $right eq 'HASH')
148 5 6 if hashes_equal($left, $right)
153 24 116 if (ref $left eq 'ARRAY' or ref $right eq 'ARRAY')
154 8 16 if (ref $left eq 'ARRAY' and ref $right eq 'ARRAY')
155 4 4 if arrays_equal($left, $right)
160 87 29 if (&looks_like_number($left) and &looks_like_number($right)) { }
29 0 elsif (not &looks_like_number($left) || &looks_like_number($right)) { }
162 50 37 if $left == $right
166 11 18 if $left eq $right
173 0 5 unless defined $value
177 2 3 unless &looks_like_number($value)
189 0 18 unless &looks_like_number($left)
190 0 18 unless &looks_like_number($right)
191 7 11 if $left > $right
199 0 4 unless &looks_like_number($left)
200 0 4 unless &looks_like_number($right)
201 2 2 if $left >= $right
209 0 22 unless &looks_like_number($left)
210 0 22 unless &looks_like_number($right)
211 10 12 if $left < $right
219 0 4 unless &looks_like_number($left)
220 0 4 unless &looks_like_number($right)
221 3 1 if $left <= $right
227 1 9 if ref $array ne 'ARRAY'
231 1 8 if jp_type($glue) ne 'string'
237 2 15 if jp_type($_) ne 'string' and ref $_ ne 'Jmespath::String'
248 3 2 if ref $obj ne 'HASH'
260 2 9 if &JSON::is_bool($subject) or &looks_like_number($subject)
264 1 8 if ref $subject eq 'ARRAY'
265 2 6 if ref $subject eq 'HASH'
272 1 7 unless defined $elements
279 0 29 unless defined $element
293 1 9 if ref $collection ne 'ARRAY'
299 8 25 unless defined $current_type
300 8 25 unless defined $current_max
302 1 32 if $type ne $current_type
307 0 32 if $type ne 'number' and $type ne 'string'
312 11 21 if (&looks_like_number($arg) and $arg > $current_max)
313 2 30 if (not &looks_like_number($arg) and $arg gt $current_max)
324 2 17 if not defined $result or &JSON::is_bool($result)
354 0 10 if ref $object ne 'HASH'
367 1 9 if ref $collection ne 'ARRAY'
373 8 25 unless defined $current_type
374 8 25 unless defined $current_min
376 1 32 if $type ne $current_type
379 0 32 if $type ne 'number' and $type ne 'string'
382 9 23 if (&looks_like_number($arg) and $arg < $current_min)
383 0 32 if (not &looks_like_number($arg) and $arg lt $current_min)
394 2 17 if not defined $result or &JSON::is_bool($result)
406 2 14 unless defined $left or defined $right
407 28 100 unless defined $left and defined $right
409 48 52 if (ref $left eq 'JSON::PP::Boolean' or ref $right eq 'JSON::PP::Boolean')
411 8 40 if (ref $left eq 'JSON::PP::Boolean' and ref $right eq 'JSON::PP::Boolean')
413 4 4 if $left != $right
422 24 28 if (ref $left eq 'HASH' or ref $right eq 'HASH')
423 4 20 if (ref $left eq 'HASH' and ref $right eq 'HASH')
424 2 2 if hashes_equal($left, $right)
429 16 12 if (ref $left eq 'ARRAY' or ref $right eq 'ARRAY')
430 4 12 if (ref $left eq 'ARRAY' and ref $right eq 'ARRAY')
431 2 2 if arrays_equal($left, $right)
437 12 0 if (&looks_like_number($left) and &looks_like_number($right))
439 7 5 if $left != $right
450 1 9 unless @arguments
456 18 8 unless defined $argument
457 8 0 if defined $argument
465 3 2 if (ref $arg eq 'ARRAY') { }
2 0 elsif (ref $arg eq '') { }
480 2 7 if not defined $list or ref $list ne 'ARRAY'
486 0 19 if ref $_ ne ''
490 6 13 unless defined $current_type
491 0 19 if $current_type ne 'string' and $current_type ne 'number'
495 1 18 if $current_type ne jp_type($_)
511 1 10 unless defined $expref
518 9 36 unless defined $current_type
520 2 43 if jp_type($evaled) ne $current_type
524 1 42 if not defined $evaled or &JSON::is_bool($evaled)
540 0 5 unless defined $subject and defined $prefix
542 1 4 if &looks_like_number($prefix)
544 3 1 if $subject =~ /^$prefix/u
552 1 20 unless &looks_like_number($value)
563 1 4 if &JSON::is_bool($arg)
564 1 3 if ref $arg eq 'HASH'
565 1 2 if ref $arg eq 'ARRAY'
571 1 9 if jp_type($arg) eq 'object' or jp_type($arg) eq 'array'
574 8 2 if jp_type($arg) eq 'number'
582 6 29 unless &looks_like_number($arg)
583 1 28 if &JSON::is_bool($arg)
590 2 210 unless defined $item
591 4 206 if (&JSON::is_bool($item))
592 146 60 if (&looks_like_number($item))
593 0 146 if ref $item eq 'Jmespath::String'
596 3 57 if (ref $item eq 'ARRAY')
597 2 55 if (ref $item eq 'HASH')
603 1 1 if ref $obj ne 'HASH'
617 0 14 if (scalar @$a != scalar @$b)
623 0 14 if (ref $va ne ref $vb) { }
6 8 elsif (ref $va eq '' and ref $vb eq '' and $va ne $vb) { }
0 8 elsif (ref $va eq 'SCALAR' and $va ne $vb) { }
0 8 elsif (ref $va eq 'ARRAY' and not arrays_equal($va, $vb)) { }
0 16 elsif (ref $va eq 'HASH' and not hashes_equal($va, $vb)) { }
644 0 15 if (scalar keys %$a != scalar keys %$b)
648 11 6 if (exists $b->{$k}) { }
651 0 11 if (ref $va ne ref $vb) { }
2 9 elsif (ref $va eq '' and ref $vb eq '' and $va ne $vb) { }
0 9 elsif (ref $va eq 'SCALAR' and $va ne $vb) { }
0 9 elsif (ref $va eq 'ARRAY' and not arrays_equal($va, $vb)) { }
0 18 elsif (ref $va eq 'HASH' and not hashes_equal($va, $vb)) { }