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