aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@gmail.com>2026-06-20 09:29:57 +0200
committerFelix Morgner <felix.morgner@gmail.com>2026-06-20 09:29:57 +0200
commitc5f8cd91186adbe9c68835675a019449cc275c6d (patch)
tree6fc208c628689a5a9080bc1a84f2337a3d023787 /CMakeLists.txt
parent90fa52db708c42d9707581156b957da99987bd1c (diff)
downloadttwhy-c5f8cd91186adbe9c68835675a019449cc275c6d.tar.xz
ttwhy-c5f8cd91186adbe9c68835675a019449cc275c6d.zip
lib: add basic test setup
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt27
1 files changed, 27 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bb68832..390afbc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,6 +14,11 @@ FetchContent_Declare("asio"
GIT_TAG "asio-1-38-0"
)
+FetchContent_Declare("catch2"
+ GIT_REPOSITORY "https://github.com/catchorg/Catch2.git"
+ GIT_TAG "v3.15.1"
+)
+
FetchContent_Declare("sml"
GIT_REPOSITORY "https://github.com/boost-ext/sml"
GIT_TAG "v1.2.0"
@@ -21,6 +26,7 @@ FetchContent_Declare("sml"
FetchContent_MakeAvailable(
"asio"
+ "catch2"
"sml"
)
@@ -94,3 +100,24 @@ target_link_libraries("ttwhy" PRIVATE
"ttwhy::lib"
)
+### Tests
+
+include("CTest")
+
+if(BUILD_TESTING)
+ include("Catch")
+
+ add_executable("ttwhy-tests")
+ add_executable("ttwhy::tests" ALIAS "ttwhy-tests")
+
+ target_sources("ttwhy-tests" PRIVATE
+ "ttwhy/scanners/ansi.tests.cpp"
+ )
+
+ target_link_libraries("ttwhy-tests" PRIVATE
+ "ttwhy::lib"
+ "Catch2::Catch2WithMain"
+ )
+
+ catch_discover_tests("ttwhy-tests")
+endif()