From da15031afe604e4ed122a8c4cf9dcd7c46184703 Mon Sep 17 00:00:00 2001 From: jr0me Date: Wed, 17 Jul 2024 02:49:20 -0300 Subject: [PATCH] feat: add google test as dependency with example test --- src/agent/tests/CMakeLists.txt | 4 +++- src/agent/tests/agent_test.cpp | 11 +++++++++-- src/vcpkg.json | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/agent/tests/CMakeLists.txt b/src/agent/tests/CMakeLists.txt index 1e476963c2..e06cc1d3bb 100644 --- a/src/agent/tests/CMakeLists.txt +++ b/src/agent/tests/CMakeLists.txt @@ -1,9 +1,11 @@ # Wazuh Agent tests +find_package(GTest CONFIG REQUIRED) + set(TEST_SOURCES agent_test.cpp ) add_executable(agent_test agent_test.cpp) -target_link_libraries(agent_test PRIVATE agent) +target_link_libraries(agent_test PRIVATE agent GTest::gtest) add_test(NAME AgentTest COMMAND agent_test) diff --git a/src/agent/tests/agent_test.cpp b/src/agent/tests/agent_test.cpp index b8e2186033..d3f62a34bd 100644 --- a/src/agent/tests/agent_test.cpp +++ b/src/agent/tests/agent_test.cpp @@ -1,7 +1,14 @@ #include +#include + +TEST(AgentTests, AgentConstruction) +{ + EXPECT_NO_THROW(Agent {}); +} + int main(int argc, char** argv) { - Agent agent; - return 0; + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); } diff --git a/src/vcpkg.json b/src/vcpkg.json index dd651c1fd2..3b45724a08 100644 --- a/src/vcpkg.json +++ b/src/vcpkg.json @@ -2,5 +2,6 @@ "name": "wazuh-agent-mvp", "version": "5.0.0", "dependencies": [ + "gtest" ] }