Update CMake integration for Catch v3.1.0

pull/229/head
Guðni Már Gilbert 2022-10-16 20:43:50 +00:00 committed by Yuri D'Elia
parent 7ba6850411
commit 45f70e004c
27 changed files with 30 additions and 31 deletions

View File

@ -4,14 +4,14 @@ add_custom_target(tests)
add_compile_definitions(UNITTEST)
# include catch_discover_tests function from Catch2
include(${Catch2_SOURCE_DIR}/contrib/Catch.cmake)
include(${Catch2_SOURCE_DIR}/extras/Catch.cmake)
add_library(catch_main ${CMAKE_CURRENT_SOURCE_DIR}/test_main.cpp)
target_link_libraries(catch_main Catch2::Catch2)
target_link_libraries(catch_main Catch2::Catch2WithMain)
# registers given target as a catch test
function(add_catch_test target)
target_link_libraries(${target} catch_main Catch2::Catch2)
target_link_libraries(${target} catch_main Catch2::Catch2WithMain)
catch_discover_tests(${target})
add_dependencies(tests ${target})
endfunction()

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include "application.h"
#include <stdint.h>
#include "../modules/stubs/stub_serial.h"

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include "registers.h"
#include "modules/globals.h"
#include "../modules/stubs/stub_eeprom.h"

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include "circular_buffer.h"
using Catch::Matchers::Equals;
@ -85,7 +85,7 @@ TEST_CASE("circular_buffer::wrap_around", "[circular_buffer]") {
// loop to test the internal cursor wrap-around logic
// the number of loops needs to be equal or greater than the index type
for (auto loop = 0; loop != 256; ++loop) {
INFO("loop " << loop)
INFO("loop " << loop);
// ensure we can fill the buffer
for (auto i = 0; i != size; ++i) {

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include "progmem.h"
using Catch::Matchers::Equals;

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include "../../../../src/modules/buttons.h"
#include "../../../../src/modules/finda.h"

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include "../../../../src/modules/buttons.h"
#include "../../../../src/modules/finda.h"

View File

@ -2,7 +2,7 @@
// As a base for this test, unload_filament was chosen.
// Moreover, I didn't want to spoil the unit tests of the state machines themself with this.
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include "../../../../src/modules/buttons.h"
#include "../../../../src/modules/finda.h"

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include "../../../../src/modules/buttons.h"
#include "../../../../src/modules/finda.h"

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include "../../../../src/modules/buttons.h"
#include "../../../../src/modules/finda.h"

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include "../../../../src/modules/buttons.h"
#include "../../../../src/modules/finda.h"

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include "../../../../src/modules/buttons.h"
#include "../../../../src/modules/finda.h"

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include "main_loop_stub.h"
#include "homing.h"

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include "../../../../src/modules/buttons.h"
#include "../../../../src/modules/finda.h"

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include "../../../../src/modules/buttons.h"
#include "../../../../src/modules/finda.h"

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include <functional>

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include "../stubs/stub_adc.h"
#include "../stubs/stub_timebase.h"
#include "buttons.h"

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include "leds.h"
#include "shr16.h"
#include "../stubs/stub_timebase.h"

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include "motion.h"
using namespace modules::motion;

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include "../logic/error_codes.h"
#include "../logic/progress_codes.h"
#include "protocol.h"

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include "pulse_gen.h"
#include "../pins.h"
#include <stdio.h>

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include "speed_table.h"
#include <stdio.h>

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include "../../../../src/hal/eeprom.h"
#include "stub_eeprom.h"

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include "timebase.h"
#include "../stubs/stub_timebase.h"

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
#include "../stubs/stub_adc.h"
#include "../stubs/stub_timebase.h"
#include "buttons.h"

View File

@ -1,4 +1,4 @@
#include "catch2/catch.hpp"
#include "catch2/catch_all.hpp"
TEST_CASE("type tests", "[system]") {
REQUIRE(sizeof(uint64_t) == 8);

View File

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