Classes | Macros | Functions
PluginFactory_t.cc File Reference
#include "boost/test/unit_test.hpp"
#include "cetlib/BasicPluginFactory.h"
#include "cetlib/PluginTypeDeducer.h"
#include "cetlib/test/TestPluginBase.h"
#include "cetlib_except/exception.h"
#include <memory>
#include <string>

Go to the source code of this file.

Classes

struct  PluginFactoryTestFixture
 

Macros

#define BOOST_TEST_MODULE   (PluginFactory_t)
 

Functions

 BOOST_AUTO_TEST_CASE (checkType)
 
 BOOST_AUTO_TEST_CASE (checkMaker)
 
 BOOST_AUTO_TEST_CASE (CheckFinder)
 
 BOOST_AUTO_TEST_CASE (checkError)
 

Macro Definition Documentation

#define BOOST_TEST_MODULE   (PluginFactory_t)

Definition at line 1 of file PluginFactory_t.cc.

Function Documentation

BOOST_AUTO_TEST_CASE ( checkType  )

Definition at line 36 of file PluginFactory_t.cc.

37 {
38  BOOST_TEST_REQUIRE("TestPluginBase"s ==
39  PluginTypeDeducer_v<cettest::TestPluginBase>);
40  BOOST_TEST_REQUIRE(pf.pluginType("TestPlugin") ==
41  PluginTypeDeducer_v<cettest::TestPluginBase>);
42 }
BOOST_TEST_REQUIRE(static_cast< bool >(inFile))
static QCString * s
Definition: config.cpp:1042
BOOST_AUTO_TEST_CASE ( checkMaker  )

Definition at line 44 of file PluginFactory_t.cc.

45 {
46  auto p = pf.makePlugin<std::unique_ptr<cettest::TestPluginBase>, std::string>(
47  "TestPlugin", "Hi");
48  BOOST_TEST_REQUIRE(p->message() == "Hi"s);
49 }
std::string string
Definition: nybbler.cc:12
BOOST_TEST_REQUIRE(static_cast< bool >(inFile))
p
Definition: test.py:223
static QCString * s
Definition: config.cpp:1042
BOOST_AUTO_TEST_CASE ( CheckFinder  )

Definition at line 51 of file PluginFactory_t.cc.

52 {
53  auto fptr = pf.find<std::string>(
54  "TestPlugin", "pluginType", cet::PluginFactory::nothrow);
55  BOOST_TEST_REQUIRE(fptr);
56  BOOST_TEST_REQUIRE(fptr() == PluginTypeDeducer_v<cettest::TestPluginBase>);
58  pf.find<std::string>("TestPlugin", "oops", cet::PluginFactory::nothrow) ==
59  nullptr);
60 }
std::string string
Definition: nybbler.cc:12
static LibraryManager::nothrow_t nothrow
Definition: PluginFactory.h:54
BOOST_TEST_REQUIRE(static_cast< bool >(inFile))
BOOST_AUTO_TEST_CASE ( checkError  )

Definition at line 62 of file PluginFactory_t.cc.

63 {
64  BOOST_CHECK_EXCEPTION(pf.makePlugin<std::unique_ptr<cettest::TestPluginBase>>(
65  "TestPluginX"s, "Hi"s),
67  [](cet::exception const& e) {
68  return e.category() == "Configuration" &&
69  std::string{e.what()}.find("ETERNAL") !=
70  std::string::npos;
71  });
72 }
const double e
static QCString * s
Definition: config.cpp:1042
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33