CbmRoot
Loading...
Searching...
No Matches
_GTestCbmMuchBeamTimeDigi.cxx
Go to the documentation of this file.
1/* Copyright (C) 2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Florian Uhlig [committer] */
4
6
8#include "gtest/gtest-spi.h"
9#include "gtest/gtest.h"
10
11TEST(_GTestCbmMuchBeamTimeDigi, CheckDefaultConstructor)
12{
13 // Create object
15
16 compareMuchBeamTimeDigiDataMembers(test, 0, ECbmModuleId::kMuch, 0, 0, -1, -1, -1, -1, -1, -1);
17
19
20 compareMuchBeamTimeDigiDataMembers(*test1, 0, ECbmModuleId::kMuch, 0, 0, -1, -1, -1, -1, -1, -1);
21}
22
23
24TEST(_GTestCbmMuchBeamTimeDigi, CheckStandardConstructor)
25{
26 // Create object
27 CbmMuchBeamTimeDigi test(111, 23, 987654321);
28
29 compareMuchBeamTimeDigiDataMembers(test, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, -1, -1);
30
31 CbmMuchBeamTimeDigi* test1 = new CbmMuchBeamTimeDigi(111, 23, 987654321);
32
33 compareMuchBeamTimeDigiDataMembers(*test1, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, -1, -1);
34}
35
36TEST(_GTestCbmMuchBeamTimeDigi, CheckCopyConstructor)
37{
38 // Create object
39 CbmMuchBeamTimeDigi test(111, 23, 987654321);
40
41 compareMuchBeamTimeDigiDataMembers(test, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, -1, -1);
42
43 // Create object by copy constructing
44 // test should be equal to test2 and
45 // test should not be changed
46 CbmMuchBeamTimeDigi test2 {test};
47
48
49 compareMuchBeamTimeDigiDataMembers(test2, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, -1, -1);
50
51 // Test if the original object wasn't changede
52 compareMuchBeamTimeDigiDataMembers(test, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, -1, -1);
53}
54
55TEST(_GTestCbmMuchBeamTimeDigi, CheckAssignmentOperator)
56{
57
58 // Create object
59 CbmMuchBeamTimeDigi test(111, 23, 987654321);
60
61 compareMuchBeamTimeDigiDataMembers(test, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, -1, -1);
62
63 // Create object by copy assignment
64 // test should be equal to test2 and
65 // test should not be changed
67 test2 = test;
68
69 compareMuchBeamTimeDigiDataMembers(test2, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, -1, -1);
70
71
72 // Test if the original object wasn't changed
73 compareMuchBeamTimeDigiDataMembers(test, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, -1, -1);
74}
75
76TEST(_GTestCbmMuchBeamTimeDigi, CheckMoveConstructor)
77{
78 // Create object
79 CbmMuchBeamTimeDigi test(111, 23, 987654321);
80
81 compareMuchBeamTimeDigiDataMembers(test, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, -1, -1);
82
83 // Create object by move constructing
84 CbmMuchBeamTimeDigi test2 {std::move(test)};
85
86 compareMuchBeamTimeDigiDataMembers(test2, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, -1, -1);
87
88 compareMuchBeamTimeDigiDataMembers(test, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, -1, -1);
89}
90
91TEST(_GTestCbmMuchBeamTimeDigi, CheckAssignmentMoveConstructor)
92{
93 // Create object
94 CbmMuchBeamTimeDigi test(111, 23, 987654321);
95
96 compareMuchBeamTimeDigiDataMembers(test, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, -1, -1);
97 // Create object by move constructing
98 CbmMuchBeamTimeDigi test2 {};
99 test2 = std::move(test);
100
101 compareMuchBeamTimeDigiDataMembers(test2, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, -1, -1);
102 // For objects with simple types move fall back to copy so
103 // the original object is kept unchanged
104 compareMuchBeamTimeDigiDataMembers(test, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, -1, -1);
105}
106
107
108TEST(_GTestCbmMuchBeamTimeDigi, CheckToString)
109{
110 // Create object
111 CbmMuchBeamTimeDigi test(111, 23, 987654321);
112
113 compareMuchBeamTimeDigiDataMembers(test, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, -1, -1);
114
115 EXPECT_STREQ("", test.ToString().c_str());
116}
117
118TEST(_GTestCbmMuchBeamTimeDigi, CheckGetClassName)
119{
120 // Create object
121 CbmMuchBeamTimeDigi test(111, 23, 987654321);
122
123 compareMuchBeamTimeDigiDataMembers(test, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, -1, -1);
124
125 EXPECT_STREQ("CbmMuchBeamTimeDigi", test.GetClassName());
126}
127
128
129TEST(_GTestCbmMuchDigi, CheckSetPadX)
130{
131 // Create object
132 CbmMuchBeamTimeDigi test(111, 23, 987654321);
133
134 compareMuchBeamTimeDigiDataMembers(test, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, -1, -1);
135
136 test.SetPadX(12);
137
138 compareMuchBeamTimeDigiDataMembers(test, 111, ECbmModuleId::kMuch, 987654321, 23, 12, -1, -1, -1, -1, -1);
139}
140
141
142TEST(_GTestCbmMuchDigi, CheckSetPadY)
143{
144 // Create object
145 CbmMuchBeamTimeDigi test(111, 23, 987654321);
146
147 compareMuchBeamTimeDigiDataMembers(test, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, -1, -1);
148
149 test.SetPadY(13);
150
151 compareMuchBeamTimeDigiDataMembers(test, 111, ECbmModuleId::kMuch, 987654321, 23, -1, 13, -1, -1, -1, -1);
152}
153
154
155TEST(_GTestCbmMuchDigi, CheckSetRocId)
156{
157 // Create object
158 CbmMuchBeamTimeDigi test(111, 23, 987654321);
159
160 compareMuchBeamTimeDigiDataMembers(test, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, -1, -1);
161
162 test.SetRocId(14);
163
164 compareMuchBeamTimeDigiDataMembers(test, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, 14, -1, -1, -1);
165}
166
167TEST(_GTestCbmMuchDigi, CheckSetNxId)
168{
169 // Create object
170 CbmMuchBeamTimeDigi test(111, 23, 987654321);
171
172 compareMuchBeamTimeDigiDataMembers(test, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, -1, -1);
173
174 test.SetNxId(15);
175
176 compareMuchBeamTimeDigiDataMembers(test, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, 15, -1, -1);
177}
178
179TEST(_GTestCbmMuchDigi, CheckSetNxCh)
180{
181 // Create object
182 CbmMuchBeamTimeDigi test(111, 23, 987654321);
183
184 compareMuchBeamTimeDigiDataMembers(test, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, -1, -1);
185
186 test.SetNxCh(16);
187
188 compareMuchBeamTimeDigiDataMembers(test, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, 16, -1);
189}
190
191TEST(_GTestCbmMuchDigi, CheckSetElink)
192{
193 // Create object
194 CbmMuchBeamTimeDigi test(111, 23, 987654321);
195
196 compareMuchBeamTimeDigiDataMembers(test, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, -1, -1);
197
198 test.SetElink(17);
199
200 compareMuchBeamTimeDigiDataMembers(test, 111, ECbmModuleId::kMuch, 987654321, 23, -1, -1, -1, -1, -1, 17);
201}
@ kMuch
Muon detection system.
TEST(_GTestCbmMuchBeamTimeDigi, CheckDefaultConstructor)
void SetNxId(int32_t nxId)
void SetPadX(int32_t padX)
void SetPadY(int32_t padY)
void SetRocId(int32_t rocId)
std::string ToString() const
void SetNxCh(int32_t nxCh)
static const char * GetClassName()
Class name (static)
void SetElink(int32_t elink)
void compareMuchBeamTimeDigiDataMembers(CbmMuchBeamTimeDigi &test, int32_t address, ECbmModuleId systemid, uint64_t time, int32_t charge, int32_t padx, int32_t pady, int32_t rocid, int32_t nxid, int32_t nxch, int32_t elink)