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   1456 use strict;
  4         6  
  4         114  
4 4     4   15 use warnings;
  4         6  
  4         111  
5              
6 4     4   15 use base 'Salvation::TC::Type::Number';
  4         6  
  4         1103  
7              
8 4     4   19 use Salvation::TC::Exception::WrongType ();
  4         5  
  4         384  
9              
10             my $re = qr/^[-+]?\d+$/;
11              
12             sub Check {
13              
14 51     51 1 48 my ( $class, $value ) = @_;
15              
16 51 100       79 defined( $value ) || Salvation::TC::Exception::WrongType -> throw( 'type' => 'Integer', 'value' => 'UNDEFINED' );
17 49 100       348 ( $value =~ $re ) || Salvation::TC::Exception::WrongType -> throw( 'type' => 'Number::Integer', 'value' => $value );
18             }
19              
20             1;
21             __END__