File Coverage

blib/lib/Salvation/TC/Type/Number/Integer.pm
Criterion Covered Total %
statement 15 15 100.0
branch 4 4 100.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 25 25 100.0


line stmt bran cond sub pod time code
1             package Salvation::TC::Type::Number::Integer;
2              
3 4     4   1517 use strict;
  4         6  
  4         117  
4 4     4   15 use warnings;
  4         7  
  4         94  
5              
6 4     4   14 use base 'Salvation::TC::Type::Number';
  4         5  
  4         503  
7              
8 4     4   18 use Salvation::TC::Exception::WrongType ();
  4         5  
  4         394  
9              
10             my $re = qr/^[-+]?\d+$/;
11              
12             sub Check {
13              
14 59     59 1 69 my ( $class, $value ) = @_;
15              
16 59 100       115 defined( $value ) || Salvation::TC::Exception::WrongType -> throw( 'type' => 'Integer', 'value' => 'UNDEFINED' );
17 57 100       467 ( $value =~ $re ) || Salvation::TC::Exception::WrongType -> throw( 'type' => 'Number::Integer', 'value' => $value );
18             }
19              
20             1;
21             __END__