build: Update tests for Catch2 v3

This commit is contained in:
Yuri D'Elia 2022-10-22 16:32:56 +02:00
parent ae17cef676
commit f4918622f0
5 changed files with 6 additions and 9 deletions

View File

@ -2,11 +2,10 @@
project(cmake_test) project(cmake_test)
# include catch_discover_tests function from Catch2 # include catch_discover_tests function from Catch2
include(${Catch2_SOURCE_DIR}/contrib/Catch.cmake) include(${Catch2_SOURCE_DIR}/extras/Catch.cmake)
# Make test executable # Make test executable
set(TEST_SOURCES set(TEST_SOURCES
tests.cpp
Example_test.cpp Example_test.cpp
PrusaStatistics_test.cpp PrusaStatistics_test.cpp
#Tests/Timer_test.cpp #Tests/Timer_test.cpp
@ -14,6 +13,6 @@ set(TEST_SOURCES
) )
add_executable(tests ${TEST_SOURCES}) add_executable(tests ${TEST_SOURCES})
target_include_directories(tests PRIVATE Tests) target_include_directories(tests PRIVATE tests)
target_link_libraries(tests Catch2::Catch2) target_link_libraries(tests Catch2::Catch2WithMain)
catch_discover_tests(tests) catch_discover_tests(tests)

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp" #include "catch2/catch_test_macros.hpp"
unsigned int Factorial( unsigned int number ) { unsigned int Factorial( unsigned int number ) {
return number <= 1 ? number : Factorial(number-1)*number; return number <= 1 ? number : Factorial(number-1)*number;

View File

@ -5,7 +5,7 @@
// For now the functions are just COPIED (lots of depencendies in ultralcd.h) // For now the functions are just COPIED (lots of depencendies in ultralcd.h)
#include "catch2/catch.hpp" #include "catch2/catch_test_macros.hpp"
#include <iostream> #include <iostream>
static bool VERBOSE_MODE = false; // If true - output additional info to std:cout static bool VERBOSE_MODE = false; // If true - output additional info to std:cout

View File

@ -4,7 +4,7 @@
*/ */
#include "catch.hpp" #include "catch2/catch_test_macros.hpp"
#include "../Firmware/Timer.h" #include "../Firmware/Timer.h"
#include "../Firmware/TimerRemaining.h" #include "../Firmware/TimerRemaining.h"

View File

@ -1,2 +0,0 @@
#define CATCH_CONFIG_MAIN
#include "catch2/catch.hpp"