Chemistry-Mol-0.35/t/exception.t

filter: Statementstmt 97.7% 43 / 44 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 17 / 17 Podpod n/a totaltotal 96.8% 61 / 63 CC 2 SCAR 1.1
CC
2
Cov
96%
BEGIN
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« Chemistry-Mol-0.35/t/File.t ↑ Summary blib/lib/PerlMol.pm »
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 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.2
9 1 ▶ if (eval 'use Test::Exception; 1') {
Subroutine BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if (eval 'use Test::Exception; 1') { } 1 0 1
10 1 plan tests => 9;
11 #plan 'no_plan';
12 } else {
13 0 plan skip_all => "You don't have Test::Exception installed";
14 }
15 }
16  
17 # make sure that we throw some expected exceptions
18  
19 ###### MOL ######
20  
21 1 ▶throws_ok { Chemistry::Mol->read('t/empty.mol') }
Subroutine __ANON__: called CC=1 SCAR=0.0
22 1 qr/guess format/, "unknown format (read)";
23  
24 1 ▶throws_ok { Chemistry::Mol->read('no_file.mol', format => 'mdl') }
Subroutine __ANON__: called CC=1 SCAR=0.0
25 1 qr/No class installed/, "no class installed";
26  
27 1 ▶throws_ok { Chemistry::Mol->read('no_file.mol', format => 'dumper') }
Subroutine __ANON__: called CC=1 SCAR=0.0
28 1 qr/open file/, "can't open";
29  
30 1 ▶throws_ok { Chemistry::Mol->write('no_file.mol') }
Subroutine __ANON__: called CC=1 SCAR=0.0
31 1 qr/guess format/, "unknown format (write)";
32  
33 ###### ATOM ######
34  
35 1 my $mol = Chemistry::Mol->read('t/mol.pl');
36 1 my ($a1, $a2, $a3) = $mol->atoms;
37  
38 1 ▶throws_ok { Chemistry::Atom::angle($a1, $a2) }
Subroutine __ANON__: called CC=1 SCAR=0.0
39 1 qr/three/, "three atoms needed for angle";
40  
41 1 ▶throws_ok { Chemistry::Atom::dihedral($a1, $a2, $a3) }
Subroutine __ANON__: called CC=1 SCAR=0.0
42 1 qr/four/, "four atoms needed for dihedral";
43  
44 1 ▶throws_ok { $a1->distance('xyz') }
Subroutine __ANON__: called CC=1 SCAR=0.0
45 1 qr/undefined for objects of type/, "distance to non-object";
46  
47 1 ▶throws_ok { $a1->angle(1, 2) }
Subroutine __ANON__: called CC=1 SCAR=0.0
48 1 qr/not an object/, "angle to non-object";
49  
50 1 ▶throws_ok { $a1->angle(bless({}), bless({})) }
Subroutine __ANON__: called CC=1 SCAR=0.0
51 1 qr/neither an atom/, "angle to funny object";
52  
53  
« Chemistry-Mol-0.35/t/File.t ↑ Summary blib/lib/PerlMol.pm »