Project
Loading...
Searching...
No Matches
testChannelCode.cxx
Go to the documentation of this file.
1
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3
// All rights not expressly granted are reserved.
4
//
5
// This software is distributed under the terms of the GNU General Public
6
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7
//
8
// In applying this license CERN does not waive the privileges and immunities
9
// granted to it by virtue of its status as an Intergovernmental Organization
10
// or submit itself to any jurisdiction.
11
12
#include <boost/test/tools/old/interface.hpp>
13
#include <type_traits>
14
#define BOOST_TEST_MODULE MCH ChannelCode
15
#define BOOST_TEST_DYN_LINK
16
#include <boost/test/unit_test.hpp>
17
#include <boost/test/data/test_case.hpp>
18
#include <boost/test/data/monomorphic.hpp>
19
20
#include <array>
21
#include "
MCHGlobalMapping/ChannelCode.h
"
22
23
BOOST_AUTO_TEST_CASE
(CtorShowThrowForInvalidDeId)
24
{
25
BOOST_CHECK_THROW(
o2::mch::ChannelCode
(42, 0), std::runtime_error);
26
}
27
28
BOOST_AUTO_TEST_CASE
(CtorShowThrowForInvalidDePadIndex)
29
{
30
BOOST_CHECK_THROW(
o2::mch::ChannelCode
(1002, 7616), std::runtime_error);
31
}
32
33
BOOST_AUTO_TEST_CASE
(CtorShowThrowForInvalidSolarId)
34
{
35
BOOST_CHECK_THROW(
o2::mch::ChannelCode
(0, 0, 0), std::runtime_error);
36
}
37
38
BOOST_AUTO_TEST_CASE
(Ctor1)
39
{
40
// same pad expressed two different ways
41
std::array<o2::mch::ChannelCode, 2>
ids
= {
42
o2::mch::ChannelCode
(1002, 7615),
43
o2::mch::ChannelCode
(557, 7, 60)};
44
45
for
(
const
auto
&
id
:
ids
) {
46
BOOST_CHECK_EQUAL
(
id
.isValid(),
true
);
47
BOOST_CHECK_EQUAL
(
id
.getDeId(), 1002);
48
BOOST_CHECK_EQUAL
(
id
.getDsId(), 1361);
49
BOOST_CHECK_EQUAL
(
id
.getChannel(), 60);
50
BOOST_CHECK_EQUAL
(
id
.getSolarId(), 557);
51
BOOST_CHECK_EQUAL
(
id
.getElinkId(), 7);
52
BOOST_CHECK_EQUAL
(
id
.getDePadIndex(), 7615);
53
}
54
}
55
56
BOOST_AUTO_TEST_CASE
(Ctor2)
57
{
58
// same pad expressed two different ways
59
std::array<o2::mch::ChannelCode, 2>
ids
= {
60
o2::mch::ChannelCode
(100, 28626),
61
o2::mch::ChannelCode
(325, 39, 63)};
62
63
for
(
const
auto
&
id
:
ids
) {
64
BOOST_CHECK_EQUAL
(
id
.isValid(),
true
);
65
BOOST_CHECK_EQUAL
(
id
.getDeId(), 100);
66
BOOST_CHECK_EQUAL
(
id
.getDsId(), 1267);
67
BOOST_CHECK_EQUAL
(
id
.getChannel(), 63);
68
BOOST_CHECK_EQUAL
(
id
.getSolarId(), 325);
69
BOOST_CHECK_EQUAL
(
id
.getElinkId(), 39);
70
BOOST_CHECK_EQUAL
(
id
.getDePadIndex(), 28626);
71
}
72
}
73
74
BOOST_AUTO_TEST_CASE
(ChannelCodeCanBeUsedAsMapKey)
75
{
76
std::map<o2::mch::ChannelCode, int> maptest;
77
o2::mch::ChannelCode
cc
(1002, 7615);
78
maptest[
cc
] = 42;
79
BOOST_CHECK_EQUAL
(maptest[
cc
], 42);
80
}
81
82
BOOST_AUTO_TEST_CASE
(DefaultConstructorYieldInvalidValue)
83
{
84
o2::mch::ChannelCode
cc
;
85
BOOST_CHECK_EQUAL
(
cc
.isValid(),
false
);
86
}
ChannelCode.h
o2::mch::ChannelCode
Definition
ChannelCode.h:47
ids
GLuint * ids
Definition
glcorearb.h:647
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(CtorShowThrowForInvalidDeId)
Definition
testChannelCode.cxx:23
cc
std::vector< o2::mch::ChannelCode > cc
Definition
testStatusMap.cxx:37
BOOST_CHECK_EQUAL
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())
Detectors
MUON
MCH
GlobalMapping
src
testChannelCode.cxx
Generated on Tue Feb 25 2025 23:16:22 for Project by
1.9.8