nncc_target_link_libraries(nnc_module_test nnc_module nncc_core nncc_foundation nnc_plugin_core)
target_include_directories(nnc_module_test PUBLIC include)
+# Set macro in nnc_module_test with some_parser absolute path
+target_compile_definitions(nnc_module_test PRIVATE
+ CMAKE_SAMPLE_PLUGIN_ABS_PATH=$<TARGET_FILE:some_parser>)
+
add_subdirectory(libs)
add_subdirectory(examples)
--- /dev/null
+#include "module/plugin/shared_library.h"
+
+#include "gtest/gtest.h"
+
+#define STRING(s) _STRING(s)
+#define _STRING(s) #s
+
+using namespace nncc::contrib::module::plugin;
+
+TEST(CONTRIB_NNC, SharedLibrary)
+{
+ // missing so - missing function
+ SharedLibrary slMissing("/");
+ ASSERT_EQ(slMissing.findFunc("missing_func_name"), nullptr);
+
+ // existing so - missing function
+ SharedLibrary sl(STRING(CMAKE_SAMPLE_PLUGIN_ABS_PATH));
+ ASSERT_EQ(sl.findFunc("missing_func_name"), nullptr);
+
+ // existing so - existing function
+ typedef int (*fp_t)();
+ fp_t getSomeBeef = (fp_t)sl.findFunc("getSomeBeef");
+ ASSERT_NE(getSomeBeef, nullptr);
+ ASSERT_EQ(getSomeBeef(), 0xBEEF);
+
+ // Operator '<<'
+ std::ostringstream os;
+ os << sl;
+ ASSERT_EQ(os.str(), STRING(CMAKE_SAMPLE_PLUGIN_ABS_PATH));
+
+}