| 1 | package Salvation::TC::Type::Text; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use base 'Salvation::TC::Type'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 4 | ▶ | use Salvation::TC::Exception::WrongType (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | sub Check { | ||||||||||||||||||||||||||||||||||||||||||
| 12 | 0 | ▶ | my ( $class, $value ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Check: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 0 | ▶ | ( ! ref( $value ) && $value ne '' ) || Salvation::TC::Exception::WrongType -> throw( 'type' => 'Text', 'value' => $value ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not ref $value and $value ne ""
MC/DC0%0/2
not ref $value and $value ne ""
not ref $value
$value ne ""
Truth table0%0/3
not(A) and B
A= not ref $valueB= $value ne ""
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | sub create_length_validator { | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 9 | ▶ | my ( $class, $min, $max ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_length_validator: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | return sub { | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 22 | ▶ | my $len = length( $_[ 0 ] ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 22 | ▶ | if( ( $len < $min ) || ( defined $max && ( $len > $max ) ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
$len < $min or defined $max and $len > $max
defined $max and $len > $max
MC/DC66%2/3
$len < $min or defined $max and $len > $max
$len < $min
defined $max
$len > $max
Truth table75%3/4
A or B and C
A= $len < $minB= defined $maxC= $len > $max
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 7 | ▶ | Salvation::TC::Exception::WrongType -> throw( | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$max // ""
MC/DC100%1/1
$max // ""
$max
Truth table100%2/2
A
A= $max
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 'type' => sprintf( 'Text{%s,%s}', $min, ( $max // '' ) ), | ||||||||||||||||||||||||||||||||||||||||||
| 28 | 'value' => $_[ 0 ] | ||||||||||||||||||||||||||||||||||||||||||
| 29 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 15 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 33 | 9 | }; | |||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 4 | 1 | |||||||||||||||||||||||||||||||||||||||||
| 37 | __END__ | ||||||||||||||||||||||||||||||||||||||||||