Classes | Macros | Functions
LibraryManager_t.cc File Reference
#include "cetlib/LibraryManager.h"
#include "boost/test/unit_test.hpp"
#include "cetlib/test/LibraryManagerTestFunc.h"
#include "cetlib_except/exception.h"
#include <iterator>
#include <string>
#include <vector>

Go to the source code of this file.

Classes

struct  LibraryManagerTestFixture
 

Macros

#define BOOST_TEST_MODULE   (LibraryManager Test)
 

Functions

 BOOST_AUTO_TEST_CASE (libSpecsVector)
 
 BOOST_AUTO_TEST_CASE (libSpecsIter)
 
 BOOST_AUTO_TEST_CASE (libListVector)
 
 BOOST_AUTO_TEST_CASE (libListIter)
 
 BOOST_AUTO_TEST_CASE (getSymbolLong)
 
 BOOST_AUTO_TEST_CASE (getSymbolShort)
 
 BOOST_AUTO_TEST_CASE (getSymbolPathPrecedence)
 
 BOOST_AUTO_TEST_CASE (getSymbolAmbiguity)
 
 BOOST_AUTO_TEST_CASE (getSymbolNoAmbiguity1)
 
 BOOST_AUTO_TEST_CASE (getSymbolNoAmbiguity2)
 
 BOOST_AUTO_TEST_CASE (dictLoadable)
 
 BOOST_AUTO_TEST_CASE (dictLoadableButNotLoaded)
 
 BOOST_AUTO_TEST_CASE (loadAllLibraries)
 
 BOOST_AUTO_TEST_CASE (dictLoaded)
 
 BOOST_AUTO_TEST_CASE (dictNotLoadable)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (LibraryManager Test)

Definition at line 3 of file LibraryManager_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( libSpecsVector  )

Definition at line 48 of file LibraryManager_t.cc.

49 {
50  std::vector<std::string> lib_list;
51  BOOST_TEST_REQUIRE(lm_ref.getValidLibspecs(lib_list) > 0);
52 }
BOOST_TEST_REQUIRE(static_cast< bool >(inFile))
BOOST_AUTO_TEST_CASE ( libSpecsIter  )

Definition at line 54 of file LibraryManager_t.cc.

55 {
56  std::vector<std::string> lib_list;
57  BOOST_TEST_REQUIRE(lm_ref.getValidLibspecs(std::back_inserter(lib_list)) > 0);
58 }
BOOST_TEST_REQUIRE(static_cast< bool >(inFile))
BOOST_AUTO_TEST_CASE ( libListVector  )

Definition at line 60 of file LibraryManager_t.cc.

61 {
62  std::vector<std::string> lib_list;
63  BOOST_TEST_REQUIRE(lm_ref.getLoadableLibraries(lib_list) > 0);
64 }
BOOST_TEST_REQUIRE(static_cast< bool >(inFile))
BOOST_AUTO_TEST_CASE ( libListIter  )

Definition at line 66 of file LibraryManager_t.cc.

67 {
68  std::vector<std::string> lib_list;
69  BOOST_TEST_REQUIRE(lm_ref.getLoadableLibraries(std::back_inserter(lib_list)) >
70  0);
71 }
BOOST_TEST_REQUIRE(static_cast< bool >(inFile))
BOOST_AUTO_TEST_CASE ( getSymbolLong  )

Definition at line 73 of file LibraryManager_t.cc.

74 {
75  BOOST_TEST_REQUIRE(lm_ref.getSymbolByLibspec<void*>("2/1/5", "idString") !=
76  nullptr);
77 }
BOOST_TEST_REQUIRE(static_cast< bool >(inFile))
BOOST_AUTO_TEST_CASE ( getSymbolShort  )

Definition at line 79 of file LibraryManager_t.cc.

80 {
81  BOOST_TEST_REQUIRE(lm_ref.getSymbolByLibspec<void*>("5", "idString") !=
82  nullptr);
83 }
BOOST_TEST_REQUIRE(static_cast< bool >(inFile))
BOOST_AUTO_TEST_CASE ( getSymbolPathPrecedence  )

Definition at line 85 of file LibraryManager_t.cc.

86 {
87  BOOST_CHECK_NO_THROW(lm_ref.getSymbolByLibspec<void*>("1/1/1", "idString"));
88 }
BOOST_AUTO_TEST_CASE ( getSymbolAmbiguity  )

Definition at line 90 of file LibraryManager_t.cc.

