artdaq_core  v3_09_00
SimpleLookupPolicy_t.cc
1 #include "artdaq-core/Utilities/SimpleLookupPolicy.hh"
2 
3 #define BOOST_TEST_MODULE SimpleLookupPolicy_t
4 #include "cetlib/quiet_unit_test.hpp"
5 
6 #include "cetlib/filepath_maker.h"
7 #include "cetlib_except/exception.h"
8 
9 #include <boost/filesystem.hpp>
10 
11 #define TRACE_NAME "SimpleLookupPolicy_t"
12 #include "TRACE/tracemf.h"
13 
14 BOOST_AUTO_TEST_SUITE(SimpleLookupPolicy_test)
15 
16 BOOST_AUTO_TEST_CASE(Constructors)
17 {
21  std::unique_ptr<cet::filepath_maker> pp(new artdaq::SimpleLookupPolicy("PATH"));
22  BOOST_REQUIRE(true); // No exceptions
23 }
24 
25 BOOST_AUTO_TEST_CASE(AbsoluteFilePath)
26 {
28  auto absolutePath = boost::filesystem::current_path();
29  absolutePath += "LookupTarget.fcl";
30  p(absolutePath.string());
31  BOOST_REQUIRE(true); // No exceptions
32 }
33 
34 BOOST_AUTO_TEST_CASE(FallbackPath)
35 {
37  p("LookupTarget.fcl");
38  BOOST_REQUIRE_EXCEPTION(p("ThisFileDoesNotExist.fcl"), cet::exception, [](cet::exception const& e) { return e.category() == "search_path"; });
39 }
40 
41 BOOST_AUTO_TEST_SUITE_END()
Constructor argument is a list of directories.
This class is intended to find files using a set lookup order.