3 #include "gtest/gtest-spi.h"
4 #include "gtest/gtest.h"
9 TEST(_GTestCbmPsdPoint, CheckDefaultConstructor) {
14 test, -1, -1, TVector3(0., 0., 0.), TVector3(0., 0., 0.), 0., 0., 0., 0, 0);
30 TEST(_GTestCbmPsdPoint, CheckStandardConstructor) {
33 TVector3
pos {-2.1, 6.1, 23.};
34 TVector3 mom {2.5, 4.5, 78.};
36 Double_t length {1.2};
37 Double_t eloss {0.4567};
44 test, trackid, detid,
pos, mom, tof, length, eloss, moduleid, eventid);
50 *test1, trackid, detid,
pos, mom, tof, length, eloss, moduleid, eventid);
53 TEST(_GTestCbmPsdPoint, CheckCopyConstructor) {
56 TVector3
pos {-2.1, 6.1, 23.};
57 TVector3 mom {2.5, 4.5, 78.};
59 Double_t length {1.2};
60 Double_t eloss {0.4567};
67 test, trackid, detid,
pos, mom, tof, length, eloss, moduleid, eventid);
75 test2, trackid, detid,
pos, mom, tof, length, eloss, moduleid, eventid);
79 test, trackid, detid,
pos, mom, tof, length, eloss, moduleid, eventid);
82 TEST(_GTestCbmPsdPoint, CheckCopyAssignmentOperator) {
85 TVector3
pos {-2.1, 6.1, 23.};
86 TVector3 mom {2.5, 4.5, 78.};
88 Double_t length {1.2};
89 Double_t eloss {0.4567};
96 test, trackid, detid,
pos, mom, tof, length, eloss, moduleid, eventid);
105 test2, trackid, detid,
pos, mom, tof, length, eloss, moduleid, eventid);
109 test, trackid, detid,
pos, mom, tof, length, eloss, moduleid, eventid);
112 TEST(_GTestCbmPsdPoint, CheckMoveConstructor) {
115 TVector3
pos {-2.1, 6.1, 23.};
116 TVector3 mom {2.5, 4.5, 78.};
117 Double_t tof {34.56};
118 Double_t length {1.2};
119 Double_t eloss {0.4567};
126 test, trackid, detid,
pos, mom, tof, length, eloss, moduleid, eventid);
134 test2, trackid, detid,
pos, mom, tof, length, eloss, moduleid, eventid);
139 test, trackid, detid,
pos, mom, tof, length, eloss, moduleid, eventid);
142 TEST(_GTestCbmPsdPoint, CheckAssignmentOperator) {
145 TVector3
pos {-2.1, 6.1, 23.};
146 TVector3 mom {2.5, 4.5, 78.};
147 Double_t tof {34.56};
148 Double_t length {1.2};
149 Double_t eloss {0.4567};
156 test, trackid, detid,
pos, mom, tof, length, eloss, moduleid, eventid);
162 test2 = std::move(test);
165 test2, trackid, detid,
pos, mom, tof, length, eloss, moduleid, eventid);
170 test, trackid, detid,
pos, mom, tof, length, eloss, moduleid, eventid);
173 TEST(_GTestCbmPsdPoint, CheckSetModuleID) {
176 TVector3
pos {-2.1, 6.1, 23.};
177 TVector3 mom {2.5, 4.5, 78.};
178 Double_t tof {34.56};
179 Double_t length {1.2};
180 Double_t eloss {0.4567};
187 test, trackid, detid,
pos, mom, tof, length, eloss, moduleid, eventid);
193 test, trackid, detid,
pos, mom, tof, length, eloss, 111, eventid);
196 TEST(_GTestCbmPsdPoint, CheckToString) {
199 TVector3
pos {-2.1, 6.1, 23.};
200 TVector3 mom {2.5, 4.5, 78.};
201 Double_t tof {34.56};
202 Double_t length {1.2};
203 Double_t eloss {0.4567};
210 test, trackid, detid,
pos, mom, tof, length, eloss, moduleid, eventid);
212 EXPECT_STREQ(
"PSD point for track 34 in detector 45\n Position (-2.1, "
213 "6.1, 23) cm\n Momentum (2.5, 4.5, 78) GeV\n Time 34.56 "
214 "ns, Length 1.2 cm, Energy loss 456700 keV",
218 TEST(_GTestCbmPsdPoint, CheckPrint) {
221 TVector3
pos {-2.1, 6.1, 23.};
222 TVector3 mom {2.5, 4.5, 78.};
223 Double_t tof {34.56};
224 Double_t length {1.2};
225 Double_t eloss {0.4567};
232 test, trackid, detid,
pos, mom, tof, length, eloss, moduleid, eventid);
234 testing::internal::CaptureStdout();
236 std::string output = testing::internal::GetCapturedStdout();
238 EXPECT_STREQ(
"[INFO] PSD point for track 34 in detector 45\n Position "
239 "(-2.1, 6.1, 23) cm\n Momentum (2.5, 4.5, 78) GeV\n Time "
240 "34.56 ns, Length 1.2 cm, Energy loss 456700 keV\n",