CbmRoot
Loading...
Searching...
No Matches
_GTestCbmTrdDetectorId_simple2.cxx
Go to the documentation of this file.
1/* Copyright (C) 2012 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Florian Uhlig [committer] */
4
5#include "CbmDetectorList.h"
6#include "CbmTrdDetectorId.h"
7
8#include "gtest/gtest-spi.h"
9#include "gtest/gtest.h"
10
11class CbmTrdDetectorIdTest : public ::testing::Test {
12protected:
13 CbmTrdDetectorId fTrdId;
14 int32_t system;
15 int32_t station;
16 int32_t layer;
17 int32_t moduleType;
18 int32_t moduleNr;
19 int32_t sector;
20 int32_t detInfo_array[6];
21 int32_t retVal;
22
23 virtual void SetUp() {}
24
25 virtual void TearDown() {}
26
27 void FillDetArray(int32_t sys, int32_t stat, int32_t lay, int32_t type, int32_t copy, int32_t sect)
28 {
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
38TEST_F(CbmTrdDetectorIdTest, CheckDefaultSettings)
39{
40 FillDetArray(0, 0, 0, 0, 0, 0);
41 retVal = fTrdId.SetDetectorInfo(detInfo_array);
42 EXPECT_EQ(0, retVal);
43
44 FillDetArray(kTRD, 0, 0, 0, 0, 0);
45 retVal = fTrdId.SetDetectorInfo(detInfo_array);
46 EXPECT_EQ(5, retVal);
47
48 FillDetArray(0, 1, 0, 0, 0, 0);
49 retVal = fTrdId.SetDetectorInfo(detInfo_array);
50 EXPECT_EQ(32, retVal);
51
52 FillDetArray(0, 0, 1, 0, 0, 0);
53 retVal = fTrdId.SetDetectorInfo(detInfo_array);
54 EXPECT_EQ(512, retVal);
55
56 FillDetArray(0, 0, 0, 1, 0, 0);
57 retVal = fTrdId.SetDetectorInfo(detInfo_array);
58 EXPECT_EQ(4096, retVal);
59
60 FillDetArray(0, 0, 0, 0, 1, 0);
61 retVal = fTrdId.SetDetectorInfo(detInfo_array);
62 EXPECT_EQ(131072, retVal);
63
64 FillDetArray(0, 0, 0, 0, 0, 1);
65 retVal = fTrdId.SetDetectorInfo(detInfo_array);
66 EXPECT_EQ(33554432, retVal);
67
68 FillDetArray(kTRD, 1, 1, 1, 1, 1);
69 retVal = fTrdId.SetDetectorInfo(detInfo_array);
70 EXPECT_EQ(33690149, retVal);
71
72 FillDetArray(kTRD, 3, 3, 2, 34, 3);
73 retVal = fTrdId.SetDetectorInfo(detInfo_array);
74 EXPECT_EQ(105129573, retVal);
75
76 FillDetArray(0, 0, 0, 8, 0, 0);
77 retVal = fTrdId.SetDetectorInfo(detInfo_array);
78 EXPECT_EQ(32768, retVal);
79
80 FillDetArray(kTRD, 2, 3, 5, 17, 2);
81 retVal = fTrdId.SetDetectorInfo(detInfo_array);
82 EXPECT_EQ(69359173, retVal);
83}
TEST_F(CbmTrdDetectorIdTest, CheckDefaultSettings)
void FillDetArray(int32_t sys, int32_t stat, int32_t lay, int32_t type, int32_t copy, int32_t sect)