From 9a166bcefa798d8fcc0238db0ccfccbd8bd80192 Mon Sep 17 00:00:00 2001 From: LeonardoBizzoni Date: Sun, 15 Sep 2024 19:49:24 +0200 Subject: [PATCH] Testing setup --- .envrc | 1 + CMakeLists.txt | 6 ++++++ shell.nix | 1 + 3 files changed, 8 insertions(+) create mode 100644 .envrc 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 -- 2.52.0