EPL2/Types.pm

filter: Statementstmt 75.0% 33 / 44 Branchbran 50.0% 4 / 8 Conditioncond 33.3% 6 / 18 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 56.0% 14 / 25 Podpod n/a totaltotal 55.3% 57 / 103 CC 11 SCAR 13.9
CC
11
Cov
61%
__ANON__
13.8
__ANON__
6.7
__ANON__
2.1
CRAP 4.0
« EPL2/Pad.pm ↑ Summary EPL2/Command/A.pm »
1 package EPL2::Types;
2 # ABSTRACT: EPL2::Types (Library for EPL2 types)
3 7 $EPL2::Types::VERSION = '0.001';
4  
5 # predeclare our own types
6 7 ▶use MooseX::Types -declare => [qw/Natural Positive Rotation Font Mult Reverse Human Text Barcode Padwidth Padheight/];
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 # import builtin types
9 7 ▶use MooseX::Types::Moose qw/Int Str/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 # declare our constants
12 7 ▶use constant { MAX_PADWIDTH => 832, MAX_PADHEIGHT => 65535 };
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 # type definition.
15 subtype Natural,
16 as Int,
17 44 ▶ where { $_ >= 0 },
Subroutine __ANON__: called CC=1 SCAR=0.0
18 0 ▶ message { "Value($_) is not Natural [ 0, 1, 2, 3, 4, ... ]" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
19  
20 subtype Positive,
21 as Int,
22 3 ▶ where { $_ >= 1 },
Subroutine __ANON__: called CC=1 SCAR=0.0
23 0 ▶ message { "Value($_) is not Positive [ 1, 2, 3, 4, ... ]" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
24  
25 subtype Rotation,
26 as Natural,
27 6 ▶ where { $_ < 4 },
Subroutine __ANON__: called CC=1 SCAR=0.0
28 0 ▶ message { "Value($_) is not a Rotation [ 0, 1, 2, 3 ]" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
29  
30 subtype Font,
31 as Natural,
32 4 ▶ where { $_ > 0 && $_ < 6 },
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
$_ > 0 and $_ < 6 4 0 4
33 0 ▶ message { "Value($_) is not a Font [ 1, 2, 3, 4, 5 ]" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
34  
35 subtype Mult,
36 as Natural,
37 7 ▶ where { $_ > 0 && $_ < 10 },
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
$_ > 0 and $_ < 10 7 0 7
38 0 ▶ message { "Value($_) is not a Mult [ 1 - 9 ]" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
39  
40 subtype Reverse,
41 as Str,
42 4 ▶ where { /^(N|R)$/ },
Subroutine __ANON__: called CC=1 SCAR=0.0
43 0 ▶ message { "Value($_) is not a Reverse [ N, R ]" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
44  
45 subtype Text,
46 as Str,
47 4 ▶ where { /^".+"$/ || /^V\d[1-9]$/ || /^C\d$/ || /^T(T|D)$/ },
Subroutine __ANON__: called CC=4 SCAR=19.1
Branch: 1 branch
BranchTrueFalseTotal
/^".+"$/ or /^V\d[1-9]$/ or /^C\d$/ or /^T(T|D)$/ 4 0 4
Condition33%2/6
/^".+"$/ or /^V\d[1-9]$/ or /^C\d$/
l!l&&r!l&&!r
400
/^".+"$/ or /^V\d[1-9]$/
l!l&&r!l&&!r
400
MC/DC0%0/3
/^".+"$/ or /^V\d[1-9]$/ or /^C\d$/
/^".+"$/ /^V\d[1-9]$/ /^C\d$/
Truth table25%1/4
A or B or C
A= /^".+"$/B= /^V\d[1-9]$/C= /^C\d$/
ABCresult
1XX1
01X1
0011
0000
48 0 ▶ message { "Value($_) is not Text -- Literal Text \"\" or Variable V01-V99 or Counter C0-C9 or TimeCode [TT, TD]" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
49  
50 subtype Human,
51 as Str,
52 2 ▶ where { /^(B|N)$/ },
Subroutine __ANON__: called CC=1 SCAR=0.0
53 0 ▶ message { "Value($_) is not Human [ B, N ]" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
54  
55 subtype Barcode,
56 as Str,
57 2 ▶ where {
Subroutine __ANON__: called CC=6 SCAR=26.2
58 2 ▶ /^(0|K|P|J|L|M)$/
Branch: 1 branch
BranchTrueFalseTotal
/^(0|K|P|J|L|M)$/ or /^1(A|B|C|E)?$/ or /^2(C|D|G|U)?$/ or /^3C?$/ or /^E(80|82|85|30|32|35)$/ or /^U(A0|A2|A5|E0|E2|E5)$/ 2 0 2
Condition33%4/12
/^(0|K|P|J|L|M)$/ or /^1(A|B|C|E)?$/ or /^2(C|D|G|U)?$/ or /^3C?$/ or /^E(80|82|85|30|32|35)$/
l!l&&r!l&&!r
200
/^(0|K|P|J|L|M)$/ or /^1(A|B|C|E)?$/ or /^2(C|D|G|U)?$/ or /^3C?$/
l!l&&r!l&&!r
020
/^(0|K|P|J|L|M)$/ or /^1(A|B|C|E)?$/ or /^2(C|D|G|U)?$/
l!l&&r!l&&!r
002
/^(0|K|P|J|L|M)$/ or /^1(A|B|C|E)?$/
l!l&&r!l&&!r
002
MC/DC0%0/5
/^(0|K|P|J|L|M)$/ or /^1(A|B|C|E)?$/ or /^2(C|D|G|U)?$/ or /^3C?$/ or /^E(80|82|85|30|32|35)$/
/^(0|K|P|J|L|M)$/ /^1(A|B|C|E)?$/ /^2(C|D|G|U)?$/ /^3C?$/ /^E(80|82|85|30|32|35)$/
Truth table16%1/6
A or B or C or D or E
A= /^(0|K|P|J|L|M)$/B= /^1(A|B|C|E)?$/C= /^2(C|D|G|U)?$/D= /^3C?$/E= /^E(80|82|85|30|32|35)$/
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
59 || /^1(A|B|C|E)?$/
60 || /^2(C|D|G|U)?$/
61 || /^3C?$/
62 || /^E(80|82|85|30|32|35)$/
63 || /^U(A0|A2|A5|E0|E2|E5)$/
64 },
65 0 ▶ message { "Value($_) is not Barcode Type" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
66  
67 subtype Padwidth,
68 as Natural,
69 2 ▶ where { $_ <= MAX_PADWIDTH },
Subroutine __ANON__: called CC=1 SCAR=0.0
70 0 ▶ message { "Value($_) is not < " . MAX_PADWIDTH };
Subroutine __ANON__: not called CC=1 SCAR=1.2
71  
72 subtype Padheight,
73 as Natural,
74 5 ▶ where { $_ <= MAX_PADHEIGHT },
Subroutine __ANON__: called CC=1 SCAR=0.0
75 0 ▶ message { "Value($_) is not < " . MAX_PADHEIGHT };
Subroutine __ANON__: not called CC=1 SCAR=1.2
76  
77  
78 7 1;
79  
80 __END__
« EPL2/Pad.pm ↑ Summary EPL2/Command/A.pm »