Project
Loading...
Searching...
No Matches
test_Cluster.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 DataFormatsITSMFT
13#define BOOST_TEST_MAIN
14#define BOOST_TEST_DYN_LINK
15#include <boost/test/unit_test.hpp>
17
18namespace o2::itsmft
19{
20
21// we explicitly declare o2::itsmft::Cluster as messageable and have to make
22// sure that this is fulfilled
23BOOST_AUTO_TEST_CASE(Cluster_messageable)
24{
25 using ElementType = Cluster;
27 std::vector<ElementType> clusters(10);
28 auto makeElement = [](size_t idx) {
29 return ElementType{};
30 };
31 size_t idx = 0;
32 for (auto& cluster : clusters) {
33 cluster.setXYZ(idx, idx + 10, idx + 20);
34 idx++;
35 }
36
37 size_t memsize = sizeof(ElementType) * clusters.size();
38 auto buffer = std::make_unique<char[]>(memsize);
39 memcpy(buffer.get(), (char*)clusters.data(), memsize);
40 auto* pclone = reinterpret_cast<ElementType*>(buffer.get());
41
42 for (auto const& cluster : clusters) {
43 BOOST_REQUIRE(cluster.getXYZ() == pclone->getXYZ());
44 ++pclone;
45 }
46}
47
48} // namespace o2::itsmft
Definition of the ITSMFT cluster.
Cluster class for the ITSMFT.
Definition Cluster.h:34
GLuint buffer
Definition glcorearb.h:655
BOOST_AUTO_TEST_CASE(Cluster_messageable)
std::vector< Cluster > clusters