Project
Loading...
Searching...
No Matches
testDAQID.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 DAQID class
13#define BOOST_TEST_MAIN
14#define BOOST_TEST_DYN_LINK
15
16#include "Headers/DAQID.h"
17#include <boost/test/unit_test.hpp>
18#include <iostream>
19
20// @brief consistency test for O2 origin <-> DAQ Source ID mapping
21// @author ruben.shahoyan@cern.ch
22
23using namespace o2::header;
24
26{
27
28 for (int i = 0; i < DAQID::MAXDAQ + 5; i++) {
29 auto vo2 = DAQID::DAQtoO2(i);
30 auto daq = DAQID::O2toDAQ(vo2);
31 if (vo2 != DAQID::DAQtoO2(DAQID::INVALID)) {
32 std::cout << "DAQ SourceID " << i << " <-> " << vo2.str << std::endl;
33 }
34 BOOST_CHECK(i == daq || vo2 == DAQID::DAQtoO2(DAQID::INVALID));
35 }
36 std::cout << "DAQ INVALID " << int(DAQID::INVALID) << " <-> " << DAQID::DAQtoO2(DAQID::INVALID).str << std::endl;
37 std::cout << "DAQ UNLOADED " << int(DAQID::UNLOADED) << " <-> " << DAQID::DAQtoO2(DAQID::UNLOADED).str << std::endl;
40}
int32_t i
static constexpr o2::header::DataOrigin DAQtoO2(ID daq)
Definition DAQID.h:65
static constexpr ID INVALID
Definition DAQID.h:40
static constexpr ID MAXDAQ
Definition DAQID.h:56
static constexpr ID UNLOADED
Definition DAQID.h:54
static constexpr ID O2toDAQ(o2::header::DataOrigin o2orig)
Definition DAQID.h:70
O2 data header classes and API, v0.1.
Definition DetID.h:49
constexpr o2::header::DataOrigin gDataOriginUnloaded
Source IDs used by DAQ.
Definition DAQID.h:26
BOOST_AUTO_TEST_CASE(DAQIDTEST)
Definition testDAQID.cxx:25
BOOST_CHECK(tree)