diff --git a/src/sdks/core/src/cpp/sdk/cpptest/CMakeLists.txt b/src/sdks/core/src/cpp/sdk/cpptest/CMakeLists.txt index c542cf6cc..611c07443 100644 --- a/src/sdks/core/src/cpp/sdk/cpptest/CMakeLists.txt +++ b/src/sdks/core/src/cpp/sdk/cpptest/CMakeLists.txt @@ -39,8 +39,6 @@ endif () find_package(WPEFramework CONFIG REQUIRED) find_package(${NAMESPACE}Core CONFIG REQUIRED) -find_package(Firebolt CONFIG REQUIRED) -find_package(${FIREBOLT_NAMESPACE}SDK CONFIG REQUIRED) set(TESTAPP TestFireboltCore) @@ -52,13 +50,13 @@ target_link_libraries(${TESTAPP} PRIVATE ${NAMESPACE}Core::${NAMESPACE}Core ${FIREBOLT_NAMESPACE}SDK::${FIREBOLT_NAMESPACE}SDK + nlohmann_json_schema_validator + gtest_main ) target_include_directories(${TESTAPP} PRIVATE - $ - $ - $ + $ ) if (POLYMORPHICS_REDUCER_METHODS) @@ -79,3 +77,36 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/${FIREBOLT_NAMESPACE}/usr/bin COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/${TESTAPP} ${CMAKE_BINARY_DIR}/${FIREBOLT_NAMESPACE}/usr/bin ) + +if(ENABLE_UNIT_TESTS) + set(UNIT_TESTS_APP FireboltCoreUnitTests) + + message("Setup ${UNIT_TESTS_APP}") + + add_definitions(-DUNIT_TEST) + + file(GLOB UNIT_TESTS "unit/*") + + add_executable(${UNIT_TESTS_APP} + CoreSDKTest.cpp + Unit.cpp + ${UNIT_TESTS} + ) + + link_directories(${CMAKE_SOURCE_DIR}/../../Thunder/install/usr/lib/) + target_link_libraries(${UNIT_TESTS_APP} + PRIVATE + ${NAMESPACE}Core::${NAMESPACE}Core + ${FIREBOLT_NAMESPACE}SDK::${FIREBOLT_NAMESPACE}SDK + nlohmann_json_schema_validator + gtest_main + ) + + target_include_directories(${UNIT_TESTS_APP} + PRIVATE + $ + ) + + include(GoogleTest) + gtest_discover_tests(${UNIT_TESTS_APP}) +endif() diff --git a/src/sdks/core/src/cpp/sdk/cpptest/Unit.cpp b/src/sdks/core/src/cpp/sdk/cpptest/Unit.cpp new file mode 100644 index 000000000..d4fef024c --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/cpptest/Unit.cpp @@ -0,0 +1,9 @@ +#include "gtest/gtest.h" +#include "CoreSDKTest.h" + +int main(int argc, char** argv) { + std::string url = "ws://localhost:9998"; + CoreSDKTest::CreateFireboltInstance(url); + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} \ No newline at end of file diff --git a/src/sdks/core/src/cpp/sdk/cpptest/unit/unit.h b/src/sdks/core/src/cpp/sdk/cpptest/unit/unit.h new file mode 100644 index 000000000..281096f15 --- /dev/null +++ b/src/sdks/core/src/cpp/sdk/cpptest/unit/unit.h @@ -0,0 +1,5 @@ +#pragma once + +#include "gtest/gtest.h" +#include "../CoreSDKTest.h" +#include "json_engine.h" \ No newline at end of file