refactor structure and add basic test

This commit is contained in:
Gabriel Ionita 2025-10-24 10:43:58 +01:00
parent 374fce6428
commit 452d1ce082
Signed by: gabi
SSH Key Fingerprint: SHA256:LrMyvxum00K+HwzsYQc+lsxzqdX49JqIdJLc62SJqJY
4 changed files with 23 additions and 2 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
build/
.cache/

View File

@ -7,6 +7,15 @@ set(CMAKE_CXX_STANDARD 20)
find_package(cxxopts CONFIG REQUIRED)
find_package(Catch2 CONFIG REQUIRED)
add_executable(gwatch main.cpp)
add_executable(gwatch src/main.cpp)
target_link_libraries(gwatch PRIVATE cxxopts::cxxopts)
enable_testing()
add_executable(gwatch_tests tests/test_main.cpp)
target_link_libraries(gwatch_tests PRIVATE Catch2::Catch2WithMain)
include(CTest)
include(Catch)
catch_discover_tests(gwatch_tests)

11
tests/test_main.cpp Normal file
View File

@ -0,0 +1,11 @@
#include <catch2/catch_test_macros.hpp>
TEST_CASE("Basic test", "[example]") {
REQUIRE(1 + 1 == 2);
}
TEST_CASE("String operations", "[string]") {
std::string str = "hello";
REQUIRE(str.length() == 5);
REQUIRE(str == "hello");
}