Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F79713415
plugin_manager.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Aug 27, 21:20
Size
1 KB
Mime Type
text/x-c
Expires
Thu, Aug 29, 21:20 (2 d)
Engine
blob
Format
Raw Data
Handle
20221730
Attached To
rSPECMICP SpecMiCP / ReactMiCP
plugin_manager.cpp
View Options
#include <catch.hpp>
#include "specmicp_common/plugins/plugin_manager.hpp"
#include "specmicp_common/filesystem.hpp"
#include "specmicp_common/log.hpp"
#include "test_basic_plugin_mockobject.hpp"
#include <iostream>
using namespace specmicp;
using namespace specmicp::plugins;
TEST_CASE("Plugin manager", "[plugin]")
{
init_logger(&std::cerr, logger::Warning);
SECTION("get_manager") {
auto& plugin_manager = get_plugin_manager();
std::cerr << "this error is OK :";
CHECK(plugin_manager.check_version(PluginAPIVersion(0, 0, 0)) == false);
}
SECTION("basic_plugin") {
auto& plugin_manager = get_plugin_manager();
plugin_manager.add_plugin_directory(specmicp::utils::get_current_directory());
auto retcode = plugin_manager.load_plugin("test_basic_plugin.so");
REQUIRE(retcode == true);
REQUIRE(plugin_manager.get_module("test_module") != nullptr);
auto object = plugin_manager.get_object<TestBaseObject>(
"test_module", "test_add");
REQUIRE(object != nullptr);
CHECK(object->add(2, 3) == 5);
auto object2 = plugin_manager.get_object<TestBaseObject>(
"test_module", "test_substract");
REQUIRE(object2 != nullptr);
CHECK(object2->add(2, 3) == -1);
}
}
Event Timeline
Log In to Comment