CbmRoot
_GTestCbmTrdDetectorId_simple3.cxx
Go to the documentation of this file.
1 #include "CbmDetectorList.h"
2 #include "CbmTrdDetectorId.h"
3 
4 #include "gtest/gtest-spi.h"
5 #include "gtest/gtest.h"
6 
7 // Structure to pass filenames together with expected response into the
8 // parametrized test
9 struct InOutStructure {
10  int system;
11  int station;
12  int layer;
13  int type;
14  int copynr;
15  int sector;
16  int result;
17 };
18 
19 // This is the derived class for the parameterized test cases.
21  public ::testing::TestWithParam<InOutStructure> {
22 protected:
23  CbmTrdDetectorId fTrdId;
24  Int_t detInfo_array[6];
25  Int_t result;
26  Int_t uniqueId;
27 
28  virtual void SetUp() {
29  InOutStructure const& p = GetParam();
30 
31  detInfo_array[0] = p.system;
32  detInfo_array[1] = p.station;
33  detInfo_array[2] = p.layer;
34  detInfo_array[3] = p.type;
35  detInfo_array[4] = p.copynr;
36  detInfo_array[5] = p.sector;
37  result = p.result;
38  }
39 };
40 
41 
42 TEST_P(CbmTrdDetectorIdParamTest, checkUniqueIdCreation) {
43  uniqueId = fTrdId.SetDetectorInfo(detInfo_array);
44  EXPECT_EQ(result, uniqueId);
45 }
46 
47 InOutStructure val1 = {0, 0, 0, 0, 0, 0, 0};
48 InOutStructure val2 = {kTRD, 0, 0, 0, 0, 0, 5};
49 InOutStructure val3 = {0, 1, 0, 0, 0, 0, 32};
50 InOutStructure val4 = {0, 0, 1, 0, 0, 0, 512};
51 InOutStructure val5 = {0, 0, 0, 1, 0, 0, 4096};
52 InOutStructure val6 = {0, 0, 0, 0, 1, 0, 131072};
53 InOutStructure val7 = {0, 0, 0, 0, 0, 1, 33554432};
54 InOutStructure val8 = {kTRD, 1, 1, 1, 1, 1, 33690149};
55 InOutStructure val9 = {kTRD, 3, 3, 2, 34, 3, 105129573};
56 InOutStructure val10 = {kTRD, 2, 3, 3, 17, 2, 69350981};
57 InOutStructure val11 = {0, 0, 0, 8, 0, 0, 32768};
58 InOutStructure val12 = {kTRD, 2, 3, 5, 17, 2, 69359173};
59 
60 
61 INSTANTIATE_TEST_CASE_P(TestAllParameters,
63  ::testing::Values(val1,
64  val2,
65  val3,
66  val4,
67  val5,
68  val6,
69  val7,
70  val8,
71  val9,
72  val10,
73  val11,
74  val12));
InOutStructure::copynr
int copynr
Definition: _GTestCbmTrdDetectorId_simple3.cxx:14
CbmTrdDetectorIdParamTest::uniqueId
Int_t uniqueId
Definition: _GTestCbmTrdDetectorId_simple3.cxx:26
InOutStructure::layer
int layer
Definition: _GTestCbmTrdDetectorId.cxx:15
val1
InOutStructure val1
Definition: _GTestCbmTrdDetectorId_simple3.cxx:47
InOutStructure
Definition: _GTestCbmDefs.cxx:14
CbmTrdDetectorIdParamTest::result
Int_t result
Definition: _GTestCbmTrdDetectorId_simple3.cxx:25
val12
InOutStructure val12
Definition: _GTestCbmTrdDetectorId_simple3.cxx:58
val2
InOutStructure val2
Definition: _GTestCbmTrdDetectorId_simple3.cxx:48
val11
InOutStructure val11
Definition: _GTestCbmTrdDetectorId_simple3.cxx:57
val4
InOutStructure val4
Definition: _GTestCbmTrdDetectorId_simple3.cxx:50
CbmTrdDetectorIdParamTest
Definition: _GTestCbmTrdDetectorId_simple3.cxx:21
InOutStructure::sector
int sector
Definition: _GTestCbmTrdDetectorId.cxx:17
val9
InOutStructure val9
Definition: _GTestCbmTrdDetectorId_simple3.cxx:55
INSTANTIATE_TEST_CASE_P
INSTANTIATE_TEST_CASE_P(TestAllParameters, CbmTrdDetectorIdParamTest, ::testing::Values(val1, val2, val3, val4, val5, val6, val7, val8, val9, val10, val11, val12))
InOutStructure::type
int type
Definition: _GTestCbmTrdDetectorId_simple3.cxx:13
val5
InOutStructure val5
Definition: _GTestCbmTrdDetectorId_simple3.cxx:51
val3
InOutStructure val3
Definition: _GTestCbmTrdDetectorId_simple3.cxx:49
TEST_P
TEST_P(CbmTrdDetectorIdParamTest, checkUniqueIdCreation)
Definition: _GTestCbmTrdDetectorId_simple3.cxx:42
val6
InOutStructure val6
Definition: _GTestCbmTrdDetectorId_simple3.cxx:52
InOutStructure::system
int system
Definition: _GTestCbmTrdDetectorId_simple3.cxx:10
val10
InOutStructure val10
Definition: _GTestCbmTrdDetectorId_simple3.cxx:56
val8
InOutStructure val8
Definition: _GTestCbmTrdDetectorId_simple3.cxx:54
NicaCbmDetectorID::kTRD
const UInt_t kTRD
Definition: CbmDetectorID.h:19
CbmTrdDetectorIdParamTest::SetUp
virtual void SetUp()
Definition: _GTestCbmTrdDetectorId_simple3.cxx:28
InOutStructure::result
int result
Definition: _GTestCbmTrdDetectorId.cxx:20
CbmTrdDetectorIdParamTest::detInfo_array
Int_t detInfo_array[6]
Definition: _GTestCbmTrdDetectorId_simple3.cxx:24
CbmTrdDetectorIdParamTest::fTrdId
CbmTrdDetectorId fTrdId
Definition: _GTestCbmTrdDetectorId_simple3.cxx:23
val7
InOutStructure val7
Definition: _GTestCbmTrdDetectorId_simple3.cxx:53
InOutStructure::station
int station
Definition: _GTestCbmTrdDetectorId_simple3.cxx:11