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/PolChemDef.hpp> |
23 |
|
|
#include <libXpertMass/Formula.hpp> |
24 |
|
|
#include <libXpertMass/IonizeRule.hpp> |
25 |
|
|
#include <libXpertMass/IsotopicDataLibraryHandler.hpp> |
26 |
|
|
|
27 |
|
|
namespace MsXpS |
28 |
|
|
{ |
29 |
|
|
|
30 |
|
|
namespace libXpertMass |
31 |
|
|
{ |
32 |
|
|
|
33 |
|
28 |
SCENARIO("An IonizeRule is used to attach charges to chemical entities") |
34 |
|
|
{ |
35 |
|
|
|
36 |
7/14
✓ Branch 1 taken 28 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 28 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 28 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 28 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 28 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 28 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 28 times.
✗ Branch 24 not taken.
|
28 |
GIVEN("Construction of an empty IonizeRule") |
37 |
|
|
{ |
38 |
1/2
✓ Branch 1 taken 28 times.
✗ Branch 2 not taken.
|
28 |
IonizeRule ionize_rule_1; |
39 |
|
|
|
40 |
8/14
✓ Branch 1 taken 28 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 28 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 28 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 28 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 28 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 28 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✓ Branch 24 taken 24 times.
|
28 |
THEN("The member data are set to 0 and the IonizeRule is *not* valid") |
41 |
|
|
{ |
42 |
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(ionize_rule_1.formula().toStdString() == ""); |
43 |
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(ionize_rule_1.charge() == 0); |
44 |
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(ionize_rule_1.level() == 0); |
45 |
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(ionize_rule_1.isValid() == false); |
46 |
|
28 |
} |
47 |
|
|
|
48 |
8/14
✓ Branch 1 taken 28 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 28 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 28 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 28 times.
✗ Branch 11 not taken.
✓ Branch 15 taken 28 times.
✗ Branch 16 not taken.
✓ Branch 21 taken 28 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 24 times.
✓ Branch 24 taken 4 times.
|
28 |
AND_GIVEN("Setting MALDI-type ionization") |
49 |
|
|
{ |
50 |
2/4
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 24 times.
✗ Branch 5 not taken.
|
24 |
ionize_rule_1.setFormula("\"Protonation\"+H"); |
51 |
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
|
24 |
ionize_rule_1.setCharge(1); |
52 |
1/2
✓ Branch 1 taken 24 times.
✗ Branch 2 not taken.
|
24 |
ionize_rule_1.setLevel(1); |
53 |
|
|
|
54 |
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 |
THEN("Member data are updated accordingly") |
55 |
|
|
{ |
56 |
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(ionize_rule_1.formula().toStdString() == "\"Protonation\"+H"); |
57 |
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(ionize_rule_1.charge() == 1); |
58 |
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(ionize_rule_1.level() == 1); |
59 |
|
24 |
} |
60 |
|
|
|
61 |
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 8 times.
✓ Branch 24 taken 16 times.
|
24 |
GIVEN( |
62 |
|
|
"Construction of a new copy of that IonizeRule by the copy constructor") |
63 |
|
|
{ |
64 |
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
|
8 |
IonizeRule ionize_rule_2(ionize_rule_1); |
65 |
|
|
|
66 |
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 members should be identical to the former IonizeRule") |
67 |
|
|
{ |
68 |
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(ionize_rule_2.formula().toStdString() == "\"Protonation\"+H"); |
69 |
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(ionize_rule_2.charge() == 1); |
70 |
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(ionize_rule_2.level() == 1); |
71 |
|
8 |
} |
72 |
|
|
|
73 |
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("Checking for (in)equality should work") |
74 |
|
|
{ |
75 |
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(ionize_rule_1 == ionize_rule_2); |
76 |
6/16
✓ Branch 1 taken 4 times.
✗ Branch 2 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_FALSE(ionize_rule_1 != ionize_rule_2); |
77 |
|
8 |
} |
78 |
|
32 |
} |
79 |
|
|
|
80 |
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 8 times.
✓ Branch 24 taken 16 times.
|
24 |
AND_GIVEN("Construction of a new copy of that IonizeRule by assignment") |
81 |
|
|
{ |
82 |
1/2
✓ Branch 1 taken 8 times.
✗ Branch 2 not taken.
|
8 |
IonizeRule ionize_rule_3 = ionize_rule_1; |
83 |
|
|
|
84 |
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 members should be identical to the former IonizeRule") |
85 |
|
|
{ |
86 |
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(ionize_rule_3.formula().toStdString() == "\"Protonation\"+H"); |
87 |
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(ionize_rule_3.charge() == 1); |
88 |
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(ionize_rule_3.level() == 1); |
89 |
|
8 |
} |
90 |
|
|
|
91 |
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("Checking for (in)equality should work") |
92 |
|
|
{ |
93 |
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(ionize_rule_1 == ionize_rule_3); |
94 |
6/16
✓ Branch 1 taken 4 times.
✗ Branch 2 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_FALSE(ionize_rule_1 != ionize_rule_3); |
95 |
|
8 |
} |
96 |
|
32 |
} |
97 |
|
|
|
98 |
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("The IonizeRule is constructed and initialized it is not valid") |
99 |
|
|
{ |
100 |
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("That is tested") |
101 |
|
|
{ |
102 |
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(ionize_rule_1.isValid() == false); |
103 |
|
4 |
} |
104 |
|
24 |
} |
105 |
|
28 |
} |
106 |
|
56 |
} |
107 |
|
28 |
} |
108 |
|
|
|
109 |
|
|
|
110 |
|
20 |
SCENARIO( |
111 |
|
|
"An IonizeRule correctly initialized should validate against reference " |
112 |
|
|
"IsotopicData") |
113 |
|
|
{ |
114 |
1/2
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 |
IonizeRule ionize_rule_1; |
115 |
|
|
|
116 |
7/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 20 times.
✗ Branch 24 not taken.
|
20 |
GIVEN("An empty IonizeRule") |
117 |
|
|
{ |
118 |
1/2
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 |
IonizeRule ionize_rule_1; |
119 |
|
|
|
120 |
7/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 20 times.
✗ Branch 24 not taken.
|
20 |
WHEN("That IonizeRule is initialized") |
121 |
|
|
{ |
122 |
2/4
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
|
20 |
ionize_rule_1.setFormula("\"Protonation\"+H"); |
123 |
1/2
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 |
ionize_rule_1.setCharge(1); |
124 |
1/2
✓ Branch 1 taken 20 times.
✗ Branch 2 not taken.
|
20 |
ionize_rule_1.setLevel(1); |
125 |
|
|
|
126 |
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 |
THEN("Its member data are updated") |
127 |
|
|
{ |
128 |
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(ionize_rule_1.formula().toStdString() == "\"Protonation\"+H"); |
129 |
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(ionize_rule_1.charge() == 1); |
130 |
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(ionize_rule_1.level() == 1); |
131 |
|
20 |
} |
132 |
|
|
|
133 |
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_THEN("That does not mean that the IonizeRule is valid") |
134 |
|
|
{ |
135 |
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(ionize_rule_1.isValid() == false); |
136 |
|
20 |
} |
137 |
|
|
|
138 |
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("The IonizeRule is validated against reference IsotopicData") |
139 |
|
|
{ |
140 |
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 |
IsotopicDataLibraryHandler iso_data_lib_handler; |
141 |
|
|
|
142 |
|
4 |
std::size_t non_isotope_skipped_items = 0; |
143 |
|
|
std::size_t loaded_isotope_count = |
144 |
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 |
iso_data_lib_handler.loadData(non_isotope_skipped_items); |
145 |
|
|
|
146 |
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(loaded_isotope_count == 288); |
147 |
|
|
|
148 |
|
|
bool result = |
149 |
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
|
4 |
ionize_rule_1.validate(iso_data_lib_handler.getIsotopicData()); |
150 |
|
|
|
151 |
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 validation should succeed") |
152 |
|
|
{ |
153 |
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); |
154 |
|
4 |
} |
155 |
|
24 |
} |
156 |
|
|
|
157 |
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("The IonizeRule is output as a string") |
158 |
|
|
{ |
159 |
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 |
QString output = ionize_rule_1.toString(); |
160 |
|
|
|
161 |
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("That string is tested") |
162 |
|
|
{ |
163 |
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(output.toStdString() == |
164 |
|
|
"Formula: \"Protonation\"+H - charge: 1 -- level: 1"); |
165 |
|
4 |
} |
166 |
|
24 |
} |
167 |
|
|
|
168 |
|
|
|
169 |
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("The IonizeRule is output as an XML element string") |
170 |
|
|
{ |
171 |
|
|
QString *output_xml_p = |
172 |
2/4
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
|
4 |
ionize_rule_1.formatXmlIonizeRuleElement(0, " "); |
173 |
|
|
|
174 |
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 |
QString theoretically_expected = ""; |
175 |
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 |
theoretically_expected += "<ionizerule>\n"; |
176 |
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 |
theoretically_expected += " <formula>\"Protonation\"+H</formula>\n"; |
177 |
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 |
theoretically_expected += " <charge>1</charge>\n"; |
178 |
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 |
theoretically_expected += " <level>1</level>\n"; |
179 |
1/2
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
|
4 |
theoretically_expected += "</ionizerule>\n"; |
180 |
|
|
|
181 |
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(output_xml_p->toStdString() == |
182 |
|
|
theoretically_expected.toStdString()); |
183 |
|
24 |
} |
184 |
|
20 |
} |
185 |
|
40 |
} |
186 |
|
20 |
} |
187 |
|
|
|
188 |
|
|
|
189 |
|
|
} // namespace libXpertMass |
190 |
|
|
} // namespace MsXpS |
191 |
|
|
|