GCC Code Coverage Report


./
File: tests/test_Formula.cpp
Date: 2024-08-24 11:26:06
Lines:
179/179
100.0%
Functions:
5/5
100.0%
Branches:
568/1286
44.2%

Line Branch Exec Source
1 // ./tests/catch2-tests [section] -s
2
3
4 /////////////////////// Qt includes
5 #include <QDebug>
6 #include <QString>
7 #include <QDir>
8
9
10 /////////////////////// IsoSpec
11 #include <IsoSpec++/isoSpec++.h>
12 #include <IsoSpec++/element_tables.h>
13
14
15 /////////////////////// Catch2 includes
16 #include <catch2/catch_test_macros.hpp>
17 #include <catch2/matchers/catch_matchers_floating_point.hpp>
18
19
20 /////////////////////// Local includes
21 #include "tests-config.h"
22 #include <libXpertMass/Isotope.hpp>
23 #include <libXpertMass/IsotopicDataLibraryHandler.hpp>
24 #include <libXpertMass/Formula.hpp>
25
26 namespace MsXpS
27 {
28
29 namespace libXpertMass
30 {
31
32 QString glucose_formula_string("C6H12O6");
33 QString saccharose_formula_string("C12H22O11");
34 QString action_formula_string_MA_dipeptidyl("+C5H11N1O2S1-H2O+C3H7N1O2-H2O");
35 QString action_formula_string_with_title(
36 "\"MA dipeptide\"+C5H11N1O2S1-H2O+C3H7N1O2-H2O");
37
38 12 SCENARIO("Construction of Formula_s with a simple no-action string")
39 {
40
41
8/14
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 12 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 12 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 12 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 12 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 12 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✓ Branch 24 taken 8 times.
12 WHEN("Constructed, using the constructor and the copy constructor")
42 {
43
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 Formula formula_c6h12O6(glucose_formula_string);
44
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 Formula formula_c6h12O6_copy(formula_c6h12O6);
45
46
7/14
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 4 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 4 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✗ Branch 24 not taken.
4 THEN("The the formula string is set to the member datum")
47 {
48
8/20
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 4 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 4 times.
✗ Branch 23 not taken.
✓ Branch 29 taken 4 times.
✗ Branch 30 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
4 REQUIRE(formula_c6h12O6.toString().toStdString() ==
49 glucose_formula_string.toStdString());
50
8/20
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 4 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 4 times.
✗ Branch 23 not taken.
✓ Branch 29 taken 4 times.
✗ Branch 30 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
4 REQUIRE(formula_c6h12O6_copy.toString().toStdString() ==
51 glucose_formula_string.toStdString());
52 4 }
53 16 }
54
55
8/14
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 12 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 12 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 12 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 12 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 12 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✓ Branch 24 taken 8 times.
12 AND_WHEN("Setting another formula string manually")
56 {
57
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 Formula formula_c6h12O6(glucose_formula_string);
58
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 formula_c6h12O6.setFormula(saccharose_formula_string);
59
60
7/14
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 4 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 4 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✗ Branch 24 not taken.
4 THEN("The new formula string is set accordingly to the member datum")
61 {
62
8/20
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 4 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 4 times.
✗ Branch 23 not taken.
✓ Branch 29 taken 4 times.
✗ Branch 30 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
4 REQUIRE(formula_c6h12O6.toString().toStdString() ==
63 saccharose_formula_string.toStdString());
64 4 }
65 16 }
66
67
8/14
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 12 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 12 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 12 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 12 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 12 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✓ Branch 24 taken 8 times.
12 AND_WHEN("Appending another formula string")
68 {
69
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 Formula formula_c6h12O6(glucose_formula_string);
70
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 formula_c6h12O6.appendFormula(saccharose_formula_string);
71 4 QString after_appending_fomula(glucose_formula_string);
72
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 after_appending_fomula += saccharose_formula_string;
73
74
7/14
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 4 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 4 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✗ Branch 24 not taken.
4 THEN("The member formula string is updated accordingly")
75 {
76
8/20
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 4 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 4 times.
✗ Branch 23 not taken.
✓ Branch 29 taken 4 times.
✗ Branch 30 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
4 REQUIRE(formula_c6h12O6.toString().toStdString() ==
77 after_appending_fomula.toStdString());
78 4 }
79 16 }
80 12 }
81
82 4 SCENARIO("Construction of Formula_s with another Formula instance")
83 {
84
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 Formula formula_c6h12O6(glucose_formula_string);
85
86
7/14
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 4 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 4 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✗ Branch 24 not taken.
4 WHEN("Constructed with another Formula instance")
87 {
88
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 Formula formula_c6h12O6_copy(formula_c6h12O6);
89
90
7/14
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 4 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 4 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✗ Branch 24 not taken.
4 THEN("The Formula string is set to the member datum")
91 {
92
8/20
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 4 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 4 times.
✗ Branch 23 not taken.
✓ Branch 29 taken 4 times.
✗ Branch 30 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
4 REQUIRE(formula_c6h12O6.toString().toStdString() ==
93 glucose_formula_string.toStdString());
94
8/20
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 4 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 4 times.
✗ Branch 23 not taken.
✓ Branch 29 taken 4 times.
✗ Branch 30 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
4 REQUIRE(formula_c6h12O6_copy.toString().toStdString() ==
95 glucose_formula_string.toStdString());
96 4 }
97 8 }
98 4 }
99
100 20 SCENARIO("Syntax checking of an action Formula with or without the title")
101 {
102
1/2
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
20 Formula formula_MA_dipeptidyl(action_formula_string_MA_dipeptidyl);
103
1/2
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
20 Formula titled_formula_MA_dipeptidyl(action_formula_string_with_title);
104
105
8/14
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 20 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 20 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 20 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 20 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✓ Branch 24 taken 16 times.
20 WHEN("Constructed, the formula string is set to the member datum as is")
106 {
107
8/20
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 4 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 4 times.
✗ Branch 23 not taken.
✓ Branch 29 taken 4 times.
✗ Branch 30 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
4 REQUIRE(formula_MA_dipeptidyl.toString().toStdString() ==
108 action_formula_string_MA_dipeptidyl.toStdString());
109
8/20
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 4 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 4 times.
✗ Branch 23 not taken.
✓ Branch 29 taken 4 times.
✗ Branch 30 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
4 REQUIRE(titled_formula_MA_dipeptidyl.toString().toStdString() ==
110 action_formula_string_with_title.toStdString());
111 20 }
112
113
8/14
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 20 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 20 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 20 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 20 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✓ Branch 24 taken 16 times.
20 AND_WHEN("Checked without forcing an index even for single atoms")
114 {
115
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 formula_MA_dipeptidyl.setForceCountIndex(false);
116
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 titled_formula_MA_dipeptidyl.setForceCountIndex(false);
117
118
7/14
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 4 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 4 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✗ Branch 24 not taken.
4 THEN("Checking succeeds")
119 {
120
6/16
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 4 times.
✗ Branch 21 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
4 REQUIRE(formula_MA_dipeptidyl.checkSyntax() == true);
121
6/16
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 4 times.
✗ Branch 21 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
4 REQUIRE(titled_formula_MA_dipeptidyl.checkSyntax() == true);
122 4 }
123 20 }
124
125
8/14
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 20 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 20 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 20 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 20 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✓ Branch 24 taken 16 times.
20 AND_WHEN("Checked with forcing an index even for single atoms")
126 {
127
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 formula_MA_dipeptidyl.setForceCountIndex(true);
128
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 titled_formula_MA_dipeptidyl.setForceCountIndex(true);
129
130
7/14
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 4 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 4 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✗ Branch 24 not taken.
4 THEN("Checking fails")
131 {
132
133
6/16
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 4 times.
✗ Branch 21 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
4 REQUIRE(formula_MA_dipeptidyl.checkSyntax() == false);
134
6/16
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 4 times.
✗ Branch 21 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
4 REQUIRE(titled_formula_MA_dipeptidyl.checkSyntax() == false);
135 4 }
136 20 }
137
8/14
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 20 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 20 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 20 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 20 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✓ Branch 24 taken 16 times.
20 AND_WHEN("Checking an invalid Formula starting with a cipher")
138 {
139
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 Formula formula("3Cz3H12O6N14L2");
140
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 formula.setForceCountIndex(false);
141
142
7/14
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 4 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 4 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✗ Branch 24 not taken.
4 THEN("Checking fails")
143 {
144
6/16
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 4 times.
✗ Branch 21 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
4 REQUIRE(formula.checkSyntax() == false);
145 4 }
146 24 }
147
148
8/14
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 20 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 20 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 20 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 20 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✓ Branch 24 taken 16 times.
20 AND_WHEN(
149 "Checking an invalid Formula ending not with an alphabetic character or a "
150 "number")
151 {
152
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 Formula formula("Cz3H12O6N14L2§");
153
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 formula.setForceCountIndex(false);
154
155
7/14
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 4 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 4 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✗ Branch 24 not taken.
4 THEN("Checking fails")
156 {
157
6/16
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 20 taken 4 times.
✗ Branch 21 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
✗ Branch 29 not taken.
✗ Branch 30 not taken.
4 REQUIRE(formula.checkSyntax() == false);
158 4 }
159 24 }
160 20 }
161
162 8 SCENARIO("Validation of an action Formula, with or without a title")
163 {
164
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 IsotopicDataLibraryHandler iso_data_lib_handler;
165
166 8 std::size_t non_isotope_skipped_items = 0;
167 std::size_t loaded_isotope_count =
168
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 iso_data_lib_handler.loadData(non_isotope_skipped_items);
169
170 8 IsotopicDataCstSPtr isotopic_data_csp = nullptr;
171
172
5/14
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 8 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 8 times.
✗ Branch 14 not taken.
✓ Branch 17 taken 8 times.
✗ Branch 18 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
8 REQUIRE(loaded_isotope_count + non_isotope_skipped_items ==
173 IsoSpec::isospec_number_of_isotopic_entries);
174
175
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 isotopic_data_csp = iso_data_lib_handler.getIsotopicData();
176
6/16
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 8 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 8 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 8 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 8 times.
✗ Branch 18 not taken.
✓ Branch 21 taken 8 times.
✗ Branch 22 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
8 REQUIRE(isotopic_data_csp->size() == loaded_isotope_count);
177
178
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 Formula formula_MA_dipeptidyl(action_formula_string_MA_dipeptidyl);
179
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
8 Formula titled_formula_MA_dipeptidyl(action_formula_string_with_title);
180
181
7/14
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 8 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 8 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 8 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 8 times.
✗ Branch 24 not taken.
8 WHEN("Constructed, the formula string is set to the member datum as is")
182 {
183
8/20
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 8 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 8 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 8 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 8 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 8 times.
✗ Branch 23 not taken.
✓ Branch 29 taken 8 times.
✗ Branch 30 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
8 REQUIRE(formula_MA_dipeptidyl.toString().toStdString() ==
184 action_formula_string_MA_dipeptidyl.toStdString());
185
8/20
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 8 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 8 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 8 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 8 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 8 times.
✗ Branch 23 not taken.
✓ Branch 29 taken 8 times.
✗ Branch 30 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
8 REQUIRE(titled_formula_MA_dipeptidyl.toString().toStdString() ==
186 action_formula_string_with_title.toStdString());
187
188
7/14
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 8 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 8 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 8 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 8 times.
✗ Branch 24 not taken.
8 AND_WHEN("Validated, the Formula creates + and - subformulas")
189 {
190 8 bool reset_symbol_count_map = true;
191 8 bool store_symbol_count_map = true;
192
193
1/2
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
8 formula_MA_dipeptidyl.validate(
194 isotopic_data_csp, store_symbol_count_map, reset_symbol_count_map);
195
1/2
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
8 titled_formula_MA_dipeptidyl.validate(
196 isotopic_data_csp, store_symbol_count_map, reset_symbol_count_map);
197
198
8/14
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 8 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 8 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 8 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✓ Branch 24 taken 4 times.
8 THEN("The + and - sub formulas are checked")
199 {
200 // "+C5H11N1O2S1-H20+C3H7N1O2-H2O"
201
7/18
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 4 times.
✗ Branch 20 not taken.
✓ Branch 25 taken 4 times.
✗ Branch 26 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
4 REQUIRE(formula_MA_dipeptidyl.plusFormula().toStdString() ==
202 "C5H11N1O2S1C3H7N1O2");
203
7/18
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 4 times.
✗ Branch 20 not taken.
✓ Branch 25 taken 4 times.
✗ Branch 26 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
4 REQUIRE(formula_MA_dipeptidyl.minusFormula().toStdString() ==
204 "H2O1H2O1");
205
206
7/18
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 4 times.
✗ Branch 20 not taken.
✓ Branch 25 taken 4 times.
✗ Branch 26 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
4 REQUIRE(titled_formula_MA_dipeptidyl.plusFormula().toStdString() ==
207 "C5H11N1O2S1C3H7N1O2");
208
7/18
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 4 times.
✗ Branch 20 not taken.
✓ Branch 25 taken 4 times.
✗ Branch 26 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
4 REQUIRE(titled_formula_MA_dipeptidyl.minusFormula().toStdString() ==
209 "H2O1H2O1");
210 8 }
211
212
8/14
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 8 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 8 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 8 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 8 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 8 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✓ Branch 24 taken 4 times.
8 AND_THEN(
213 "The symbol counts can be used to craft a new integrated "
214 "elemental composition string formula")
215 {
216 // Expecting result of "C5H11N1O2S1C3H7N1O2" - "H2O1H2O1"
217 // which is C8H18N2O4S1 - H4O2
218 // which is C8H14N2O2S1
219 4 std::vector<std::pair<QString, double>> symbol_count_pairs;
220 QString elemental_composition =
221
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 formula_MA_dipeptidyl.elementalComposition(&symbol_count_pairs);
222
6/16
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 21 taken 4 times.
✗ Branch 22 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
4 REQUIRE(elemental_composition.toStdString() == "C8H14N2O2S1");
223
224 elemental_composition =
225
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 titled_formula_MA_dipeptidyl.elementalComposition(&symbol_count_pairs);
226
6/16
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 21 taken 4 times.
✗ Branch 22 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
4 REQUIRE(elemental_composition.toStdString() == "C8H14N2O2S1");
227
228 const std::map<QString, double> &formula_symbol_count_map =
229
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 formula_MA_dipeptidyl.symbolCountMap();
230
231
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 auto map_iterator = formula_symbol_count_map.find("C");
232
5/14
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 4 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 4 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 4 times.
✗ Branch 15 not taken.
✓ Branch 18 taken 4 times.
✗ Branch 19 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
4 REQUIRE(map_iterator->second == 8);
233
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 map_iterator = formula_symbol_count_map.find("H");
234
5/14
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 4 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 4 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 4 times.
✗ Branch 15 not taken.
✓ Branch 18 taken 4 times.
✗ Branch 19 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
4 REQUIRE(map_iterator->second == 14);
235
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 map_iterator = formula_symbol_count_map.find("N");
236
5/14
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 4 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 4 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 4 times.
✗ Branch 15 not taken.
✓ Branch 18 taken 4 times.
✗ Branch 19 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
4 REQUIRE(map_iterator->second == 2);
237
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 map_iterator = formula_symbol_count_map.find("O");
238
5/14
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 4 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 4 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 4 times.
✗ Branch 15 not taken.
✓ Branch 18 taken 4 times.
✗ Branch 19 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
4 REQUIRE(map_iterator->second == 2);
239
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
4 map_iterator = formula_symbol_count_map.find("S");
240
5/14
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 4 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 4 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 4 times.
✗ Branch 15 not taken.
✓ Branch 18 taken 4 times.
✗ Branch 19 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
4 REQUIRE(map_iterator->second == 1);
241 12 }
242 8 }
243 8 }
244 8 }
245
246
247 24 SCENARIO("Various ways to account a Formula for its masses (mono, avg)")
248 {
249
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
24 IsotopicDataLibraryHandler iso_data_lib_handler;
250
251 24 std::size_t non_isotope_skipped_items = 0;
252 std::size_t loaded_isotope_count =
253
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
24 iso_data_lib_handler.loadData(non_isotope_skipped_items);
254
255 24 IsotopicDataCstSPtr isotopic_data_csp = nullptr;
256
257
5/14
✓ Branch 4 taken 24 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 24 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 24 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 24 times.
✗ Branch 14 not taken.
✓ Branch 17 taken 24 times.
✗ Branch 18 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
24 REQUIRE(loaded_isotope_count + non_isotope_skipped_items ==
258 IsoSpec::isospec_number_of_isotopic_entries);
259
260
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
24 isotopic_data_csp = iso_data_lib_handler.getIsotopicData();
261
6/16
✓ Branch 4 taken 24 times.
✗ Branch 5 not taken.
✓ Branch 8 taken 24 times.
✗ Branch 9 not taken.
✓ Branch 11 taken 24 times.
✗ Branch 12 not taken.
✓ Branch 14 taken 24 times.
✗ Branch 15 not taken.
✓ Branch 17 taken 24 times.
✗ Branch 18 not taken.
✓ Branch 21 taken 24 times.
✗ Branch 22 not taken.
✗ Branch 27 not taken.
✗ Branch 28 not taken.
✗ Branch 30 not taken.
✗ Branch 31 not taken.
24 REQUIRE(isotopic_data_csp->size() == loaded_isotope_count);
262
263
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
24 Formula formula_MA_dipeptidyl(action_formula_string_MA_dipeptidyl);
264
265
8/14
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 24 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 24 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 24 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 24 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 24 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✓ Branch 24 taken 20 times.
24 WHEN("A Formula is created from string")
266 {
267
268
7/14
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 4 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 4 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✗ Branch 24 not taken.
4 THEN("Only its string formula is updated")
269 {
270
8/20
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 4 times.
✗ Branch 20 not taken.
✓ Branch 22 taken 4 times.
✗ Branch 23 not taken.
✓ Branch 29 taken 4 times.
✗ Branch 30 not taken.
✗ Branch 38 not taken.
✗ Branch 39 not taken.
✗ Branch 41 not taken.
✗ Branch 42 not taken.
4 REQUIRE(formula_MA_dipeptidyl.toString().toStdString() ==
271 action_formula_string_MA_dipeptidyl.toStdString());
272 4 }
273 24 }
274
275
8/14
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 24 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 24 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 24 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 24 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 24 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✓ Branch 24 taken 20 times.
24 AND_WHEN(
276 "That formula is validated with adequate options, its other member data "
277 "are updated")
278 {
279 4 bool reset_symbol_count_map = true;
280 4 bool store_symbol_count_map = true;
281
282
1/2
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 formula_MA_dipeptidyl.validate(
283 isotopic_data_csp, store_symbol_count_map, reset_symbol_count_map);
284
285
7/14
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 4 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 4 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✗ Branch 24 not taken.
4 THEN("The + and - sub formulas are checked")
286 {
287 // "+C5H11N1O2S1-H20+C3H7N1O2-H2O"
288
7/18
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 4 times.
✗ Branch 20 not taken.
✓ Branch 25 taken 4 times.
✗ Branch 26 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
4 REQUIRE(formula_MA_dipeptidyl.plusFormula().toStdString() ==
289 "C5H11N1O2S1C3H7N1O2");
290
7/18
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 19 taken 4 times.
✗ Branch 20 not taken.
✓ Branch 25 taken 4 times.
✗ Branch 26 not taken.
✗ Branch 33 not taken.
✗ Branch 34 not taken.
✗ Branch 36 not taken.
✗ Branch 37 not taken.
4 REQUIRE(formula_MA_dipeptidyl.minusFormula().toStdString() == "H2O1H2O1");
291 4 }
292 24 }
293
294
8/14
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 24 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 24 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 24 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 24 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 24 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 16 times.
✓ Branch 24 taken 8 times.
24 AND_WHEN("Masses are accounted for the action-formula")
295 {
296
297
8/14
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 16 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 16 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 16 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 16 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✓ Branch 24 taken 12 times.
16 THEN("Mono and avg masses are updated in ony possible way")
298 {
299 4 double mono = 0;
300 4 double avg = 0;
301 4 bool result = false;
302
303 result =
304
1/2
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 formula_MA_dipeptidyl.accountMasses(isotopic_data_csp, &mono, &avg, 1);
305
5/14
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 17 taken 4 times.
✗ Branch 18 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
4 REQUIRE(result == true);
306
5/14
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 18 taken 4 times.
✗ Branch 19 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
4 REQUIRE_THAT(mono,
307 Catch::Matchers::WithinAbs(202.07759887468, 0.0000000001));
308
5/14
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 18 taken 4 times.
✗ Branch 19 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
4 REQUIRE_THAT(
309 avg, Catch::Matchers::WithinAbs(202.274890194285717, 0.0000000001));
310 16 }
311
312
8/14
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 16 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 16 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 16 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 16 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✓ Branch 24 taken 12 times.
16 AND_THEN("In another possible way")
313 {
314 4 double mono = 0;
315 4 double avg = 0;
316 4 bool result = false;
317
318 result =
319
1/2
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 formula_MA_dipeptidyl.accountMasses(isotopic_data_csp, &mono, &avg, 10);
320
5/14
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 17 taken 4 times.
✗ Branch 18 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
4 REQUIRE(result == true);
321
5/14
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 18 taken 4 times.
✗ Branch 19 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
4 REQUIRE_THAT(
322 mono, Catch::Matchers::WithinAbs(202.07759887468 * 10, 0.0000000001));
323
5/14
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 18 taken 4 times.
✗ Branch 19 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
4 REQUIRE_THAT(
324 avg,
325 Catch::Matchers::WithinAbs(202.274890194285717 * 10, 0.0000000001));
326 16 }
327
328
8/14
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 16 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 16 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 16 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 16 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✓ Branch 24 taken 12 times.
16 AND_THEN("In another possible way")
329 {
330
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 Ponderable ponderable(0, 0);
331 4 bool result = false;
332
333 result =
334
1/2
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 formula_MA_dipeptidyl.accountMasses(isotopic_data_csp, &ponderable, 1);
335
5/14
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 17 taken 4 times.
✗ Branch 18 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
4 REQUIRE(result == true);
336
6/16
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 21 taken 4 times.
✗ Branch 22 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
4 REQUIRE_THAT(ponderable.mono(),
337 Catch::Matchers::WithinAbs(202.07759887468, 0.0000000001));
338
6/16
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 21 taken 4 times.
✗ Branch 22 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
4 REQUIRE_THAT(
339 ponderable.avg(),
340 Catch::Matchers::WithinAbs(202.274890194285717, 0.0000000001));
341 20 }
342
343
8/14
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 16 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 16 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 16 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 16 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✓ Branch 24 taken 12 times.
16 AND_THEN("In another possible way")
344 {
345
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
4 Ponderable ponderable(0, 0);
346 4 bool result = false;
347
348 result =
349
1/2
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
4 formula_MA_dipeptidyl.accountMasses(isotopic_data_csp, &ponderable, 10);
350
5/14
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 17 taken 4 times.
✗ Branch 18 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
4 REQUIRE(result == true);
351
6/16
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 21 taken 4 times.
✗ Branch 22 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
4 REQUIRE_THAT(
352 ponderable.mono(),
353 Catch::Matchers::WithinAbs(202.07759887468 * 10, 0.0000000001));
354
6/16
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 4 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 4 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 4 times.
✗ Branch 14 not taken.
✓ Branch 16 taken 4 times.
✗ Branch 17 not taken.
✓ Branch 21 taken 4 times.
✗ Branch 22 not taken.
✗ Branch 28 not taken.
✗ Branch 29 not taken.
✗ Branch 31 not taken.
✗ Branch 32 not taken.
4 REQUIRE_THAT(
355 ponderable.avg(),
356 Catch::Matchers::WithinAbs(202.274890194285717 * 10, 0.0000000001));
357 20 }
358 24 }
359 24 }
360
361
362 } // namespace libXpertMass
363 } // namespace MsXpS
364