17TEST(_GTestCbmVertex, CheckDefaultConstructor)
20 double val[6] = {0., 0., 0., 0., 0., 0.};
22 SCOPED_TRACE(
"CheckDefaultConstructor");
27TEST(_GTestCbmVertex, CheckStandardConstructor)
30 double val[6] = {0., 0., 0., 0., 0., 0.};
32 SCOPED_TRACE(
"CheckStandardConstructor");
37TEST(_GTestCbmVertex, CheckConstructorAllArguments)
50 double val[6] = {0., 1., 2., 3., 4., 5.};
51 CbmVertex test {
"Vertex",
"Vertex", 1., 2., 3., 4., 5, 6, Cov};
53 SCOPED_TRACE(
"CheckConstructorAllArguments");
60 TMatrixFSym CovWrong(2);
66 double val1[6] = {0., 0., 0., 0., 0., 0.};
68 testing::internal::CaptureStdout();
69 CbmVertex test1 {
"Vertex",
"Vertex", 1., 2., 3., 4., 5, 6, CovWrong};
70 std::string output = testing::internal::GetCapturedStdout();
72 std::regex f(
"\\[ERROR(.*)\\](.*)(Wrong dimension of passed covariance "
73 "matrix\\. Clear the covariance matrix)(.*)\\n");
74 bool retval = std::regex_match(output, f);
76 std::cout <<
" Actual: " << output << std::endl;
77 std::cout <<
"Expected: "
78 <<
"\\[ERROR\\](.*)(Wrong dimension of passed covariance "
79 "matrix\\. Clear the covariance matrix)(.*)\\n"
85 SCOPED_TRACE(
"CheckConstructorAllArgumentsWrongCovMatrix");
90TEST(_GTestCbmVertex, CheckReset)
103 double val[6] = {0., 1., 2., 3., 4., 5.};
104 CbmVertex test {
"Vertex",
"Vertex", 1., 2., 3., 4., 5, 6, Cov};
106 SCOPED_TRACE(
"CheckReset: Initial Test");
110 double val1[6] = {0., 0., 0., 0., 0., 0.};
113 SCOPED_TRACE(
"CheckReset: Check after reset");
118TEST(_GTestCbmVertex, CheckGetPosition)
131 double val[6] = {0., 1., 2., 3., 4., 5.};
132 CbmVertex test {
"Vertex",
"Vertex", 1., 2., 3., 4., 5, 6, Cov};
134 SCOPED_TRACE(
"CheckGetPosition: Initial Test");
142 SCOPED_TRACE(
"CheckGetPosition: Check after Position");
145 EXPECT_FLOAT_EQ(1., testVect.X());
146 EXPECT_FLOAT_EQ(2., testVect.Y());
147 EXPECT_FLOAT_EQ(3., testVect.Z());
151TEST(_GTestCbmVertex, CheckGetCovMatrix)
164 double val[6] = {0., 1., 2., 3., 4., 5.};
165 CbmVertex test {
"Vertex",
"Vertex", 1., 2., 3., 4., 5, 6, Cov};
167 SCOPED_TRACE(
"CheckGetCovMatrix: Initial Test");
171 TMatrixFSym testCov(3);
173 test.CovMatrix(testCov);
175 SCOPED_TRACE(
"CheckGetCovMatrix: Check after Position");
178 for (int32_t i = 0; i < 3; ++i) {
179 for (int32_t j = 0; j < 3; ++j) {
180 double origVal = Cov[i][j];
181 double testVal = testCov[i][j];
182 EXPECT_FLOAT_EQ(testVal, origVal);
188TEST(_GTestCbmVertex, CheckSetVertex)
192 double val[6] = {0., 0., 0., 0., 0., 0.};
194 SCOPED_TRACE(
"CheckSetVertex: Initial Test");
209 double val1[6] = {0., 1., 2., 3., 4., 5.};
210 test.
SetVertex(1., 2., 3., 4., 5, 6, Cov);
212 SCOPED_TRACE(
"CheckSetVertex: After call of SetVertex");
219 TMatrixFSym CovWrong(2);
225 double val2[6] = {0., 0., 0., 0., 0., 0.};
227 testing::internal::CaptureStdout();
228 test.
SetVertex(-1., -2., -3., -4., -5, -6, CovWrong);
229 std::string output = testing::internal::GetCapturedStdout();
231 std::regex f(
"\\[ERROR(.*)\\](.*)(Wrong dimension of passed covariance "
232 "matrix\\. Clear the covariance matrix)(.*)\\n");
233 bool retval = std::regex_match(output, f);
235 std::cout <<
" Actual: " << output << std::endl;
236 std::cout <<
"Expected: "
237 <<
"\\[ERROR\\](.*)(Wrong dimension of passed covariance "
238 "matrix\\. Clear the covariance matrix)(.*)\\n"
244 SCOPED_TRACE(
"CheckSetVertex: Check after SetVertex with wrong cov matrix");
249TEST(_GTestCbmVertex, CheckPrint)
262 double val[6] = {0., 1., 2., 3., 4., 5.};
263 CbmVertex test {
"Vertex",
"Vertex", 1., 2., 3., 4., 5, 6, Cov};
265 SCOPED_TRACE(
"CheckSetVertex: Initial Test");
269 EXPECT_STREQ(
"Vertex: position (1.0000, 2.0000, 3.0000) cm, chi2/ndf = "
270 "0.8000, tracks used: 6",
271 test.ToString().c_str());
274 CbmVertex test1 {
"Vertex",
"Vertex", 1., 2., 3., 4., 0, 6, Cov};
276 SCOPED_TRACE(
"CheckSetVertex: Initial Test");
280 EXPECT_STREQ(
"Vertex: position (1.0000, 2.0000, 3.0000) cm, chi2/ndf = "
281 "0.0000, tracks used: 6",
282 test1.ToString().c_str());
void SetVertex(double x, double y, double z, double chi2, int32_t ndf, int32_t nTracks, const TMatrixFSym &covMat)
void compareVertexDataMembers(CbmVertex &test, double x, double y, double z, double chi2, int32_t ndf, int32_t ntracks, double *cov)