8 #include "gtest/gtest.h"
13 using res = std::pair<std::vector<unsigned int>,
bool>;
14 using vec = std::vector<unsigned int>;
16 TEST(JetGroupReducerTester, empty) {
17 std::vector<std::size_t> siblings;
21 auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(
nullptr);
25 EXPECT_TRUE(jgr.
valid());
26 EXPECT_TRUE(jgr.
next(collector).empty());
29 TEST(JetGroupReducerTester, emptyCondition) {
30 std::vector<std::size_t> siblings{1, 2, 3};
32 satisfiedBy[0] = std::vector<std::size_t> {0, 1, 2};
33 satisfiedBy[1] = std::vector<std::size_t> {};
34 satisfiedBy[2] = std::vector<std::size_t> {3, 4, 5};
39 auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(
nullptr);
43 EXPECT_TRUE(jgr.
valid());
44 EXPECT_TRUE(jgr.
next(collector).empty());
48 TEST(JetGroupReducerTester, one_condition_elem) {
51 std::vector<std::size_t> siblings{1};
54 satisfiedBy[1] = std::vector<std::size_t> {0};
56 jg2elem[0] = std::vector<std::size_t> {0};
57 jg2elem[1] = std::vector<std::size_t> {1};
58 jg2elem[2] = std::vector<std::size_t> {0, 1};
61 auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(
nullptr);
65 auto exp = std::vector<std::size_t>{0};
66 EXPECT_EQ(jgr.
next(collector),
exp);
67 EXPECT_TRUE(jgr.
next(collector).empty());
71 TEST(JetGroupReducerTester, one_condition_non_elem) {
74 std::vector<std::size_t> siblings{1};
77 satisfiedBy[1] = std::vector<std::size_t> {2};
79 jg2elem[0] = std::vector<std::size_t> {0};
80 jg2elem[1] = std::vector<std::size_t> {1};
81 jg2elem[2] = std::vector<std::size_t> {0, 1};
84 auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(
nullptr);
88 auto exp = std::vector<std::size_t>{0, 1};
89 EXPECT_EQ(jgr.
next(collector),
exp);
90 EXPECT_TRUE(jgr.
next(collector).empty());
93 TEST(JetGroupReducerTester, two_conditions_nooverlap_elem_elem) {
94 std::vector<std::size_t> siblings{1, 2};
97 satisfiedBy[1] = std::vector<std::size_t> {0, 1};
98 satisfiedBy[2] = std::vector<std::size_t> {2};
99 auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(
nullptr);
103 jg2elem[0] = std::vector<std::size_t> {0};
104 jg2elem[1] = std::vector<std::size_t> {1};
105 jg2elem[2] = std::vector<std::size_t> {2};
106 jg2elem[3] = std::vector<std::size_t> {3};
107 jg2elem[4] = std::vector<std::size_t> {4};
108 jg2elem[5] = std::vector<std::size_t> {5};
109 jg2elem[6] = std::vector<std::size_t> {0, 1};
110 jg2elem[7] = std::vector<std::size_t> {2, 3};
111 jg2elem[8] = std::vector<std::size_t> {4, 5};
116 auto exp = std::vector<std::size_t>{0, 1, 2};
117 EXPECT_EQ(jgr.
next(collector),
exp);
118 EXPECT_TRUE(jgr.
next(collector).empty());
121 TEST(JetGroupReducerTester, two_conditions_nooverlap_elem_non_elem) {
122 std::vector<std::size_t> siblings{1, 2};
125 satisfiedBy[1] = std::vector<std::size_t> {0, 1};
126 satisfiedBy[2] = std::vector<std::size_t> {7};
127 auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(
nullptr);
131 jg2elem[0] = std::vector<std::size_t> {0};
132 jg2elem[1] = std::vector<std::size_t> {1};
133 jg2elem[2] = std::vector<std::size_t> {2};
134 jg2elem[3] = std::vector<std::size_t> {3};
135 jg2elem[4] = std::vector<std::size_t> {4};
136 jg2elem[5] = std::vector<std::size_t> {5};
137 jg2elem[6] = std::vector<std::size_t> {0, 1};
138 jg2elem[7] = std::vector<std::size_t> {2, 3};
139 jg2elem[8] = std::vector<std::size_t> {4, 5};
144 auto exp = std::vector<std::size_t>{0, 1, 2, 3};
145 EXPECT_EQ(jgr.
next(collector),
exp);
146 EXPECT_TRUE(jgr.
next(collector).empty());
149 TEST(JetGroupReducerTester, two_conditions_overlap_elem_non_elem) {
150 std::vector<std::size_t> siblings{1, 2};
153 satisfiedBy[1] = std::vector<std::size_t> {0, 1};
154 satisfiedBy[2] = std::vector<std::size_t> {6};
155 auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(
nullptr);
159 jg2elem[0] = std::vector<std::size_t> {0};
160 jg2elem[1] = std::vector<std::size_t> {1};
161 jg2elem[2] = std::vector<std::size_t> {2};
162 jg2elem[3] = std::vector<std::size_t> {3};
163 jg2elem[4] = std::vector<std::size_t> {4};
164 jg2elem[5] = std::vector<std::size_t> {5};
165 jg2elem[6] = std::vector<std::size_t> {0, 1};
166 jg2elem[7] = std::vector<std::size_t> {2, 3};
167 jg2elem[8] = std::vector<std::size_t> {4, 5};
172 auto exp = std::vector<std::size_t>{0, 1};
173 EXPECT_EQ(jgr.
next(collector),
exp);
174 EXPECT_TRUE(jgr.
next(collector).empty());
177 TEST(JetGroupReducerTester, two_conditions_no_overlap_non_elem_non_elem) {
178 std::vector<std::size_t> siblings{1, 2};
181 satisfiedBy[1] = std::vector<std::size_t> {6, 7};
182 satisfiedBy[2] = std::vector<std::size_t> {8};
183 auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(
nullptr);
187 jg2elem[0] = std::vector<std::size_t> {0};
188 jg2elem[1] = std::vector<std::size_t> {1};
189 jg2elem[2] = std::vector<std::size_t> {2};
190 jg2elem[3] = std::vector<std::size_t> {3};
191 jg2elem[4] = std::vector<std::size_t> {4};
192 jg2elem[5] = std::vector<std::size_t> {5};
193 jg2elem[6] = std::vector<std::size_t> {0, 1};
194 jg2elem[7] = std::vector<std::size_t> {2, 3};
195 jg2elem[8] = std::vector<std::size_t> {4, 5};
200 auto exp = std::vector<std::size_t>{0, 1, 2, 3, 4, 5};
201 EXPECT_EQ(jgr.
next(collector),
exp);
202 EXPECT_TRUE(jgr.
next(collector).empty());
205 TEST(JetGroupReducerTester, two_conditions_overlap_non_elem_non_elem) {
206 std::vector<std::size_t> siblings{1, 2};
209 satisfiedBy[1] = std::vector<std::size_t> {6, 7};
210 satisfiedBy[2] = std::vector<std::size_t> {9};
211 auto collector = std::unique_ptr<ITrigJetHypoInfoCollector>(
nullptr);
215 jg2elem[0] = std::vector<std::size_t> {0};
216 jg2elem[1] = std::vector<std::size_t> {1};
217 jg2elem[2] = std::vector<std::size_t> {2};
218 jg2elem[3] = std::vector<std::size_t> {3};
219 jg2elem[4] = std::vector<std::size_t> {4};
220 jg2elem[5] = std::vector<std::size_t> {5};
221 jg2elem[6] = std::vector<std::size_t> {0, 1};
222 jg2elem[7] = std::vector<std::size_t> {2, 3};
223 jg2elem[8] = std::vector<std::size_t> {4, 5};
224 jg2elem[9] = std::vector<std::size_t> {1, 5};
229 auto exp = std::vector<std::size_t>{0, 1, 2, 3, 5};
230 EXPECT_EQ(jgr.
next(collector),
exp);
231 EXPECT_TRUE(jgr.
next(collector).empty());