Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90554514
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
Sat, Nov 2, 17:22
Size
1 KB
Mime Type
text/x-c
Expires
Mon, Nov 4, 17:22 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22095554
Attached To
rSPECMICP SpecMiCP / ReactMiCP
plugin_manager.cpp
View Options
#include <catch.hpp>
#include "utils/plugins/plugin_manager.hpp"
#include "utils/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
();
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