Project
Loading...
Searching...
No Matches
Edge.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
14
15#define BOOST_TEST_MODULE Test MCHContour Edge
16#define BOOST_TEST_MAIN
17#define BOOST_TEST_DYN_LINK
18
19#include <boost/test/unit_test.hpp>
20#include <iostream>
21#include "../include/MCHContour/Edge.h"
22
23using namespace o2::mch::contour::impl;
24using namespace o2::mch::contour;
25
26BOOST_AUTO_TEST_SUITE(o2_mch_contour)
27
28BOOST_AUTO_TEST_SUITE(edge)
29
30BOOST_AUTO_TEST_CASE(AVerticalLeftEdgeIsTopToBottom)
31{
32 double dummy{0};
33 VerticalEdge<double> edge{dummy, 12, 1};
36}
37
38BOOST_AUTO_TEST_CASE(AVerticalRightEdgeIsBottomToTop)
39{
40 double dummy{0};
41 VerticalEdge<double> edge{dummy, 1, 12};
44}
45
46BOOST_AUTO_TEST_CASE(ALeftToRightHorizontalEdgeHasEndPointGreaterThanStartPoint)
47{
48 double dummy{0};
49 HorizontalEdge<double> edge{dummy, 1, 12};
51}
52
53BOOST_AUTO_TEST_CASE(ARightToLeftHorizontalEdgeHasEndPointSmallerThanStartPoint)
54{
55 double dummy{0};
56 HorizontalEdge<double> edge{dummy, 12, 1};
58}
59
60BOOST_AUTO_TEST_CASE(AVerticalEdgeWithBeginAboveEndIsALefty)
61{
62 VerticalEdge<double> vi{0, 12, 10};
65}
66
67BOOST_AUTO_TEST_CASE(AVerticalEdgeWithBeginAboveEndIsARighty)
68{
69 VerticalEdge<double> vi{0, 10, 12};
71 BOOST_CHECK_EQUAL(isLeftEdge(vi), false);
72}
73
74BOOST_AUTO_TEST_CASE(AVerticalEdgeHasATopAndBottom)
75{
76 VerticalEdge<double> edge{2, 10, 12};
77 BOOST_CHECK_EQUAL(bottom(edge), 10);
78 BOOST_CHECK_EQUAL(top(edge), 12);
79}
80
81BOOST_AUTO_TEST_CASE(BeginAndEndForALeftEdgeVertical)
82{
83 VerticalEdge<double> e{0, 7, 1};
84
85 BOOST_CHECK_EQUAL(e.begin(), (Vertex<double>{0, 7}));
86 BOOST_CHECK_EQUAL(e.end(), (Vertex<double>{0, 1}));
89}
90
91BOOST_AUTO_TEST_CASE(BeginAndEndForARightEdgeVertical)
92{
93 VerticalEdge<double> e{0, 1, 7};
94
95 BOOST_CHECK_EQUAL(e.begin(), (Vertex<double>{0, 1}));
96 BOOST_CHECK_EQUAL(e.end(), (Vertex<double>{0, 7}));
99}
100
101BOOST_AUTO_TEST_CASE(BeginAndEndForALeftToRightHorizontal)
102{
103 HorizontalEdge<double> e{0, 1, 7};
104 BOOST_CHECK_EQUAL(e.begin(), (Vertex<double>{1, 0}));
105 BOOST_CHECK_EQUAL(e.end(), (Vertex<double>{7, 0}));
106}
107
108BOOST_AUTO_TEST_CASE(BeginAndEndForARightToLeftHorizontal)
109{
110 HorizontalEdge<double> e{0, 7, 1};
111 BOOST_CHECK_EQUAL(e.begin(), (Vertex<double>{7, 0}));
112 BOOST_CHECK_EQUAL(e.end(), (Vertex<double>{1, 0}));
113}
114
115BOOST_AUTO_TEST_CASE(VectorOfVerticals)
116{
117 // clang-format off
118 std::vector<VerticalEdge<double>> testVerticals{{0.0, 7.0, 1.0}, {1.0, 1.0, 0.0}, {3.0, 0.0, 1.0},
119 {5.0, 1.0, 0.0}, {6.0, 0.0, 7.0}, {2.0, 5.0, 3.0},
120 {4.0, 3.0, 5.0}};
121 // clang-format on
122 BOOST_TEST(testVerticals.size() == 7);
123}
124
125BOOST_AUTO_TEST_SUITE_END()
126BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(AVerticalLeftEdgeIsTopToBottom)
Definition Edge.cxx:30
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char e
GLdouble GLdouble GLdouble GLdouble top
Definition glcorearb.h:4077
GLint GLint bottom
Definition glcorearb.h:1979
bool isLeftEdge(const VerticalEdge< T > &edge)
Definition Edge.h:102
bool isTopToBottom(const VerticalEdge< T > &edge)
Definition Edge.h:114
bool isBottomToTop(const VerticalEdge< T > &edge)
Definition Edge.h:120
bool isLeftToRight(const HorizontalEdge< T > &edge)
Definition Edge.h:138
bool isRightEdge(const VerticalEdge< T > &edge)
Definition Edge.h:108
bool isRightToLeft(const HorizontalEdge< T > &edge)
Definition Edge.h:144
BOOST_CHECK(tree)
BOOST_TEST(digits==digitsD, boost::test_tools::per_element())
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())