Structured/Block.pm

filter: Statementstmt 100% 52 / 52 Branchbran 100% 10 / 10 Conditioncond 92.8% 13 / 14 MC/DCmcdc 87.5% 7 / 8 Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 3 totaltotal 94.8% 92 / 97 CC 11 SCAR 14.4
CC
11
Cov
99%
process
8.0
is_ok
3.0
new
2.0
CRAP 4.2
« Structured/UL.pm ↑ Summary Structured/LI.pm »
1 package MKDoc::Text::Structured::Block;
2 20 ▶use MKDoc::Text::Structured::P;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 20 ▶use MKDoc::Text::Structured::H1;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 20 ▶use MKDoc::Text::Structured::H2;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 20 ▶use MKDoc::Text::Structured::H3;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 20 ▶use base qw /MKDoc::Text::Structured::Base/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 20 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 20 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10  
11 sub new
12 247 ▶{
Subroutine new: called CC=2 SCAR=6.9
Pod undocumented
13 247 my $class = shift;
14 247 my $line = shift;
15 247 ▶ return if ($line =~ /^\s*$/);
Branch: 1 branch
BranchTrueFalseTotal
if $line =~ /^\s*$/ 42 205 247
16 205 return bless {}, $class;
17 }
18  
19  
20 sub is_ok
21 132 ▶{
Subroutine is_ok: called CC=3 SCAR=11.0
Pod undocumented
22 132 my $self = shift;
23 132 my $line = shift;
24 132 ▶ my $obj = MKDoc::Text::Structured::Factory->new ($line) || return;
Condition100%2/2
'MKDoc::Text::Structured::Factory'->new($line) || (return)
l!l
11418
MC/DC100%1/1
'MKDoc::Text::Structured::Factory'->new($line) || (return)
'MKDoc::Text::Structured::Factory'->new($line)
Truth table100%2/2
A
A= 'MKDoc::Text::Structured::Factory'->new($line)
Aresult
11
00
25 114 ▶ return 1 if (ref $obj eq ref $self);
Branch: 1 branch
BranchTrueFalseTotal
if ref $obj eq ref $self 112 2 114
26 2 return;
27 }
28  
29  
30 sub process
31 93 ▶{
Subroutine process: called CC=8 SCAR=20.8
Pod undocumented
32 93 my $self = shift;
33 93 my @lines = @{$self->{lines}};
34  
35 # =========
36 # Heading 1
37 # =========
38 @lines > 1 and
39 $lines[0] =~ /^==/ and
40 93 ▶ $lines[-1] =~ /^==/ and do {
Branch: 1 branch
BranchTrueFalseTotal
@lines > 1 and $lines[0] =~ /^==/ and $lines[-1] =~ /^==/ and do { shift @lines; pop @lines; $self->{"lines"} = \@lines; bless $self, "MKDoc::Text::Structured::H1"; return $self->process(@_) } 1 92 93
Condition83%5/6
@lines > 1 and $lines[0] =~ /^==/ and $lines[-1] =~ /^==/
!ll&&!rl&&r
9201
@lines > 1 and $lines[0] =~ /^==/
!ll&&!rl&&r
76161
MC/DC66%2/3
@lines > 1 and $lines[0] =~ /^==/ and $lines[-1] =~ /^==/
@lines > 1 $lines[0] =~ /^==/ $lines[-1] =~ /^==/
Truth table75%3/4
A and B and C
A= @lines > 1B= $lines[0] =~ /^==/C= $lines[-1] =~ /^==/
ABCresult
0XX0
10X0
1100
1111
41 1 shift (@lines);
42 1 pop (@lines);
43 1 $self->{lines} = \@lines;
44 1 bless $self, 'MKDoc::Text::Structured::H1';
45 1 return $self->process (@_);
46 };
47  
48 # Heading 2
49 # =========
50 @lines > 1 and
51 92 ▶ $lines[-1] =~ /^==/ and do {
Branch: 1 branch
BranchTrueFalseTotal
@lines > 1 and $lines[-1] =~ /^==/ and do { pop @lines; $self->{"lines"} = \@lines; bless $self, "MKDoc::Text::Structured::H2"; return $self->process(@_) } 5 87 92
Condition100%3/3
@lines > 1 and $lines[-1] =~ /^==/
!ll&&!rl&&r
76115
MC/DC100%2/2
@lines > 1 and $lines[-1] =~ /^==/
@lines > 1 $lines[-1] =~ /^==/
Truth table100%3/3
A and B
A= @lines > 1B= $lines[-1] =~ /^==/
ABresult
0X0
100
111
52 5 pop (@lines);
53 5 $self->{lines} = \@lines;
54 5 bless $self, 'MKDoc::Text::Structured::H2';
55 5 return $self->process (@_);
56 };
57  
58 # Heading 3
59 # ---------
60 @lines > 1 and
61 87 ▶ $lines[-1] =~ /^--/ and do {
Branch: 1 branch
BranchTrueFalseTotal
@lines > 1 and $lines[-1] =~ /^--/ and do { pop @lines; $self->{"lines"} = \@lines; bless $self, "MKDoc::Text::Structured::H3"; return $self->process(@_) } 3 84 87
Condition100%3/3
@lines > 1 and $lines[-1] =~ /^--/
!ll&&!rl&&r
7683
MC/DC100%2/2
@lines > 1 and $lines[-1] =~ /^--/
@lines > 1 $lines[-1] =~ /^--/
Truth table100%3/3
A and B
A= @lines > 1B= $lines[-1] =~ /^--/
ABresult
0X0
100
111
62 3 pop (@lines);
63 3 $self->{lines} = \@lines;
64 3 bless $self, 'MKDoc::Text::Structured::H3';
65 3 return $self->process (@_);
66 };
67  
68 # normal, boring paragraph
69 84 bless $self, 'MKDoc::Text::Structured::P';
70 84 return $self->process (@_);
71 }
72  
73  
74 20 1;
75  
76 __END__
« Structured/UL.pm ↑ Summary Structured/LI.pm »