From: LeonardoBizzoni Date: Sun, 15 Sep 2024 17:49:24 +0000 (+0200) Subject: Testing setup X-Git-Url: http://git.leonardobizzoni.com/?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=LBPL Testing setup --- diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..1d953f4 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use nix diff --git a/CMakeLists.txt b/CMakeLists.txt index d53e115..09c8204 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,12 @@ add_executable(${PROJECT_NAME} ${SRC}) set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX) target_compile_definitions(${PROJECT_NAME} PRIVATE ROOTDIR="${CMAKE_SOURCE_DIR}") +# Setup testing environment +find_package(Catch2 3 REQUIRED) +file(GLOB_RECURSE TEST_SRC "test/*.cpp" "test/*.hpp") +add_executable(${PROJECT_NAME}-tests ${TEST_SRC}) +target_link_libraries(${PROJECT_NAME}-tests PRIVATE Catch2::Catch2WithMain) + # Set output directories set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}" diff --git a/shell.nix b/shell.nix index fe2e96d..77a5843 100644 --- a/shell.nix +++ b/shell.nix @@ -5,6 +5,7 @@ pkgs.mkShell { man-pages man-pages-posix + catch2_3 gnumake cmake seer