From 8940195b4ea687c393d3de9f340eccf705c6eee1 Mon Sep 17 00:00:00 2001 From: Michael Ripperger Date: Fri, 22 Sep 2023 10:56:31 -0500 Subject: [PATCH] Added unit test for new TaskComposerPluginFactory constructor --- ...ct_task_composer_plugin_factories_unit.cpp | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tesseract_task_composer/test/tesseract_task_composer_plugin_factories_unit.cpp b/tesseract_task_composer/test/tesseract_task_composer_plugin_factories_unit.cpp index 70b642ee8a..52a978bc02 100644 --- a/tesseract_task_composer/test/tesseract_task_composer_plugin_factories_unit.cpp +++ b/tesseract_task_composer/test/tesseract_task_composer_plugin_factories_unit.cpp @@ -31,6 +31,7 @@ TESSERACT_COMMON_IGNORE_WARNINGS_POP #include #include #include +#include using namespace tesseract_planning; @@ -157,6 +158,32 @@ TEST(TesseractTaskComposerFactoryUnit, LoadAndExportPluginTest) // NOLINT TaskComposerPluginFactory check_factory(export_config_path); runTaskComposerFactoryTest(check_factory, plugin_config); } + + // TaskComposerPluginInfo Constructor + { + tesseract_common::fs::path config_path(std::string(TESSERACT_TASK_COMPOSER_DIR) + "/config/" + "task_composer_plugins.yaml"); + + YAML::Node plugin_config = YAML::LoadFile(config_path.string()); + const YAML::Node& plugins = plugin_config[tesseract_common::TaskComposerPluginInfo::CONFIG_KEY]; + const std::vector search_paths = plugins["search_paths"].as>(); + const std::vector search_libraries = plugins["search_libraries"].as>(); + + tesseract_common::TaskComposerPluginInfo info; + info.search_paths.insert(search_paths.begin(), search_paths.end()); + info.search_libraries.insert(search_libraries.begin(), search_libraries.end()); + info.task_plugin_infos.plugins = plugins["tasks"]["plugins"].as(); + info.executor_plugin_infos.plugins = plugins["executors"]["plugins"].as(); + info.executor_plugin_infos.default_plugin = plugins["executors"]["default"].as(); + + TaskComposerPluginFactory factory(info); + runTaskComposerFactoryTest(factory, plugin_config); + + auto export_config_path = tesseract_common::fs::path(tesseract_common::getTempPath()) / "task_composer_plugins_" + "export.yaml"; + TaskComposerPluginFactory check_factory(export_config_path); + runTaskComposerFactoryTest(check_factory, plugin_config); + } } TEST(TesseractTaskComposerFactoryUnit, PluginFactorAPIUnit) // NOLINT