lib/Badger/Data/Facet/Number.pm

filter: Statementstmt 100% 6 / 6 Branchbran n/a Conditioncond 75.0% 3 / 4 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 2 / 2 Podpod 100% 1 / 1 totaltotal 75.0% 12 / 16 CC 3 SCAR 9.3
CC
3
Cov
90%
validate
3.0
BEGIN
1.0
CRAP 2.5
« lib/Badger/Data/Facet/Class.pm ↑ Summary lib/Badger/Data/Facet/List/MaxSize.pm »
1 package Badger::Data::Facet::Number;
2  
3 use Badger::Class
4 1 version => 0.01,
5 base => 'Badger::Data::Facet',
6 utils => 'numlike',
7 messages => {
8 not_number => '%s is not a number (got %s)',
9 too_small => '%s should be no less than %d (got %d)',
10 too_large => '%s should be no more than %d (got %d)',
11 1 ▶ };
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13  
14 sub validate {
15 2 ▶ my ($self, $value, $type) = @_;
Subroutine validate: called CC=3 SCAR=11.1
Pod documented
16  
17 2 ▶ return numlike $$value
Condition75%3/4
&numlike($$value) || $self->invalid_msg('not_number', $type || 'Text', $$value)
l!l
11
$type || 'Text'
l!l
10
MC/DC0%0/2
&numlike($$value) || $self->invalid_msg('not_number', $type || 'Text', $$value)
&numlike($$value) $self->invalid_msg('not_number', $type || 'Text', $$value)
MC/DC0%0/1
$type || 'Text'
$type
Truth table66%2/3
A || B
A= &numlike($$value)B= $self->invalid_msg('not_number', $type || 'Text', $$value)
ABresult
1X1
011
000
Truth table50%1/2
A
A= $type
Aresult
11
00
18 || $self->invalid_msg( not_number => $type || 'Text', $$value );
19 }
20  
21  
22 1 1;
23  
24 __END__
« lib/Badger/Data/Facet/Class.pm ↑ Summary lib/Badger/Data/Facet/List/MaxSize.pm »