CbmRoot
Loading...
Searching...
No Matches
_GTestCbmTrdDetectorId_simple3.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
11// Structure to pass filenames together with expected response into the
12// parametrized test
13struct InOutStructure {
14 int system;
16 int layer;
17 int type;
18 int copynr;
19 int sector;
20 int result;
21};
22
23// This is the derived class for the parameterized test cases.
24class CbmTrdDetectorIdParamTest : public ::testing::TestWithParam<InOutStructure> {
25protected:
26 CbmTrdDetectorId fTrdId;
27 int32_t detInfo_array[6];
28 int32_t result;
29 int32_t uniqueId;
30
31 virtual void SetUp()
32 {
33 InOutStructure const& p = GetParam();
34
35 detInfo_array[0] = p.system;
37 detInfo_array[2] = p.layer;
38 detInfo_array[3] = p.type;
39 detInfo_array[4] = p.copynr;
40 detInfo_array[5] = p.sector;
41 result = p.result;
42 }
43};
44
45
46TEST_P(CbmTrdDetectorIdParamTest, checkUniqueIdCreation)
47{
48 uniqueId = fTrdId.SetDetectorInfo(detInfo_array);
49 EXPECT_EQ(result, uniqueId);
50}
51
52InOutStructure val1 = {0, 0, 0, 0, 0, 0, 0};
53InOutStructure val2 = {kTRD, 0, 0, 0, 0, 0, 5};
54InOutStructure val3 = {0, 1, 0, 0, 0, 0, 32};
55InOutStructure val4 = {0, 0, 1, 0, 0, 0, 512};
56InOutStructure val5 = {0, 0, 0, 1, 0, 0, 4096};
57InOutStructure val6 = {0, 0, 0, 0, 1, 0, 131072};
58InOutStructure val7 = {0, 0, 0, 0, 0, 1, 33554432};
59InOutStructure val8 = {kTRD, 1, 1, 1, 1, 1, 33690149};
60InOutStructure val9 = {kTRD, 3, 3, 2, 34, 3, 105129573};
61InOutStructure val10 = {kTRD, 2, 3, 3, 17, 2, 69350981};
62InOutStructure val11 = {0, 0, 0, 8, 0, 0, 32768};
63InOutStructure val12 = {kTRD, 2, 3, 5, 17, 2, 69359173};
64
65
67 ::testing::Values(val1, val2, val3, val4, val5, val6, val7, val8, val9, val10, val11, val12));
InOutStructure val6
InOutStructure val4
InOutStructure val1
InOutStructure val8
InOutStructure val5
InOutStructure val9
InOutStructure val12
InOutStructure val7
TEST_P(CbmTrdDetectorIdParamTest, checkUniqueIdCreation)
InOutStructure val3
InOutStructure val11
INSTANTIATE_TEST_CASE_P(TestAllParameters, CbmTrdDetectorIdParamTest, ::testing::Values(val1, val2, val3, val4, val5, val6, val7, val8, val9, val10, val11, val12))
InOutStructure val10
InOutStructure val2