Project
Loading...
Searching...
No Matches
testRDHUtils.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 TPC CalDet class
13#define BOOST_TEST_MAIN
14#define BOOST_TEST_DYN_LINK
15#include <boost/test/unit_test.hpp>
16
17#include <vector>
18
20#include "TPCBase/RDHUtils.h"
21
22namespace o2
23{
24namespace tpc
25{
26using namespace rdh_utils;
27
28struct FEEDetails {
29 FEEDetails(FEEIDType c, FEEIDType e, FEEIDType l) : cru(c), endpoint(e), link(l), feeID((cru << 7) | (endpoint << 6) | link), userLogic(l == UserLogicLinkID) {}
34 bool userLogic{};
35};
36
38{
39 // coose some random values
40 std::vector<FEEDetails> testDetails;
41 testDetails.emplace_back(359, 1, 15);
42 testDetails.emplace_back(1, 0, 10);
43 testDetails.emplace_back(100, 1, 8);
44 testDetails.emplace_back(142, 0, 1);
45 testDetails.emplace_back(225, 1, 9);
46
51
52 for (const auto& fee : testDetails) {
53 const auto feeID = getFEEID(fee.cru, fee.endpoint, fee.link);
54
55 // default checks
56 auto cru = getCRU(feeID);
57 auto link = getLink(feeID);
58 auto endpoint = getEndPoint(feeID);
59 bool userLogic = isFromUserLogic(feeID);
60
61 BOOST_CHECK_EQUAL(feeID, fee.feeID);
62 BOOST_CHECK_EQUAL(cru, fee.cru);
63 BOOST_CHECK_EQUAL(endpoint, fee.endpoint);
64 BOOST_CHECK_EQUAL(link, fee.link);
65 BOOST_CHECK_EQUAL(userLogic, fee.userLogic);
66
67 // RDH v4 checks
68 rdh4.feeId = feeID;
69 cru = getCRU(rdh4);
70 link = getLink(rdh4);
71 endpoint = getEndPoint(rdh4);
72 userLogic = isFromUserLogic(rdh4);
73
74 BOOST_CHECK_EQUAL(feeID, fee.feeID);
75 BOOST_CHECK_EQUAL(cru, fee.cru);
76 BOOST_CHECK_EQUAL(endpoint, fee.endpoint);
77 BOOST_CHECK_EQUAL(link, fee.link);
78 BOOST_CHECK_EQUAL(userLogic, fee.userLogic);
79
80 // RDH v5 checks
81 rdh5.feeId = feeID;
82 cru = getCRU(rdh5);
83 link = getLink(rdh5);
84 endpoint = getEndPoint(rdh5);
85 userLogic = isFromUserLogic(rdh5);
86
87 BOOST_CHECK_EQUAL(feeID, fee.feeID);
88 BOOST_CHECK_EQUAL(cru, fee.cru);
89 BOOST_CHECK_EQUAL(endpoint, fee.endpoint);
90 BOOST_CHECK_EQUAL(link, fee.link);
91 BOOST_CHECK_EQUAL(userLogic, fee.userLogic);
92
93 // RDH v6 checks
94 rdh6.feeId = feeID;
95 cru = getCRU(rdh6);
96 link = getLink(rdh6);
97 endpoint = getEndPoint(rdh6);
98 userLogic = isFromUserLogic(rdh6);
99
100 BOOST_CHECK_EQUAL(feeID, fee.feeID);
101 BOOST_CHECK_EQUAL(cru, fee.cru);
102 BOOST_CHECK_EQUAL(endpoint, fee.endpoint);
103 BOOST_CHECK_EQUAL(link, fee.link);
104 BOOST_CHECK_EQUAL(userLogic, fee.userLogic);
105
106 // RDH v7 checks
107 rdh7.feeId = feeID;
108 cru = getCRU(rdh7);
109 link = getLink(rdh7);
110 endpoint = getEndPoint(rdh7);
111 userLogic = isFromUserLogic(rdh7);
112
113 BOOST_CHECK_EQUAL(feeID, fee.feeID);
114 BOOST_CHECK_EQUAL(cru, fee.cru);
115 BOOST_CHECK_EQUAL(endpoint, fee.endpoint);
116 BOOST_CHECK_EQUAL(link, fee.link);
117 BOOST_CHECK_EQUAL(userLogic, fee.userLogic);
118 }
119}
120
121} // namespace tpc
122} // namespace o2
Definition of the RAW Data Header.
uint8_t endpoint
Definition RawData.h:0
uint32_t c
Definition RawData.h:2
uint16_t FEEIDType
Definition RDHUtils.h:26
BOOST_AUTO_TEST_CASE(ClusterHardware_test1)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
uint64_t feeId
bit 16 to 31: block length
uint64_t feeId
bit 8 to 15: header size
uint64_t feeId
bit 8 to 15: header size
uint64_t feeId
bit 8 to 15: header size
FEEDetails(FEEIDType c, FEEIDType e, FEEIDType l)
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())