Belle II Software  release-05-01-25
test_Utility.cc
1 /* BASF2 (Belle Analysis Framework 2) *
2  * Copyright(C) 2016 - Belle II Collaboration *
3  * *
4  * Author: The Belle II Collaboration *
5  * Contributors: Thomas Keck *
6  * *
7  * This software is provided "as is" without any warranty. *
8  **************************************************************************/
9 
10 #include <mva/utility/Utility.h>
11 #include <framework/utilities/TestHelpers.h>
12 #include <framework/database/Configuration.h>
13 #include <framework/database/Database.h>
14 
15 using namespace Belle2;
16 
17 namespace {
18 
19  TEST(AvailableTest, Available)
20  {
22 
24  conf.overrideGlobalTags();
25  conf.prependTestingPayloadLocation("localdb/database.txt");
26 
27  MVA::Weightfile weightfile;
28  MVA::Weightfile::save(weightfile, "MVAInterfaceTest.root");
29  MVA::Weightfile::save(weightfile, "MVAInterfaceTest.xml");
30  MVA::Weightfile::save(weightfile, "MVAInterfaceTest");
31 
32  EXPECT_FALSE(MVA::available("DOES_NOT_EXIST.root"));
33  EXPECT_FALSE(MVA::available("DOES_NOT_EXIST.xml"));
34  EXPECT_FALSE(MVA::available("DOES_NOT_EXIST"));
35  EXPECT_TRUE(MVA::available("MVAInterfaceTest.root"));
36  EXPECT_TRUE(MVA::available("MVAInterfaceTest.xml"));
37  EXPECT_TRUE(MVA::available("MVAInterfaceTest"));
38 
40  }
41 
42 }
43 
Belle2::MVA::Weightfile
The Weightfile class serializes all information about a training into an xml tree.
Definition: Weightfile.h:40
Belle2::TestHelpers::TempDirCreator
changes working directory into a newly created directory, and removes it (and contents) on destructio...
Definition: TestHelpers.h:57
Belle2::Database::reset
static void reset(bool keepConfig=false)
Reset the database instance.
Definition: Database.cc:62
Belle2::Conditions::Configuration::getInstance
static Configuration & getInstance()
Get a reference to the instance which will be used when the Database is initialized.
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TEST
TEST(TestgetDetectorRegion, TestgetDetectorRegion)
Test Constructors.
Definition: utilityFunctions.cc:18
Belle2::MVA::Weightfile::save
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:163