| 1 | 25 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 25 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | # ABSTRACT: a tolerance "m < n" | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | package | ||||||||||||||||||||||||||||
| 6 | Number::Tolerant::Type::less_than; | ||||||||||||||||||||||||||||
| 7 | 25 | ▶ | use parent qw(Number::Tolerant::Type); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 9 | ▶ | sub construct { shift; { value => $_[0], max => $_[0], exclude_max => 1 } } | ||||||||||||||||||||||||||
|
Subroutine
construct: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 32 | ▶ | sub parse { | ||||||||||||||||||||||||||
|
Subroutine
parse: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||
| 12 | 32 | my ($self, $string, $factory) = @_; | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 32 | my $number = $self->number_re; | |||||||||||||||||||||||||||
| 15 | 32 | my $X = $self->variable_re; | |||||||||||||||||||||||||||
| 16 | 32 | ▶ | return $factory->new(less_than => "$1") if $string =~ m!\A$X?<\s*($number)\z!; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 17 | 31 | ▶ | return $factory->new(less_than => "$1") if $string =~ m!\A($number)\s*>$X\z!; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 30 | ▶ | return $factory->new(less_than => "$1") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 20 | if $string =~ m!\Aless\s+than\s+($number)\z!; | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 29 | return; | |||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 99 | ▶ | sub valid_args { | ||||||||||||||||||||||||||
|
Subroutine
valid_args: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||
| 26 | 99 | my $self = shift; | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 99 | ▶ | return unless 2 == grep { defined } @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 38 | for my $i ( [0,1], [1,0] ) { | |||||||||||||||||||||||||||
| 31 | 72 | ▶ | if ( | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$_[$i->[0]] eq "less_than" and defined(my $num = $self->normalize_number($_[$i->[1]]))
MC/DC50%1/2
$_[$i->[0]] eq "less_than" and defined(my $num = $self->normalize_number($_[$i->[1]]))
$_[$i->[0]] eq "less_than"
defined(my $num = $self->normalize_number($_[$i->[1]]))
Truth table66%2/3
A and B
A= $_[$i->[0]] eq "less_than"B= defined(my $num = $self->normalize_number($_[$i->[1]]))
| |||||||||||||||||||||||||||||
| 32 | $_[ $i->[0] ] eq 'less_than' | ||||||||||||||||||||||||||||
| 33 | and defined (my $num = $self->normalize_number($_[ $i->[1] ])) | ||||||||||||||||||||||||||||
| 34 | ) { | ||||||||||||||||||||||||||||
| 35 | 9 | return $num; | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 29 | return; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 25 | 1; | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | __END__ | ||||||||||||||||||||||||||||