Tesseract
Motion Planning Environment
|
#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"
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 |
EXPECT_ANY_THROW | ( | ClassLoader::createSharedInstance< TestPluginBase > | "does_not_exist", lib_name | ) |
EXPECT_ANY_THROW | ( | ClassLoader::createSharedInstance< TestPluginBase > | "does_not_exist", lib_name, lib_dir | ) |
EXPECT_ANY_THROW | ( | ClassLoader::createSharedInstance< TestPluginBase > | symbol_name, "does_not_exist", lib_dir | ) |
EXPECT_EQ | ( | sections. | at0, |
"TestBase" | |||
) |
EXPECT_EQ | ( | sections. | size(), |
1 | |||
) |
EXPECT_EQ | ( | symbols. | at0, |
"plugin" | |||
) |
EXPECT_EQ | ( | symbols. | at0, |
symbol_name | |||
) |
EXPECT_EQ | ( | symbols. | size(), |
1 | |||
) |
EXPECT_EQ | ( | v | [0], |
"a" | |||
) |
EXPECT_EQ | ( | v | [1], |
"b" | |||
) |
EXPECT_EQ | ( | v | [2], |
"c" | |||
) |
EXPECT_FALSE | ( | ClassLoader::isClassAvailable("does_not_exist", lib_name) | ) |
EXPECT_FALSE | ( | ClassLoader::isClassAvailable(symbol_name, "does_not_exist", lib_dir) | ) |
EXPECT_FALSE | ( | plugin_loader. | isPluginAvailable"plugin" | ) |
EXPECT_NEAR | ( | plugin-> | multiply5, 5, |
25 | , | ||
1e- | 8 | ||
) |
EXPECT_TRUE | ( | plugin ! | = nullptr | ) |
EXPECT_TRUE | ( | plugin | = =nullptr | ) |
EXPECT_TRUE | ( | plugin_loader. | isPluginAvailable"plugin" | ) |
EXPECT_TRUE | ( | sections. | size(), |
1 | |||
) |
plugin_loader search_libraries insert | ( | "does_not_exist" | ) |
plugin_loader search_libraries insert | ( | "tesseract_common_test_plugin_multiply" | ) |
plugin_loader search_paths insert | ( | std::string(TEST_PLUGIN_DIR) | ) |
int main | ( | int | argc, |
char ** | argv | ||
) |
putenv | ( | env_var. | data() | ) |
std::vector< std::string > v | ( | s. | begin(), |
s. | end() | ||
) |
const std::string lib_dir = std::string(TEST_PLUGIN_DIR) |
const std::string lib_name = "tesseract_common_test_plugin_multiply" |
plugin = ClassLoader::createSharedInstance<TestPluginBase>(symbol_name, lib_name, lib_dir) |
std::set<std::string> s = tesseract_common::parseEnvironmentVariableList("UNITTESTENV") |
plugin_loader search_system_folders = false |
const std::string symbol_name = "plugin" |
symbols = plugin_loader.getAvailablePlugins<TestPluginBase>() |