Belle II Software  release-05-01-25
ioutils.cc
1 #include <framework/io/RootIOUtilities.h>
2 #include <framework/utilities/TestHelpers.h>
3 
4 #include <gtest/gtest.h>
5 
6 using namespace std;
7 using namespace Belle2;
8 
9 namespace {
10  TEST(IOTest, filterBranches)
11  {
12  const set<string> input = {"A", "B", "C", "AToB", "BToC", "CToA"};
13  //unfiltered
14  EXPECT_EQ(input, RootIOUtilities::filterBranches(input, {}, {}, 0));
15 
16  EXPECT_EQ(set<string>({"A", "C", "CToA"}), RootIOUtilities::filterBranches(input, {"A", "C"}, {}, 0));
17  EXPECT_EQ(set<string>({"B"}), RootIOUtilities::filterBranches(input, {"B"}, {}, 0));
18 
19  //excludeBranches takes precedence over everything
20  EXPECT_EQ(set<string>({"A", "C"}), RootIOUtilities::filterBranches(input, {"A", "C"}, {"CToA"}, 0));
21  //and also prevents dangling relations
22  EXPECT_EQ(set<string>({"A", "C"}), RootIOUtilities::filterBranches(input, {}, {"B", "CToA"}, 0));
23  EXPECT_EQ(set<string>({"A", "C", "CToA"}), RootIOUtilities::filterBranches(input, {}, {"B"}, 0));
24  //unless one really wants them!
25  EXPECT_EQ(set<string>({"AToB"}), RootIOUtilities::filterBranches(input, {"AToB", "B"}, {"B"}, 0));
26  EXPECT_EQ(set<string>(), RootIOUtilities::filterBranches(input, {"B"}, {"B"}, 0));
27  }
28 
29  TEST(IOTest, filterBranchesWarnings)
30  {
31  const set<string> input = {"A", "B", "C"};
32  EXPECT_B2WARNING(RootIOUtilities::filterBranches(input, {"A", "A"}, {}, 0));
33  EXPECT_B2WARNING(RootIOUtilities::filterBranches(input, {}, {"A", "B", "A"}, 1));
34  }
35 
36 } // namespace
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TEST
TEST(TestgetDetectorRegion, TestgetDetectorRegion)
Test Constructors.
Definition: utilityFunctions.cc:18