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