ATLAS Offline Software
JetGroupUnionTest.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 
8 #include "gtest/gtest.h"
10 #include <vector>
11 #include <map>
12 
13 using res = std::pair<std::vector<unsigned int>, bool>;
14 using vec = std::vector<unsigned int>;
15 
16 TEST(JetGroupUnionTester, empty) {
17  std::vector<std::size_t> siblings;
18  CondInd2JetGroupsInds satisfiedBy;
19 
20  auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(nullptr);
21 
22  JetGroupUnion jgu(siblings, satisfiedBy);
23 
24  EXPECT_TRUE(jgu.next(collector).empty());
25 }
26 
27 
28 TEST(JetGroupUnionTester, one_elementary_cond) {
29  std::vector<std::size_t> siblings{0};
30 
31  CondInd2JetGroupsInds satisfiedBy;
32  satisfiedBy[0] = std::vector<std::size_t> {0, 1, 2};
33 
34  auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(nullptr);
35 
36  JetGroupUnion jgu(siblings, satisfiedBy);
37 
38  auto exp = std::vector<std::size_t>{0, 1, 2};
39  EXPECT_EQ(jgu.next(collector), exp);
40  EXPECT_TRUE(jgu.next(collector).empty());
41 }
42 
43 
44 TEST(JetGroupUnionTester, two_elem_nooverlap) {
45  std::vector<std::size_t> siblings{0, 1};
46 
47  CondInd2JetGroupsInds satisfiedBy;
48  satisfiedBy[0] = std::vector<std::size_t> {0, 1, 2};
49  satisfiedBy[1] = std::vector<std::size_t> {3, 4, 5};
50  auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(nullptr);
51 
52  JetGroupUnion jgu(siblings, satisfiedBy);
53 
54  auto exp = std::vector<std::size_t>{0, 1, 2, 3, 4, 5};
55  EXPECT_EQ(jgu.next(collector), exp);
56  EXPECT_TRUE(jgu.next(collector).empty());
57 }
58 
59 TEST(JetGroupUnionTester, two_elem_withoverlap) {
60  std::vector<std::size_t> siblings{0, 1};
61 
62  CondInd2JetGroupsInds satisfiedBy;
63  satisfiedBy[0] = std::vector<std::size_t> {0, 1, 2};
64  satisfiedBy[1] = std::vector<std::size_t> {3, 1, 5};
65 
66  auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(nullptr);
67 
68  JetGroupUnion jgu(siblings, satisfiedBy);
69 
70  auto exp = std::vector<std::size_t>{0, 1, 2, 3, 5};
71  EXPECT_EQ(jgu.next(collector), exp);
72  EXPECT_TRUE(jgu.next(collector).empty());
73 }
JetGroupUnion
Definition: JetGroupUnion.h:20
CondInd2JetGroupsInds
std::map< int, std::vector< std::size_t > > CondInd2JetGroupsInds
Definition: JetGroupProduct.h:15
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
ATLAS_NO_CHECK_FILE_THREAD_SAFETY
ATLAS_NO_CHECK_FILE_THREAD_SAFETY
Definition: JetGroupUnionTest.cxx:6
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
JetGroupUnion.h
JetGroupUnion::next
virtual std::vector< std::size_t > next(const Collector &) override
Definition: JetGroupUnion.cxx:36
checker_macros.h
Define macros for attributes used to control the static checker.
TEST
TEST(JetGroupUnionTester, empty)
Definition: JetGroupUnionTest.cxx:16