blib/lib/UR/BoolExpr/Template/PropertyComparison/Between.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 12 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 49 SCAR 30.0
CC
4
Cov
0%
_compare
20.0
BEGIN
2.0
BEGIN
2.0
CRAP 20.0
1 package UR::BoolExpr::Template::PropertyComparison::Between;
2  
3 use strict;
4 use warnings;
5 use UR;
6 our $VERSION = "0.46"; # UR $VERSION;
7  
8 UR::Object::Type->define(
9 class_name => __PACKAGE__,
10 is => ['UR::BoolExpr::Template::PropertyComparison'],
11 );
12  
13 sub _compare {
14 my ($self, $value, @property_value) = @_;
15 my $lower_bound = $value->[0];
16 my $upper_bound = $value->[1];
17  
18 my $cv_is_number = Scalar::Util::looks_like_number($lower_bound)
19 and
20 Scalar::Util::looks_like_number($upper_bound);
21  
22 no warnings 'uninitialized';
23 foreach my $property_value ( @property_value ) {
24 my $pv_is_number = Scalar::Util::looks_like_number($property_value);
25  
26 if ($cv_is_number and $pv_is_number) {
27 return 1 if ( $property_value >= $lower_bound and $property_value <= $upper_bound);
28 } else {
29 return 1 if ( $property_value ge $lower_bound and $property_value le $upper_bound);
30 }
31 }
32 return '';
33 }
34  
35  
36 1;
37  
38 =pod
39  
40 =head1 NAME
41  
42 UR::BoolExpr::Template::PropertyComparison::Between - perform a 'between' test
43  
44 =head1 DESCRIPTION
45  
46 Evaluates to true of the property's value is between the lower and upper bounds, inclusive.
47 If the property returns multiple values, this comparison returns true if any of the values are
48 within the bounds.
49  
50 =cut