CbmRoot
_GTestCbmTrdDetectorId_simple2.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 class CbmTrdDetectorIdTest : public ::testing::Test {
8 protected:
9  CbmTrdDetectorId fTrdId;
10  Int_t system;
11  Int_t station;
12  Int_t layer;
13  Int_t moduleType;
14  Int_t moduleNr;
15  Int_t sector;
16  Int_t detInfo_array[6];
17  Int_t retVal;
18 
19  virtual void SetUp() {}
20 
21  virtual void TearDown() {}
22 
23  void FillDetArray(Int_t sys,
24  Int_t stat,
25  Int_t lay,
26  Int_t type,
27  Int_t copy,
28  Int_t sect) {
29  detInfo_array[0] = sys;
30  detInfo_array[1] = stat;
31  detInfo_array[2] = lay;
32  detInfo_array[3] = type;
33  detInfo_array[4] = copy;
34  detInfo_array[5] = sect;
35  }
36 };
37 
38 TEST_F(CbmTrdDetectorIdTest, CheckDefaultSettings) {
39  FillDetArray(0, 0, 0, 0, 0, 0);
40  retVal = fTrdId.SetDetectorInfo(detInfo_array);
41  EXPECT_EQ(0, retVal);
42 
43  FillDetArray(kTRD, 0, 0, 0, 0, 0);
44  retVal = fTrdId.SetDetectorInfo(detInfo_array);
45  EXPECT_EQ(5, retVal);
46 
47  FillDetArray(0, 1, 0, 0, 0, 0);
48  retVal = fTrdId.SetDetectorInfo(detInfo_array);
49  EXPECT_EQ(32, retVal);
50 
51  FillDetArray(0, 0, 1, 0, 0, 0);
52  retVal = fTrdId.SetDetectorInfo(detInfo_array);
53  EXPECT_EQ(512, retVal);
54 
55  FillDetArray(0, 0, 0, 1, 0, 0);
56  retVal = fTrdId.SetDetectorInfo(detInfo_array);
57  EXPECT_EQ(4096, retVal);
58 
59  FillDetArray(0, 0, 0, 0, 1, 0);
60  retVal = fTrdId.SetDetectorInfo(detInfo_array);
61  EXPECT_EQ(131072, retVal);
62 
63  FillDetArray(0, 0, 0, 0, 0, 1);
64  retVal = fTrdId.SetDetectorInfo(detInfo_array);
65  EXPECT_EQ(33554432, retVal);
66 
67  FillDetArray(kTRD, 1, 1, 1, 1, 1);
68  retVal = fTrdId.SetDetectorInfo(detInfo_array);
69  EXPECT_EQ(33690149, retVal);
70 
71  FillDetArray(kTRD, 3, 3, 2, 34, 3);
72  retVal = fTrdId.SetDetectorInfo(detInfo_array);
73  EXPECT_EQ(105129573, retVal);
74 
75  FillDetArray(0, 0, 0, 8, 0, 0);
76  retVal = fTrdId.SetDetectorInfo(detInfo_array);
77  EXPECT_EQ(32768, retVal);
78 
79  FillDetArray(kTRD, 2, 3, 5, 17, 2);
80  retVal = fTrdId.SetDetectorInfo(detInfo_array);
81  EXPECT_EQ(69359173, retVal);
82 }
CbmTrdDetectorIdTest::detInfo_array
Int_t detInfo_array[6]
Definition: _GTestCbmTrdDetectorId_simple2.cxx:16
CbmTrdDetectorIdTest
Definition: _GTestCbmTrdDetectorId_simple2.cxx:7
CbmTrdDetectorIdTest::layer
Int_t layer
Definition: _GTestCbmTrdDetectorId_simple2.cxx:12
TEST_F
TEST_F(CbmTrdDetectorIdTest, CheckDefaultSettings)
Definition: _GTestCbmTrdDetectorId_simple2.cxx:38
CbmTrdDetectorIdTest::TearDown
virtual void TearDown()
Definition: _GTestCbmTrdDetectorId_simple2.cxx:21
CbmTrdDetectorIdTest::fTrdId
CbmTrdDetectorId fTrdId
Definition: _GTestCbmTrdDetectorId_simple2.cxx:9
CbmTrdDetectorIdTest::sector
Int_t sector
Definition: _GTestCbmTrdDetectorId_simple2.cxx:15
CbmTrdDetectorIdTest::moduleNr
Int_t moduleNr
Definition: _GTestCbmTrdDetectorId_simple2.cxx:14
CbmTrdDetectorIdTest::SetUp
virtual void SetUp()
Definition: _GTestCbmTrdDetectorId_simple2.cxx:19
CbmTrdDetectorIdTest::FillDetArray
void FillDetArray(Int_t sys, Int_t stat, Int_t lay, Int_t type, Int_t copy, Int_t sect)
Definition: _GTestCbmTrdDetectorId_simple2.cxx:23
CbmTrdDetectorIdTest::retVal
Int_t retVal
Definition: _GTestCbmTrdDetectorId_simple2.cxx:17
NicaCbmDetectorID::kTRD
const UInt_t kTRD
Definition: CbmDetectorID.h:19
CbmTrdDetectorIdTest::system
Int_t system
Definition: _GTestCbmTrdDetectorId_simple2.cxx:10
CbmTrdDetectorIdTest::station
Int_t station
Definition: _GTestCbmTrdDetectorId_simple2.cxx:11
CbmTrdDetectorIdTest::moduleType
Int_t moduleType
Definition: _GTestCbmTrdDetectorId_simple2.cxx:13