lib/UR/BoolExpr/Template/PropertyComparison/Equals.pm

filter: Statementstmt 64.2% 18 / 28 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 5 / 6 Podpod n/a totaltotal 46.9% 23 / 49 CC 8 SCAR 32.2
CC
8
Cov
44%
_compare
39.9
BEGIN
1.0
BEGIN
1.0
CRAP 25.0
« blib/lib/UR/BoolExpr/Template/PropertyComparison/NotEquals.pm ↑ Summary blib/lib/Command/V2.pm »
1 package UR::BoolExpr::Template::PropertyComparison::Equals;
2 266 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 266 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 266 ▶use UR;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 266 our $VERSION = "0.47"; # UR $VERSION;
6  
7 266 UR::Object::Type->define(
8 class_name => __PACKAGE__,
9 is => ['UR::BoolExpr::Template::PropertyComparison'],
10 );
11  
12 0 ▶sub _compare {
Subroutine _compare: not called CC=8 SCAR=36.9
13 0 my ($class,$comparison_value,@property_values) = @_;
14
15 266 ▶ no warnings 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
16 0 ▶ if (@property_values == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if (@property_values == 0) 0 0 0
17 0 ▶ return ($comparison_value eq '' ? 1 : '');
Branch: 1 branch
BranchTrueFalseTotal
$comparison_value eq '' ? : 0 0 0
18 }
19  
20 266 ▶ no warnings 'numeric';
Subroutine BEGIN: called CC=1 SCAR=0.0
21 0 my $cv_is_number = Scalar::Util::looks_like_number($comparison_value);
22  
23 0 foreach my $property_value ( @property_values ) {
24 0 my $pv_is_number = Scalar::Util::looks_like_number($property_value);
25 0 ▶ if ($pv_is_number and $cv_is_number) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pv_is_number and $cv_is_number) { } 0 0 0
Condition0%0/3
$pv_is_number and $cv_is_number
!ll&&!rl&&r
000
MC/DC0%0/2
$pv_is_number and $cv_is_number
$pv_is_number $cv_is_number
Truth table0%0/3
A and B
A= $pv_is_numberB= $cv_is_number
ABresult
0X0
100
111
26 0 ▶ return 1 if $property_value == $comparison_value;
Branch: 1 branch
BranchTrueFalseTotal
if $property_value == $comparison_value 0 0 0
27 } else {
28 0 ▶ return 1 if $property_value eq $comparison_value;
Branch: 1 branch
BranchTrueFalseTotal
if $property_value eq $comparison_value 0 0 0
29 }
30 }
31  
32 0 return '';
33 }
34  
35  
36 266 1;
37  
38 =pod
39  
40 =head1 NAME
41  
42 UR::BoolExpr::Template::PropertyComparison::Equals - perform a strictly equals test
43  
44 =head1 DESCRIPTION
45  
46 If the property returns multiple values, this comparison returns true if any of the values are equal to the comparison value
47  
48 =cut
« blib/lib/UR/BoolExpr/Template/PropertyComparison/NotEquals.pm ↑ Summary blib/lib/Command/V2.pm »