From f4918622f0b08f66bb2d56957155b523adc0e0e8 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Sat, 22 Oct 2022 16:32:56 +0200 Subject: [PATCH] build: Update tests for Catch2 v3 --- tests/CMakeLists.txt | 7 +++---- tests/Example_test.cpp | 2 +- tests/PrusaStatistics_test.cpp | 2 +- tests/Timer_test.cpp | 2 +- tests/tests.cpp | 2 -- 5 files changed, 6 insertions(+), 9 deletions(-) delete mode 100644 tests/tests.cpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 67a8dc16f..7bab4fea2 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -2,11 +2,10 @@ project(cmake_test) # include catch_discover_tests function from Catch2 -include(${Catch2_SOURCE_DIR}/contrib/Catch.cmake) +include(${Catch2_SOURCE_DIR}/extras/Catch.cmake) # Make test executable set(TEST_SOURCES - tests.cpp Example_test.cpp PrusaStatistics_test.cpp #Tests/Timer_test.cpp @@ -14,6 +13,6 @@ set(TEST_SOURCES ) add_executable(tests ${TEST_SOURCES}) -target_include_directories(tests PRIVATE Tests) -target_link_libraries(tests Catch2::Catch2) +target_include_directories(tests PRIVATE tests) +target_link_libraries(tests Catch2::Catch2WithMain) catch_discover_tests(tests) diff --git a/tests/Example_test.cpp b/tests/Example_test.cpp index 99933824f..b21d17a35 100644 --- a/tests/Example_test.cpp +++ b/tests/Example_test.cpp @@ -1,4 +1,4 @@ -#include "catch2/catch.hpp" +#include "catch2/catch_test_macros.hpp" unsigned int Factorial( unsigned int number ) { return number <= 1 ? number : Factorial(number-1)*number; diff --git a/tests/PrusaStatistics_test.cpp b/tests/PrusaStatistics_test.cpp index 39802dc1b..ce0ddb993 100644 --- a/tests/PrusaStatistics_test.cpp +++ b/tests/PrusaStatistics_test.cpp @@ -5,7 +5,7 @@ // For now the functions are just COPIED (lots of depencendies in ultralcd.h) -#include "catch2/catch.hpp" +#include "catch2/catch_test_macros.hpp" #include static bool VERBOSE_MODE = false; // If true - output additional info to std:cout diff --git a/tests/Timer_test.cpp b/tests/Timer_test.cpp index 6f8ee75c3..838a0c1ac 100644 --- a/tests/Timer_test.cpp +++ b/tests/Timer_test.cpp @@ -4,7 +4,7 @@ */ -#include "catch.hpp" +#include "catch2/catch_test_macros.hpp" #include "../Firmware/Timer.h" #include "../Firmware/TimerRemaining.h" diff --git a/tests/tests.cpp b/tests/tests.cpp deleted file mode 100644 index 62bf7476a..000000000 --- a/tests/tests.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#define CATCH_CONFIG_MAIN -#include "catch2/catch.hpp"