blib/lib/IO/Uncompress/Adapter/Bunzip2.pm

filter: Statementstmt 80.3% 41 / 51 Branchbran 66.6% 8 / 12 Conditioncond 85.7% 6 / 7 MC/DCmcdc 75.0% 3 / 4 Subroutinesub 61.5% 8 / 13 Podpod 0.0% 0 / 8 totaltotal 69.4% 66 / 95 CC 10 SCAR 11.1
CC
10
Cov
79%
uncompr
5.0
mkUncompObject
4.1
reset
3.3
CRAP 3.0
« blib/lib/IO/Compress/Bzip2.pm ↑ Summary blib/lib/IO/Uncompress/Inflate.pm »
1 package IO::Uncompress::Adapter::Bunzip2;
2  
3 87 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 87 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 87 ▶use bytes;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 87 ▶use IO::Compress::Base::Common 2.225 qw(:Status);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 87 ▶use Compress::Raw::Bzip2 2.225 ;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 87 our ($VERSION, @ISA);
12 87 $VERSION = '2.225';
13  
14 sub mkUncompObject
15 798 ▶{
Subroutine mkUncompObject: called CC=4 SCAR=14.1
Pod undocumented
16 798 ▶ my $small = shift || 0;
Condition100%2/2
shift() || 0
l!l
1797
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
17 798 ▶ my $verbosity = shift || 0;
Condition50%1/2
shift() || 0
l!l
0798
MC/DC0%0/1
shift() || 0
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
18  
19 798 my ($inflate, $status) = Compress::Raw::Bunzip2->new(1, 1, $small, $verbosity, 1);
20  
21 798 ▶ return (undef, "Could not create Inflation object: $status", $status)
Branch: 1 branch
BranchTrueFalseTotal
if $status != BZ_OK() 0 798 798
22 if $status != BZ_OK ;
23  
24 798 return bless {'Inf' => $inflate,
25 'CompSize' => 0,
26 'UnCompSize' => 0,
27 'Error' => '',
28 'ConsumesInput' => 1,
29 } ;
30  
31 }
32  
33 sub uncompr
34 1105 ▶{
Subroutine uncompr: called CC=5 SCAR=16.1
Pod undocumented
35 1105 my $self = shift ;
36 1105 my $from = shift ;
37 1105 my $to = shift ;
38 1105 my $eof = shift ;
39  
40 1105 my $inf = $self->{Inf};
41  
42 1105 my $status = $inf->bzinflate($from, $to);
43 1105 $self->{ErrorNo} = $status;
44  
45 1105 ▶ if ($status != BZ_OK && $status != BZ_STREAM_END )
Branch: 1 branch
BranchTrueFalseTotal
if ($status != BZ_OK() and $status != BZ_STREAM_END()) 2 1103 1105
Condition100%3/3
$status != BZ_OK() and $status != BZ_STREAM_END()
!ll&&!rl&&r
211012
MC/DC100%2/2
$status != BZ_OK() and $status != BZ_STREAM_END()
$status != BZ_OK() $status != BZ_STREAM_END()
Truth table100%3/3
A and B
A= $status != BZ_OK()B= $status != BZ_STREAM_END()
ABresult
0X0
100
111
46 {
47 2 $self->{Error} = "Inflation Error: $status";
48 2 return STATUS_ERROR;
49 }
50  
51  
52 1103 ▶ return STATUS_OK if $status == BZ_OK ;
Branch: 1 branch
BranchTrueFalseTotal
if $status == BZ_OK() 2 1101 1103
53 1101 ▶ return STATUS_ENDSTREAM if $status == BZ_STREAM_END ;
Branch: 1 branch
BranchTrueFalseTotal
if $status == BZ_STREAM_END() 1101 0 1101
54 0 return STATUS_ERROR ;
55 }
56  
57  
58 sub reset
59 350 ▶{
Subroutine reset: called CC=3 SCAR=12.0
Pod undocumented
60 350 my $self = shift ;
61  
62 350 my ($inf, $status) = Compress::Raw::Bunzip2->new();
63 350 ▶ $self->{ErrorNo} = ($status == BZ_OK) ? 0 : $status ;
Branch: 1 branch
BranchTrueFalseTotal
$status == BZ_OK() ? : 350 0 350
64  
65 350 ▶ if ($status != BZ_OK)
Branch: 1 branch
BranchTrueFalseTotal
if ($status != BZ_OK()) 0 350 350
66 {
67 0 $self->{Error} = "Cannot create Inflate object: $status";
68 0 return STATUS_ERROR;
69 }
70  
71 350 $self->{Inf} = $inf;
72  
73 350 return STATUS_OK ;
74 }
75  
76 sub compressedBytes
77 0 ▶{
Subroutine compressedBytes: not called CC=1 SCAR=6.9
Pod undocumented
78 0 my $self = shift ;
79 0 $self->{Inf}->compressedBytes();
80 }
81  
82 sub uncompressedBytes
83 0 ▶{
Subroutine uncompressedBytes: not called CC=1 SCAR=6.9
Pod undocumented
84 0 my $self = shift ;
85 0 $self->{Inf}->uncompressedBytes();
86 }
87  
88 sub crc32
89 0 ▶{
Subroutine crc32: not called CC=1 SCAR=6.9
Pod undocumented
90 0 my $self = shift ;
91 #$self->{Inf}->crc32();
92 }
93  
94 sub adler32
95 0 ▶{
Subroutine adler32: not called CC=1 SCAR=6.9
Pod undocumented
96 0 my $self = shift ;
97 #$self->{Inf}->adler32();
98 }
99  
100 sub sync
101 0 ▶{
Subroutine sync: not called CC=1 SCAR=6.9
Pod undocumented
102 0 my $self = shift ;
103 #( $self->{Inf}->inflateSync(@_) == BZ_OK)
104 # ? STATUS_OK
105 # : STATUS_ERROR ;
106 }
107  
108  
109 87 1;
110  
111 __END__
« blib/lib/IO/Compress/Bzip2.pm ↑ Summary blib/lib/IO/Uncompress/Inflate.pm »