Skip to content

Commit

Permalink
Catch2 CI integration
Browse files Browse the repository at this point in the history
  • Loading branch information
djowel committed Aug 30, 2024
1 parent d8a352e commit 9ee3c05
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
21 changes: 18 additions & 3 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@ cmake_minimum_required(VERSION 3.5.1)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

###############################################################################
# Catch2

include(FetchContent)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.4.0 # or a later release
)
FetchContent_MakeAvailable(Catch2)
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)

include(CTest)
include(Catch)

###############################################################################
project(q_test)

Expand Down Expand Up @@ -74,7 +89,7 @@ set(APP_SOURCES
foreach(testsourcefile ${APP_SOURCES})
string(REPLACE ".cpp" "" testname ${testsourcefile})
add_executable(test_${testname} ${testsourcefile})
target_link_libraries(test_${testname} libq libqio)
target_link_libraries(test_${testname} libq libqio Catch2::Catch2WithMain)
endforeach(testsourcefile ${APP_SOURCES})

# Copy test files to the binary dir
Expand All @@ -92,5 +107,5 @@ file(
COPY golden
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})

include(CTest)
add_test(NAME fft_test COMMAND fft_test)


2 changes: 1 addition & 1 deletion test/fft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Distributed under the MIT License [ https://opensource.org/licenses/MIT ]
=============================================================================*/
#define CATCH_CONFIG_MAIN
#include <infra/catch.hpp>
#include <catch2/catch_all.hpp>

#include <q/fft/fft.hpp>
#include <q_io/audio_file.hpp>
Expand Down

0 comments on commit 9ee3c05

Please sign in to comment.