diff --git a/.gitignore b/.gitignore index 567609b..a4fb4fb 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ build/ +.cache/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 671b1cf..e6618d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/main.cpp b/src/main.cpp similarity index 100% rename from main.cpp rename to src/main.cpp diff --git a/tests/test_main.cpp b/tests/test_main.cpp new file mode 100644 index 0000000..21e771e --- /dev/null +++ b/tests/test_main.cpp @@ -0,0 +1,11 @@ +#include + +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"); +}