refactor structure and add basic test
This commit is contained in:
parent
374fce6428
commit
452d1ce082
1
.gitignore
vendored
1
.gitignore
vendored
@ -1 +1,2 @@
|
||||
build/
|
||||
.cache/
|
||||
|
||||
@ -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
11
tests/test_main.cpp
Normal 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");
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user