Belle II Software  release-08-01-10
test_Utility.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #include <mva/utility/Utility.h>
10 #include <framework/utilities/TestHelpers.h>
11 #include <framework/database/Configuration.h>
12 #include <framework/database/Database.h>
13 
14 using namespace Belle2;
15 
16 namespace {
17 
18  TEST(AvailableTest, Available)
19  {
21 
23  conf.overrideGlobalTags();
24  conf.prependTestingPayloadLocation("localdb/database.txt");
25 
26  MVA::Weightfile weightfile;
27  MVA::Weightfile::save(weightfile, "MVAInterfaceTest.root");
28  MVA::Weightfile::save(weightfile, "MVAInterfaceTest.xml");
29  MVA::Weightfile::save(weightfile, "MVAInterfaceTest");
30 
31  EXPECT_FALSE(MVA::Utility::available("DOES_NOT_EXIST.root"));
32  EXPECT_FALSE(MVA::Utility::available("DOES_NOT_EXIST.xml"));
33  EXPECT_FALSE(MVA::Utility::available("DOES_NOT_EXIST"));
34  EXPECT_TRUE(MVA::Utility::available("MVAInterfaceTest.root"));
35  EXPECT_TRUE(MVA::Utility::available("MVAInterfaceTest.xml"));
36  EXPECT_TRUE(MVA::Utility::available("MVAInterfaceTest"));
37 
39  }
40 
41 }
42 
static Configuration & getInstance()
Get a reference to the instance which will be used when the Database is initialized.
static bool available(const std::string &filename, int experiment=0, int run=0, int event=0)
Convenience function which checks if an experise is available.
Definition: Utility.cc:126
The Weightfile class serializes all information about a training into an xml tree.
Definition: Weightfile.h:38
static void save(Weightfile &weightfile, const std::string &filename, const Belle2::IntervalOfValidity &iov=Belle2::IntervalOfValidity(0, 0, -1, -1))
Static function which saves a Weightfile to a file.
Definition: Weightfile.cc:154
changes working directory into a newly created directory, and removes it (and contents) on destructio...
Definition: TestHelpers.h:66
TEST(TestgetDetectorRegion, TestgetDetectorRegion)
Test Constructors.
static void reset(bool keepConfig=false)
Reset the database instance.
Definition: Database.cc:50
Abstract base class for different kinds of events.