Project
Loading...
Searching...
No Matches
testDetID.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#define BOOST_TEST_MODULE Test DetID
13#define BOOST_TEST_MAIN
14#define BOOST_TEST_DYN_LINK
15#include <boost/test/unit_test.hpp>
16#include <iostream>
18
19using namespace o2::detectors;
20
22{
23 // test for the templated Descriptor struct
24 for (DetID::ID id = DetID::First; id <= DetID::Last; id++) {
25 DetID det(id);
26 std::cout << "#" << id << " Detector " << det.getName() << " ID=" << det << " mask: " << det.getMask() << std::endl;
27 BOOST_CHECK(id == det);
28
29 // test that all names are initialized
30 BOOST_CHECK(std::strlen(det.getName()) <= 3 && std::strlen(det.getName()) > 0);
31 }
32
33 {
34 // test specific name access
35 DetID det(DetID::ITS);
36 BOOST_CHECK(std::strcmp(det.getName(), "ITS") == 0);
37 }
38}
Static class with identifiers, bitmasks and names for ALICE detectors.
Definition DetID.h:58
static constexpr const char * getName(ID id)
names of defined detectors
Definition DetID.h:145
static constexpr ID ITS
Definition DetID.h:63
static constexpr ID First
Definition DetID.h:94
static constexpr ID Last
if extra detectors added, update this !!!
Definition DetID.h:92
static mask_t getMask(const std::string_view detList)
detector masks from any non-alpha-num delimiter-separated list (empty if NONE is supplied)
Definition DetID.cxx:42
BOOST_AUTO_TEST_CASE(DetID_test)
Definition testDetID.cxx:21
BOOST_CHECK(tree)