Chemistry-Mol-0.35/t/zlib.t

filter: Statementstmt 97.9% 47 / 48 Branchbran 50.0% 2 / 4 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 95.2% 60 / 63 CC 3 SCAR 4.7
CC
3
Cov
94%
is_gzipped
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.6
« blib/lib/Chemistry/Pattern/Bond.pm ↑ Summary Chemistry-Mol-0.35/t/Formula.t »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 1 ▶use Test::More;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Chemistry::Mol;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Chemistry::File::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶if (eval 'use Compress::Zlib; 1') {
Subroutine BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if (eval 'use Compress::Zlib; 1') { } 1 0 1
9 1 plan tests => 6;
10 #plan 'no_plan';
11 } else {
12 0 plan skip_all => "You don't have Compress::Zlib installed";
13 }
14  
15 1 my $mol;
16 1 my $in = 't/mol.pl.gz';
17 1 my $out = 't/tmp/mol.pl.gz';
18 1 my $na = 8; # expected number of atoms
19  
20 ####### read tests
21  
22 1 $mol = Chemistry::Mol->read($in, gzip => 1, format => 'dumper');
23 1 isa_ok($mol, "Chemistry::Mol", "explicit decompressed read");
24 1 ok($mol->atoms == $na, "has $na atoms");
25  
26 1 $mol = Chemistry::Mol->read($in, format => 'dumper');
27 1 isa_ok($mol, "Chemistry::Mol", "implicit decompressed read");
28 1 ok($mol->atoms == $na, "has $na atoms");
29  
30  
31 ####### write tests
32  
33 1 mkdir 't/tmp';
34  
35 1 $mol->write($out, format => 'dumper', gzip => 1);
36 1 is_gzipped($out);
37 1 unlink $out;
38  
39 1 $mol->write($out, format => 'dumper');
40 1 is_gzipped($out, "implicit compression on output");
41 1 unlink $out;
42  
43 1 rmdir 't/tmp';
44  
45 2 ▶sub is_gzipped {
Subroutine is_gzipped: called CC=3 SCAR=11.0
46 2 my ($fname, $comment) = @_;
47 2 my $header;
48  
49 2 ▶ open F, $fname or die;
Branch: 1 branch
BranchTrueFalseTotal
open F, $fname or die 2 0 2
50 2 read F, $header, 2;
51 2 ▶ ok($header eq "\x1f\x8b", $comment || "compressed ok");
Condition100%2/2
$comment || 'compressed ok'
l!l
11
MC/DC100%1/1
$comment || 'compressed ok'
$comment
Truth table100%2/2
A
A= $comment
Aresult
11
00
52 2 close F;
53 }
54  
55  
« blib/lib/Chemistry/Pattern/Bond.pm ↑ Summary Chemistry-Mol-0.35/t/Formula.t »