SDK/Storage/Tables/Filter.pm

filter: Statementstmt 100% 41 / 41 Branchbran 70.0% 14 / 20 Conditioncond 44.4% 4 / 9 MC/DCmcdc 20.0% 1 / 5 Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 1 totaltotal 81.1% 69 / 85 CC 16 SCAR 22.3
CC
16
Cov
84%
__ANON__
15.4
_literal
4.1
BEGIN
1.0
CRAP 9.3
« SDK/Core/Transport/Default.pm ↑ Summary SDK/Storage/Tables/SharedKey.pm »
1 5 ▶use v5.36;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 5 ▶use feature 'class';
Subroutine BEGIN: called CC=1 SCAR=0.0
3 5 ▶no warnings 'experimental::class';
Subroutine BEGIN: called CC=1 SCAR=0.0
4
5 5 ▶use Azure::SDK::Storage::Tables::EntityProperty;
Subroutine BEGIN: called CC=1 SCAR=0.0
6
7 5 class Azure::SDK::Storage::Tables::Filter {
8 5 ▶ use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 5 ▶ use Scalar::Util qw(blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
10
11 5 field $expression :param :reader;
12 5 field $parameters :param = {};
13 5 field $rendered = undef;
14
15 5 ▶ ADJUST {
Subroutine __ANON__: called CC=13 SCAR=27.4
16 5 ▶ croak 'Table filter expression is required'
Branch: 1 branch
BranchTrueFalseTotal
unless defined $expression and not ref $expression and length $expression 0 5 5
Condition33%2/6
defined $expression and not ref $expression and length $expression
!ll&&!rl&&r
005
defined $expression and not ref $expression
!ll&&!rl&&r
005
MC/DC0%0/3
defined $expression and not ref $expression and length $expression
defined $expression not ref $expression length $expression
Truth table25%1/4
A and not(B) and C
A= defined $expressionB= not ref $expressionC= length $expression
ABCresult
0XX0
10X0
1100
1111
17 unless defined $expression && !ref $expression && length $expression;
18 5 ▶ croak 'Table filter expression must not contain control characters'
Branch: 1 branch
BranchTrueFalseTotal
if $expression =~ /[\x00-\x1f\x7f]/u 0 5 5
19 if $expression =~ /[\x00-\x1f\x7f]/;
20 5 ▶ croak 'Table filter parameters must be a hash reference'
Branch: 1 branch
BranchTrueFalseTotal
unless ref $parameters eq "HASH" 0 5 5
21 unless ref $parameters eq 'HASH';
22
23 5 my %used;
24 5 ▶ while ($expression =~ /\@([A-Za-z_][A-Za-z0-9_]*)/g) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expression =~ /\@([A-Za-z_][A-Za-z0-9_]*)/gu) 7 5 12
25 7 $used{$1} = 1;
26 }
27 5 for my $name (sort keys %used) {
28 croak "Table filter parameter '$name' has no bound value"
29 7 ▶ unless exists $parameters->{$name};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $parameters->{$name} 2 5 7
30 }
31
32 3 for my $name (keys $parameters->%*) {
33 5 ▶ croak "Invalid Table filter parameter name '$name'"
Branch: 1 branch
BranchTrueFalseTotal
unless $name =~ /\A[A-Za-z_][A-Za-z0-9_]*\z/u 0 5 5
34 unless $name =~ /\A[A-Za-z_][A-Za-z0-9_]*\z/;
35 croak "Table filter parameter '$name' is not used"
36 5 ▶ unless $used{$name};
Branch: 1 branch
BranchTrueFalseTotal
unless $used{$name} 1 4 5
37 }
38
39 2 $rendered = $expression;
40 2 $rendered =~ s/\@([A-Za-z_][A-Za-z0-9_]*)/_literal($1, $parameters->{$1})/ge;
41 2 ▶ croak 'Table filter contains an unrecognized parameter placeholder'
Branch: 1 branch
BranchTrueFalseTotal
if $rendered =~ /\@/u 0 2 2
42 if $rendered =~ /\@/;
43 }
44
45 4 ▶ method to_string () {
Subroutine to_string: called CC=1 SCAR=0.0
Pod undocumented
46 4 return $rendered;
47 }
48
49 4 ▶ sub _literal ( $name, $value ) {
Subroutine _literal: called CC=4 SCAR=14.2
50 4 ▶ croak "Table filter parameter '$name' has no bound value"
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 0 4 4
51 unless defined $value;
52 4 ▶ my $property = blessed($value)
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($value) && $value->isa('Azure::SDK::Storage::Tables::EntityProperty') ? : 2 2 4
Condition66%2/3
builtin::blessed($value) and $value->isa("Azure::SDK::Storage::Tables::EntityProperty")
!ll&&!rl&&r
202
MC/DC50%1/2
builtin::blessed($value) and $value->isa("Azure::SDK::Storage::Tables::EntityProperty")
builtin::blessed($value) $value->isa("Azure::SDK::Storage::Tables::EntityProperty")
Truth table66%2/3
A and B
A= builtin::blessed($value)B= $value->isa("Azure::SDK::Storage::Tables::EntityProperty")
ABresult
0X0
100
111
53 && $value->isa('Azure::SDK::Storage::Tables::EntityProperty')
54 ? $value
55 : Azure::SDK::Storage::Tables::EntityProperty->string($value);
56 4 return $property->odata_literal;
57 }
58 }
59
60 5 1;
61
62 __END__
« SDK/Core/Transport/Default.pm ↑ Summary SDK/Storage/Tables/SharedKey.pm »