30 #include <gtest/gtest.h> 36 TEST(PluginlibTest, unknownPlugin) {
41 TEST(PluginlibTest, misspelledPlugin) {
46 TEST(PluginlibTest, invalidPackage) {
52 TEST(PluginlibTest, brokenPlugin) {
57 TEST(PluginlibTest, workingPlugin) {
62 foo->initialize(10.0);
63 EXPECT_EQ(100.0, foo->result());
65 FAIL() <<
"Throwing exception: " << ex.what();
68 FAIL() <<
"Uncaught exception";
72 TEST(PluginlibTest, createUnmanagedInstanceAndUnloadLibrary) {
73 ROS_INFO(
"Making the ClassLoader...");
82 ROS_INFO(
"Checking if plugin is loaded with isClassLoaded...");
86 FAIL() <<
"Library containing class should be loaded but isn't.";
88 ROS_INFO(
"Trying to unload class with unloadLibraryForClass...");
92 FAIL() <<
"Could not unload library when I should be able to.";
97 TEST(PluginlibTest, createManagedInstanceAndUnloadLibrary) {
98 ROS_INFO(
"Making the ClassLoader...");
101 ROS_INFO(
"Instantiating plugin...");
106 ROS_INFO(
"Checking if plugin is loaded with isClassLoaded...");
110 FAIL() <<
"Library containing class should be loaded but isn't.";
113 ROS_INFO(
"Trying to unload class with unloadLibraryForClass...");
117 FAIL() <<
"Could not unload library when I should be able to.";
122 TEST(PluginlibTest, brokenXML) {
126 test_loader.createInstance(
"pluginlib/foo");
132 ADD_FAILURE() <<
"Didn't throw exception as expected";
136 int main(
int argc,
char ** argv)
138 testing::InitGoogleTest(&argc, argv);
139 return RUN_ALL_TESTS();
Thrown when pluginlib is unable to instantiate a class loader.
virtual int unloadLibraryForClass(const std::string &lookup_name)
Decrement the counter for the library containing a class with a given name.
TEST(PluginlibTest, unknownPlugin)
T * createUnmanagedInstance(const std::string &lookup_name)
Create an instance of a desired class.
A base class for all pluginlib exceptions that inherits from std::runtime_exception.
bool isClassLoaded(const std::string &lookup_name)
Check if the library for a given class is currently loaded.
int main(int argc, char **argv)
A class to help manage and load classes.
Thrown when pluginlib is unable to load the library associated with a given plugin.