file(GLOB_RECURSE HEADERS "include/*.h")
file(GLOB_RECURSE SOURCES "src/*.cpp")
+file(GLOB_RECURSE TESTS "src/*.test.cpp")
+list(REMOVE_ITEM SOURCES ${TESTS})
add_nncc_library(nnc_plugin_core SHARED ${HEADERS} ${SOURCES})
set_target_properties(nnc_plugin_core PROPERTIES LINKER_LANGUAGE CXX)
target_link_libraries(nnc_plugin_core PRIVATE nncc_foundation)
target_include_directories(nnc_plugin_core PUBLIC include)
+
+add_nncc_test(nnc_plugin_core_test ${TESTS} ${HEADERS})
+nncc_target_link_libraries(nnc_plugin_core_test nnc_plugin_core)
+nncc_target_link_libraries(nnc_plugin_core_test nncc_foundation)
--- /dev/null
+#include "ConfigException.h"
+
+#include "gtest/gtest.h"
+
+using namespace nncc::contrib;
+
+std::string configErrorMsg1 = "error constructor";
+std::string configErrorMsg2 = "error second constructor";
+
+std::vector<std::string> configErrorMsgs = {configErrorMsg1, configErrorMsg2};
+
+void configErr1() { throw ConfigException(configErrorMsg1); }
+
+void configErr2()
+{
+ try
+ {
+ configErr1();
+ }
+ catch (ConfigException &e)
+ {
+ throw ConfigException(e, configErrorMsg2);
+ }
+}
+
+TEST(CONTRIB_PLUGIN, ConfigException)
+{
+ try
+ {
+ configErr2();
+ }
+ catch (ConfigException &e)
+ {
+ ASSERT_TRUE(configErrorMsgs == e.getInfo());
+ return;
+ }
+
+ // should not happen
+ ASSERT_TRUE(false);
+}
--- /dev/null
+#include "PluginException.h"
+
+#include "gtest/gtest.h"
+
+using namespace nncc::contrib;
+
+std::string pluginErrorMsg1 = "error constructor";
+std::string pluginErrorMsg2 = "error second constructor";
+
+std::vector<std::string> pluginErrorMsgs = {pluginErrorMsg1, pluginErrorMsg2};
+
+void pluginErr1() { throw PluginException(pluginErrorMsg1); }
+
+void pluginErr2()
+{
+ try
+ {
+ pluginErr1();
+ }
+ catch (PluginException &e)
+ {
+ throw PluginException(e, pluginErrorMsg2);
+ }
+}
+
+TEST(CONTRIB_PLUGIN, PluginException)
+{
+ try
+ {
+ pluginErr2();
+ }
+ catch (PluginException &e)
+ {
+ ASSERT_TRUE(pluginErrorMsgs == e.getInfo());
+ return;
+ }
+
+ // should not happen
+ ASSERT_TRUE(false);
+}