ATLAS Offline Software
Loading...
Searching...
No Matches
Trigger
TrigHypothesis
TrigHLTJetHypoUnitTests
tests
CombinationsGeneratorTest.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "gtest/gtest.h"
6
#include "
TrigHLTJetHypo/../src/CombinationsGenerator.h
"
7
#include <vector>
8
9
using
vec
= std::vector<size_t>;
10
11
TEST
(CombinationsGeneratorTester, n3k1) {
12
CombinationsGenerator
gen(3,1);
13
// return value from bump() says whether the generator has cycled.
14
EXPECT_EQ (
vec
{0}, gen.get());
15
EXPECT_EQ (
false
, gen.bump());
16
EXPECT_EQ (
vec
{1}, gen.get());
17
EXPECT_EQ (
false
, gen.bump());
18
EXPECT_EQ (
vec
{2}, gen.get());
19
EXPECT_EQ (
true
, gen.bump());
20
}
21
22
TEST
(CombinationsGeneratorTester, n3k2) {
23
CombinationsGenerator
gen(3,2);
24
vec
v0 {0,1};
25
vec
v1 {0,2};
26
vec
v2 {1,2};
27
EXPECT_EQ (v0, gen.get());
28
EXPECT_EQ (
false
, gen.bump());
29
EXPECT_EQ (v1, gen.get());
30
EXPECT_EQ (
false
, gen.bump());
31
EXPECT_EQ (v2, gen.get());
32
EXPECT_EQ (
true
, gen.bump());
33
}
34
35
TEST
(CombinationsGeneratorTester, n3k3) {
36
CombinationsGenerator
gen(3,3);
37
vec
v0 {0,1,2};
38
EXPECT_EQ (v0, gen.get());
39
EXPECT_EQ (
true
, gen.bump());
40
}
41
42
TEST
(CombinationsGeneratorTester, n3k0) {
43
CombinationsGenerator
gen(3,0);
44
vec
v0 {};
45
EXPECT_EQ (v0, gen.get());
46
EXPECT_EQ (
true
, gen.bump());
47
}
48
49
TEST
(CombinationsGeneratorTester, n3k4) {
50
CombinationsGenerator
gen(3,4);
51
vec
v0 {};
52
EXPECT_EQ (v0, gen.get());
53
EXPECT_EQ (
true
, gen.bump());
54
}
55
56
57
TEST
TEST(CombinationsGeneratorTester, n3k1)
Definition
CombinationsGeneratorTest.cxx:11
vec
std::vector< size_t > vec
Definition
CombinationsGeneratorTest.cxx:9
CombinationsGenerator.h
CombinationsGenerator
generate all possible combinations of objects
Generated on
for ATLAS Offline Software by
1.14.0