Project
Loading...
Searching...
No Matches
testTrackable.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 trackable test
13#define BOOST_TEST_MAIN
14#define BOOST_TEST_DYN_LINK
15#include <boost/test/unit_test.hpp>
16#include "MCHBase/Trackable.h"
17
18BOOST_AUTO_TEST_CASE(MissingRequiredStationMeansNotTrackable)
19{
20 std::array<int, 10> items = {0, 0, 3, 4, 5, 6, 7, 8, 9, 10};
21 std::array<bool, 5> requestStations = {true, true, true, true, true};
22 auto moreCandidates = false;
23
24 BOOST_CHECK_EQUAL(o2::mch::isTrackable(items, requestStations, moreCandidates),
25 false);
26}
27
28BOOST_AUTO_TEST_CASE(MissingNotRequiredStationIsOK)
29{
30 std::array<int, 10> items = {0, 0, 1, 1, 1, 1, 1, 1, 1, 1};
31 std::array<bool, 5> requestStations = {false, true, true, true, true};
32 auto moreCandidates = false;
33
34 BOOST_CHECK_EQUAL(o2::mch::isTrackable(items, requestStations, moreCandidates),
35 true);
36}
37
38BOOST_AUTO_TEST_CASE(WithoutMoreCandidatesOptionOnly2ItemsInSt45IsNotOK)
39{
40 std::array<int, 10> items = {1, 1, 1, 1, 1, 1, 0, 1, 0, 1};
41 std::array<bool, 5> requestStations = {true, true, true, true, true};
42 auto moreCandidates = false;
43
44 BOOST_CHECK_EQUAL(o2::mch::isTrackable(items, requestStations, moreCandidates),
45 false);
46}
47
48BOOST_AUTO_TEST_CASE(WithMoreCandidatesOptionOnly2ItemsInSt45IsOK)
49{
50 std::array<int, 10> items = {1, 1, 1, 1, 1, 1, 0, 1, 0, 1};
51 std::array<bool, 5> requestStations = {true, true, true, true, true};
52 auto moreCandidates = true;
53
54 BOOST_CHECK_EQUAL(o2::mch::isTrackable(items, requestStations, moreCandidates),
55 true);
56}
bool isTrackable(std::array< int, 10 > itemsPerChamber, std::array< bool, 5 > requestStation={true, true, true, true, true}, bool moreCandidates=false)
Definition Trackable.cxx:18
BOOST_AUTO_TEST_CASE(MissingRequiredStationMeansNotTrackable)
BOOST_CHECK_EQUAL(triggersD.size(), triggers.size())