ATLAS Offline Software
ProductGenTest.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 
12 using res = std::pair<std::vector<unsigned int>, bool>;
13 using vec = std::vector<unsigned int>;
14 
15 TEST(ProductGenTester, noargs) {
17  EXPECT_TRUE(gen.next().empty());
18 }
19 
20 TEST(ProductGenTester, empty) {
21  std::vector<std::size_t> ends;
22  ProductGen gen(ends);
23  EXPECT_TRUE(gen.next().empty());
24 }
25 
26 TEST(ProductGenTester, zeroend) {
27  ProductGen gen(std::vector<std::size_t>({0,2}));
28 
29  // no values due to and end value of 0.
30  EXPECT_TRUE(gen.next().empty());
31 }
32 
33 
34 TEST(ProductGenTester, ends12) {
35  ProductGen gen(std::vector<std::size_t>({2, 3}));
36 
37  std::vector<std::size_t> exp{0, 0};
38  EXPECT_EQ(gen.next(), exp);
39 
40  exp = std::vector<std::size_t>{1, 0};
41  EXPECT_EQ(gen.next(), exp);
42 
43  exp = std::vector<std::size_t>{0, 1};
44  EXPECT_EQ(gen.next(), exp);
45 
46  exp = std::vector<std::size_t>{1, 1};
47  EXPECT_EQ(gen.next(), exp);
48 
49  exp = std::vector<std::size_t>{0, 2};
50  EXPECT_EQ(gen.next(), exp);
51 
52  exp = std::vector<std::size_t>{1, 2};
53  EXPECT_EQ(gen.next(), exp);
54 
55  EXPECT_TRUE(gen.next().empty());
56 }
57 
ProductGen.h
TEST
TEST(ProductGenTester, noargs)
Definition: ProductGenTest.cxx:15
vec
std::vector< size_t > vec
Definition: CombinationsGeneratorTest.cxx:12
drawFromPickle.exp
exp
Definition: drawFromPickle.py:36
master.gen
gen
Definition: master.py:32
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
ProductGen
Definition: ProductGen.h:13
ATLAS_NO_CHECK_FILE_THREAD_SAFETY
ATLAS_NO_CHECK_FILE_THREAD_SAFETY
Definition: ProductGenTest.cxx:6
checker_macros.h
Define macros for attributes used to control the static checker.