Browse Source

build: Update tests for Catch2 v3

Yuri D'Elia 1 year ago
parent
commit
f4918622f0
5 changed files with 6 additions and 9 deletions
  1. 3 4
      tests/CMakeLists.txt
  2. 1 1
      tests/Example_test.cpp
  3. 1 1
      tests/PrusaStatistics_test.cpp
  4. 1 1
      tests/Timer_test.cpp
  5. 0 2
      tests/tests.cpp

+ 3 - 4
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)

+ 1 - 1
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;

+ 1 - 1
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 <iostream>
 
 static bool VERBOSE_MODE = false;	// If true - output additional info to std:cout

+ 1 - 1
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"
 

+ 0 - 2
tests/tests.cpp

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