MolecularMass/test.pl

filter: Statementstmt 80.4% 37 / 46 Branchbran 50.0% 10 / 20 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 72.4% 50 / 69 CC 2 SCAR 4.5
CC
2
Cov
71%
END
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.6
« blib/lib/Chemistry/MolecularMass.pm ↑ Summary
1 # Before `make install' is performed this script should be runnable with
2 # `make test'. After `make install' it should work as `perl test.pl'
3  
4 ######################### We start with some black magic to print on failure.
5  
6 # Change 1..1 below to 1..last_test_to_print .
7 # (It may become useful if the test is moved to ./t subdirectory.)
8  
9 1 ▶BEGIN { $| = 1; print "1..10\n"; }
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶END {print "not ok 1\n" unless $loaded;}
Subroutine END: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
unless $loaded 0 1 1
11 1 ▶use Chemistry::MolecularMass;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 $loaded = 1;
13 1 print "ok 1\n";
14  
15 ######################### End of black magic.
16  
17 # Insert your test code below (better if it prints "ok 13"
18 # (correspondingly "not ok 13") depending on the success of chunk 13
19 # of the test code):
20  
21 1 my $mm = new Chemistry::MolecularMass;
22 1 my $mass;
23  
24 1 $mass = $mm->calc_mass("[");
25 1 ▶if(defined($mass))
Branch: 1 branch
BranchTrueFalseTotal
if (defined $mass) { } 0 1 1
26 {
27 0 print "not ok 2\n";
28 }
29 else
30 {
31 1 print "ok 2\n";
32 }
33  
34 1 $mass = $mm->calc_mass("[(])");
35 1 ▶if(defined($mass))
Branch: 1 branch
BranchTrueFalseTotal
if (defined $mass) { } 0 1 1
36 {
37 0 print "not ok 3\n";
38 }
39 else
40 {
41 1 print "ok 3\n";
42 }
43  
44 1 $mass = $mm->calc_mass("Nosuchelement");
45 1 ▶if(defined($mass))
Branch: 1 branch
BranchTrueFalseTotal
if (defined $mass) { } 0 1 1
46 {
47 0 print "not ok 4\n";
48 }
49 else
50 {
51 1 print "ok 4\n";
52 }
53  
54 1 $mass = $mm->calc_mass(" ");
55 1 ▶if(defined($mass))
Branch: 1 branch
BranchTrueFalseTotal
if (defined $mass) { } 0 1 1
56 {
57 0 print "not ok 5\n";
58 }
59 else
60 {
61 1 print "ok 5\n";
62 }
63  
64 1 $mass = $mm->calc_mass("");
65 1 ▶if($mass == 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($mass == 0) { } 1 0 1
66 {
67 1 print "ok 6\n";
68 }
69 else
70 {
71 0 print "not ok 6\n";
72 }
73  
74 1 $mass = $mm->calc_mass("{[](<>)}");
75 1 ▶if($mass == 0)
Branch: 1 branch
BranchTrueFalseTotal
if ($mass == 0) { } 1 0 1
76 {
77 1 print "ok 7\n";
78 }
79 else
80 {
81 0 print "not ok 7\n";
82 }
83  
84 1 $mass = $mm->calc_mass("NaCl");
85 1 ▶if(abs($mass - 58.442) < 0.001)
Branch: 1 branch
BranchTrueFalseTotal
if (abs $mass - 58.442 < 0.001) { } 1 0 1
86 {
87 1 print "ok 8\n";
88 }
89 else
90 {
91 0 print "not ok 8\n";
92 }
93  
94 1 $mass = $mm->calc_mass("EtOH");
95 1 ▶if(abs($mass - 46.068) < 0.001)
Branch: 1 branch
BranchTrueFalseTotal
if (abs $mass - 46.068 < 0.001) { } 1 0 1
96 {
97 1 print "ok 9\n";
98 }
99 else
100 {
101 0 print "not ok 9\n";
102 }
103  
104 1 $mass = $mm->calc_mass("{[(CH3)3Si]2N}2CHCH3");
105 1 ▶if(abs($mass - 348.822) < 0.001)
Branch: 1 branch
BranchTrueFalseTotal
if (abs $mass - 348.822 < 0.001) { } 1 0 1
106 {
107 1 print "ok 10\n";
108 }
109 else
110 {
111 0 print "not ok 10\n";
112 }
« blib/lib/Chemistry/MolecularMass.pm ↑ Summary