Tesseract
Motion Planning Environment
Loading...
Searching...
No Matches
Functions | Variables
plugin_loader_unit.cpp File Reference
#include <tesseract_common/macros.h>
#include <gtest/gtest.h>
#include <tesseract_common/class_loader.h>
#include <tesseract_common/plugin_loader.h>
#include "test_plugin_base.h"
Include dependency graph for plugin_loader_unit.cpp:

Functions

 putenv (env_var.data())
 
std::vector< std::string > v (s.begin(), s.end())
 
 EXPECT_EQ (v[0], "a")
 
 EXPECT_EQ (v[1], "b")
 
 EXPECT_EQ (v[2], "c")
 
 EXPECT_EQ (sections.size(), 1)
 
 EXPECT_EQ (sections.at(0), "TestBase")
 
 EXPECT_TRUE (sections.size() > 1)
 
 EXPECT_EQ (symbols.size(), 1)
 
 EXPECT_EQ (symbols.at(0), symbol_name)
 
 EXPECT_TRUE (plugin !=nullptr)
 
 EXPECT_NEAR (plugin->multiply(5, 5), 25, 1e-8)
 
 EXPECT_FALSE (ClassLoader::isClassAvailable(symbol_name, "does_not_exist", lib_dir))
 
 EXPECT_FALSE (ClassLoader::isClassAvailable("does_not_exist", lib_name, lib_dir))
 
 EXPECT_FALSE (ClassLoader::isClassAvailable("does_not_exist", lib_name))
 
 EXPECT_ANY_THROW (ClassLoader::createSharedInstance< TestPluginBase >(symbol_name, "does_not_exist", lib_dir))
 
 EXPECT_ANY_THROW (ClassLoader::createSharedInstance< TestPluginBase >("does_not_exist", lib_name, lib_dir))
 
 EXPECT_ANY_THROW (ClassLoader::createSharedInstance< TestPluginBase >("does_not_exist", lib_name))
 
plugin_loader search_paths insert (std::string(TEST_PLUGIN_DIR))
 
plugin_loader search_libraries insert ("tesseract_common_test_plugin_multiply")
 
 EXPECT_TRUE (plugin_loader.isPluginAvailable("plugin"))
 
 EXPECT_EQ (symbols.at(0), "plugin")
 
plugin_loader search_paths insert ("does_not_exist")
 
 EXPECT_TRUE (plugin==nullptr)
 
 EXPECT_FALSE (plugin_loader.isPluginAvailable("plugin"))
 
int main (int argc, char **argv)
 

Variables

std::set< std::string > s = tesseract_common::parseEnvironmentVariableList("UNITTESTENV")
 
const std::string lib_name = "tesseract_common_test_plugin_multiply"
 
const std::string lib_dir = std::string(TEST_PLUGIN_DIR)
 
const std::string symbol_name = "plugin"
 
 sections = ClassLoader::getAvailableSections(lib_name, lib_dir, true)
 
auto plugin = ClassLoader::createSharedInstance<TestPluginBase>(symbol_name, lib_name, lib_dir)
 
std::vector< std::string > symbols = plugin_loader.getAvailablePlugins<TestPluginBase>()
 
plugin_loader search_system_folders = false
 

Function Documentation

◆ EXPECT_ANY_THROW() [1/3]

EXPECT_ANY_THROW ( ClassLoader::createSharedInstance< TestPluginBase "does_not_exist", lib_name)

◆ EXPECT_ANY_THROW() [2/3]

EXPECT_ANY_THROW ( ClassLoader::createSharedInstance< TestPluginBase "does_not_exist", lib_name, lib_dir)

◆ EXPECT_ANY_THROW() [3/3]

EXPECT_ANY_THROW ( ClassLoader::createSharedInstance< TestPluginBase symbol_name, "does_not_exist", lib_dir)

◆ EXPECT_EQ() [1/8]

EXPECT_EQ ( sections.  at0,
"TestBase"   
)

◆ EXPECT_EQ() [2/8]

EXPECT_EQ ( sections.  size(),
 
)

◆ EXPECT_EQ() [3/8]

EXPECT_EQ ( symbols.  at0,
"plugin"   
)

◆ EXPECT_EQ() [4/8]

EXPECT_EQ ( symbols.  at0,
symbol_name   
)

◆ EXPECT_EQ() [5/8]

EXPECT_EQ ( symbols.  size(),
 
)

◆ EXPECT_EQ() [6/8]

EXPECT_EQ ( v  [0],
"a"   
)

◆ EXPECT_EQ() [7/8]

EXPECT_EQ ( v  [1],
"b"   
)

◆ EXPECT_EQ() [8/8]

EXPECT_EQ ( v  [2],
"c"   
)

◆ EXPECT_FALSE() [1/4]

EXPECT_FALSE ( ClassLoader::isClassAvailable("does_not_exist", lib_name )

◆ EXPECT_FALSE() [2/4]

EXPECT_FALSE ( ClassLoader::isClassAvailable("does_not_exist", lib_name, lib_dir )

◆ EXPECT_FALSE() [3/4]

EXPECT_FALSE ( ClassLoader::isClassAvailable(symbol_name, "does_not_exist", lib_dir )

◆ EXPECT_FALSE() [4/4]

EXPECT_FALSE ( plugin_loader.  isPluginAvailable"plugin")

◆ EXPECT_NEAR()

EXPECT_NEAR ( plugin->  multiply5, 5,
25  ,
1e-  8 
)

◆ EXPECT_TRUE() [1/4]

EXPECT_TRUE ( plugin = nullptr)

◆ EXPECT_TRUE() [2/4]

EXPECT_TRUE ( plugin  = =nullptr)

◆ EXPECT_TRUE() [3/4]

EXPECT_TRUE ( plugin_loader.  isPluginAvailable"plugin")

◆ EXPECT_TRUE() [4/4]

EXPECT_TRUE ( sections.  size(),
 
)

◆ insert() [1/3]

plugin_loader search_libraries insert ( "does_not_exist"  )

◆ insert() [2/3]

plugin_loader search_libraries insert ( "tesseract_common_test_plugin_multiply"  )

◆ insert() [3/3]

plugin_loader search_paths insert ( std::string(TEST_PLUGIN_DIR)  )

◆ main()

int main ( int  argc,
char **  argv 
)

◆ putenv()

putenv ( env_var.  data())

◆ v()

std::vector< std::string > v ( s.  begin(),
s.  end() 
)

Variable Documentation

◆ lib_dir

const std::string lib_dir = std::string(TEST_PLUGIN_DIR)

◆ lib_name

const std::string lib_name = "tesseract_common_test_plugin_multiply"

◆ plugin

plugin = ClassLoader::createSharedInstance<TestPluginBase>(symbol_name, lib_name, lib_dir)

◆ s

std::set<std::string> s = tesseract_common::parseEnvironmentVariableList("UNITTESTENV")

◆ search_system_folders

plugin_loader search_system_folders = false

◆ sections

std::vector< std::string > sections = ClassLoader::getAvailableSections(lib_name, lib_dir, true)

◆ symbol_name

const std::string symbol_name = "plugin"

◆ symbols

symbols = plugin_loader.getAvailablePlugins<TestPluginBase>()