File Coverage

lib/Net/EGTS/Types.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1 15     15   72 use utf8;
  15         27  
  15         101  
2              
3             package Net::EGTS::Types;
4 15     15   447 use Mouse;
  15         18  
  15         104  
5 15     15   4853 use Mouse::Util::TypeConstraints;
  15         26  
  15         104  
6 15     15   1912 use namespace::autoclean;
  15         26729  
  15         88  
7              
8             subtype 'BOOLEAN', as 'Bool';
9             subtype 'BYTE', as 'Int', where { 0 <= $_ && $_ < 2 ** 8 };
10             subtype 'USHORT', as 'Int', where { 0 <= $_ && $_ < 2 ** 16 };
11             subtype 'UINT', as 'Int', where { 0 <= $_ && $_ < 2 ** 32 };
12             subtype 'ULONG', as 'Int', where { 0 <= $_ && $_ < 2 ** 64 };
13             subtype 'SHORT', as 'Int', where { -(2 ** 15) <= $_ && $_ < 2 ** 15 };
14             subtype 'INT', as 'Int', where { -(2 ** 31) <= $_ && $_ < 2 ** 31 };
15             subtype 'FLOAT', as 'Num';
16             subtype 'DOUBLE', as 'Num';
17             subtype 'STRING', as 'Str';
18             subtype 'BINARY', as 'Str';
19              
20             subtype 'BINARY3', as 'Str';#, where { length($_) == 3 };
21              
22             subtype 'BIT1', as 'Bool';
23             subtype 'BIT2', as 'Int', where { 0 <= $_ && $_ < 2 ** 2 };
24             subtype 'BIT3', as 'Int', where { 0 <= $_ && $_ < 2 ** 3 };
25             subtype 'BIT4', as 'Int', where { 0 <= $_ && $_ < 2 ** 4 };
26             subtype 'BIT5', as 'Int', where { 0 <= $_ && $_ < 2 ** 5 };
27             subtype 'BIT6', as 'Int', where { 0 <= $_ && $_ < 2 ** 6 };
28             subtype 'BIT7', as 'Int', where { 0 <= $_ && $_ < 2 ** 7 };
29             subtype 'BIT8', as 'Int', where { 0 <= $_ && $_ < 2 ** 8 };
30              
31             subtype 'uInt', as 'Int', where { 0 <= $_ };
32              
33             __PACKAGE__->meta->make_immutable();