91 {
92  BOOST_CHECK_EXCEPTION(
93  lm_ref.getSymbolByLibspec<void*>("3", "idString"),
95  [](cet::exception const& e) { return e.category() == "Configuration"; });
96 }
const double e
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
BOOST_AUTO_TEST_CASE ( getSymbolNoAmbiguity1  )

Definition at line 110 of file LibraryManager_t.cc.

111 {
112  std::string const libspecA{"1/2/3"};
113  std::string const libspecB{"1/1/3"};
114  cettest::idString_t idString{nullptr};
115  BOOST_CHECK_NO_THROW(
116  idString =
117  lm_ref.getSymbolByLibspec<cettest::idString_t>(libspecA, "idString"));
118  verify(libspecA, idString);
119  BOOST_CHECK_NO_THROW(
120  idString =
121  lm_ref.getSymbolByLibspec<cettest::idString_t>(libspecB, "idString"));
122  verify(libspecB, idString);
123  BOOST_CHECK_NO_THROW(
124  idString =
125  lm_ref.getSymbolByLibspec<cettest::idString_t>(libspecA, "idString"));
126  verify(libspecA, idString);
127 }
std::string string
Definition: nybbler.cc:12
std::string(*)( idString_t)
BOOST_AUTO_TEST_CASE ( getSymbolNoAmbiguity2  )

Definition at line 129 of file LibraryManager_t.cc.

130 {
131  std::string const libspecA{"1/1/3"};
132  std::string const libspecB{"1/2/3"};
133  cettest::idString_t idString{nullptr};
134  BOOST_CHECK_NO_THROW(
135  idString =
136  lm_ref.getSymbolByLibspec<cettest::idString_t>(libspecA, "idString"));
137  verify(libspecA, idString);
138  BOOST_CHECK_NO_THROW(
139  idString =
140  lm_ref.getSymbolByLibspec<cettest::idString_t>(libspecB, "idString"));
141  verify(libspecB, idString);
142  BOOST_CHECK_NO_THROW(
143  idString =
144  lm_ref.getSymbolByLibspec<cettest::idString_t>(libspecA, "idString"));
145  verify(libspecA, idString);
146 }
std::string string
Definition: nybbler.cc:12
std::string(*)( idString_t)
BOOST_AUTO_TEST_CASE ( dictLoadable  )

Definition at line 148 of file LibraryManager_t.cc.

149 {
150  std::vector<std::string> lib_list;
151  lm_ref.getLoadableLibraries(lib_list);
152  BOOST_TEST_REQUIRE(lm_ref.libraryIsLoadable(*lib_list.begin()));
153 }
BOOST_TEST_REQUIRE(static_cast< bool >(inFile))
BOOST_AUTO_TEST_CASE ( dictLoadableButNotLoaded  )

Definition at line 155 of file LibraryManager_t.cc.

156 {
157  std::vector<std::string> lib_list;
158  lm_ref.getLoadableLibraries(lib_list);
159  BOOST_TEST_REQUIRE(lm_ref.libraryIsLoadable(*lib_list.begin()));
160  BOOST_TEST_REQUIRE(!lm_ref.libraryIsLoaded(*lib_list.begin()));
161 }
BOOST_TEST_REQUIRE(static_cast< bool >(inFile))
BOOST_AUTO_TEST_CASE ( loadAllLibraries  )

Definition at line 163 of file LibraryManager_t.cc.

164 {
165  BOOST_REQUIRE_NO_THROW(lm_ref.loadAllLibraries());
166 }
BOOST_AUTO_TEST_CASE ( dictLoaded  )

Definition at line 168 of file LibraryManager_t.cc.

169 {
170  std::vector<std::string> lib_list;
171  lm_ref.getLoadableLibraries(lib_list);
172  lm_ref.loadAllLibraries();
173  BOOST_TEST_REQUIRE(lm_ref.libraryIsLoaded(*lib_list.begin()));
174 }
BOOST_TEST_REQUIRE(static_cast< bool >(inFile))
BOOST_AUTO_TEST_CASE ( dictNotLoadable  )

Definition at line 176 of file LibraryManager_t.cc.

177 {
178  std::vector<std::string> lib_list;
179  lm_ref.getLoadableLibraries(lib_list);
180  BOOST_TEST_REQUIRE(!lm_ref.libraryIsLoadable("UnknownLibrary"));
181 }
BOOST_TEST_REQUIRE(static_cast< bool >(inFile))