using doctest instead of catch2

This commit is contained in:
Karl-Wilfried Zimmer 2024-01-01 15:23:51 +01:00
parent c16ff72cf0
commit 714c91d0d9
5 changed files with 25 additions and 18 deletions

View File

@ -9,6 +9,7 @@ using namespace std;
void eigenExample(){ void eigenExample(){
Eigen::MatrixXd m(2,2); Eigen::MatrixXd m(2,2);
m(0,0) = 0;
m(1,0) = 2.5; m(1,0) = 2.5;
m(0,1) = -1; m(0,1) = -1;
m(1,1) = m(1,0) + m(0,1); m(1,1) = m(1,0) + m(0,1);

View File

@ -1,11 +1,13 @@
FetchContent_Declare( FetchContent_Declare(
catch doctest
GIT_REPOSITORY https://github.com/catchorg/Catch2.git GIT_REPOSITORY https://github.com/doctest/doctest.git
GIT_TAG v2.13.6) GIT_TAG v2.4.11)
FetchContent_MakeAvailable(catch) 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) add_test(NAME testlibtest COMMAND testlib)

10
tests/dummytest.cpp Normal file
View File

@ -0,0 +1,10 @@
//
// Created by nb on 01.01.24.
//
#include <doctest/doctest.h>
#include "Geometry/dummy.hpp"
TEST_CASE("dummy testcase"){
CHECK(true);
eigenExample();
}

6
tests/test_utils.cpp Normal file
View File

@ -0,0 +1,6 @@
//
// Created by nb on 31.12.23.
//
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include <doctest/doctest.h>

View File

@ -1,12 +0,0 @@
//
// Created by nb on 31.12.23.
//
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#include <Geometry/dummy.hpp>
TEST_CASE("Test Check","[main]") {
eigenExample();
REQUIRE( true );
}