From 714c91d0d9c2c9bc0346c2d9d890266526ddafbc Mon Sep 17 00:00:00 2001 From: Karl-Wilfried Zimmer Date: Mon, 1 Jan 2024 15:23:51 +0100 Subject: [PATCH] using doctest instead of catch2 --- src/dummy.cpp | 1 + tests/CMakeLists.txt | 14 ++++++++------ tests/dummytest.cpp | 10 ++++++++++ tests/test_utils.cpp | 6 ++++++ tests/testgeometry.cpp | 12 ------------ 5 files changed, 25 insertions(+), 18 deletions(-) create mode 100644 tests/dummytest.cpp create mode 100644 tests/test_utils.cpp delete mode 100644 tests/testgeometry.cpp diff --git a/src/dummy.cpp b/src/dummy.cpp index f77543c..03f946d 100644 --- a/src/dummy.cpp +++ b/src/dummy.cpp @@ -9,6 +9,7 @@ using namespace std; void eigenExample(){ Eigen::MatrixXd m(2,2); + m(0,0) = 0; m(1,0) = 2.5; m(0,1) = -1; m(1,1) = m(1,0) + m(0,1); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 4b916f8..f2a37e8 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,11 +1,13 @@ FetchContent_Declare( - catch - GIT_REPOSITORY https://github.com/catchorg/Catch2.git - GIT_TAG v2.13.6) -FetchContent_MakeAvailable(catch) + doctest + GIT_REPOSITORY https://github.com/doctest/doctest.git + GIT_TAG v2.4.11) +FetchContent_MakeAvailable(doctest) -add_executable(testlib testgeometry.cpp) +set(TESTFILES "dummytest.cpp") -target_link_libraries(testlib PRIVATE Geometry Catch2::Catch2) +add_executable(testlib test_utils.cpp "${TESTFILES}") + +target_link_libraries(testlib PRIVATE Geometry doctest) add_test(NAME testlibtest COMMAND testlib) \ No newline at end of file diff --git a/tests/dummytest.cpp b/tests/dummytest.cpp new file mode 100644 index 0000000..12f6d6f --- /dev/null +++ b/tests/dummytest.cpp @@ -0,0 +1,10 @@ +// +// Created by nb on 01.01.24. +// +#include +#include "Geometry/dummy.hpp" + +TEST_CASE("dummy testcase"){ + CHECK(true); + eigenExample(); +} \ No newline at end of file diff --git a/tests/test_utils.cpp b/tests/test_utils.cpp new file mode 100644 index 0000000..b8210f9 --- /dev/null +++ b/tests/test_utils.cpp @@ -0,0 +1,6 @@ +// +// Created by nb on 31.12.23. +// + +#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN +#include diff --git a/tests/testgeometry.cpp b/tests/testgeometry.cpp deleted file mode 100644 index 5d42b5a..0000000 --- a/tests/testgeometry.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// -// Created by nb on 31.12.23. -// - -#define CATCH_CONFIG_MAIN -#include -#include - -TEST_CASE("Test Check","[main]") { - eigenExample(); - REQUIRE( true ); -} \ No newline at end of file