Skip to content

Commit 38ab433

Browse files
committed
Move to Catch 2.x for the tests
1 parent 1698be4 commit 38ab433

File tree

5 files changed

+10
-17
lines changed

5 files changed

+10
-17
lines changed

tests/CMakeLists.txt

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,12 @@ include(DownloadProject)
33
# Download and configure Catch2 for the tests
44
download_project(PROJ Catch2
55
GIT_REPOSITORY https://github.com/catchorg/Catch2
6-
GIT_TAG Catch1.x
6+
GIT_TAG master
77
UPDATE_DISCONNECTED 1
88
)
9+
add_subdirectory(${Catch2_SOURCE_DIR} ${Catch2_BINARY_DIR})
910
list(APPEND CMAKE_MODULE_PATH ${Catch2_SOURCE_DIR}/contrib)
1011

11-
# Configure Catch2 so that it looks like a proper target
12-
add_library(Catch2 INTERFACE)
13-
add_library(Catch2::Catch2 ALIAS Catch2)
14-
target_include_directories(Catch2 INTERFACE
15-
$<BUILD_INTERFACE:${Catch2_SOURCE_DIR}/single_include>
16-
$<INSTALL_INTERFACE:include>
17-
)
18-
1912
# Testsutie options
2013
option(GFX_TIMSORT_USE_VALGRIND "Whether to run the tests with Valgrind" OFF)
2114
set(GFX_TIMSORT_SANITIZE "" CACHE STRING "Comma-separated list of options to pass to -fsanitize")
@@ -105,10 +98,10 @@ if (WIN32)
10598
endif()
10699

107100
include(CTest)
108-
include(ParseAndAddCatchTests)
101+
include(Catch)
109102

110-
ParseAndAddCatchTests(cxx_98_tests)
111-
ParseAndAddCatchTests(cxx_11_tests)
103+
catch_discover_tests(cxx_98_tests)
104+
catch_discover_tests(cxx_11_tests)
112105
if (WIN32)
113-
ParseAndAddCatchTests(windows_tests)
106+
catch_discover_tests(windows_tests)
114107
endif()

tests/cxx_11_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <stdexcept>
1010
#include <utility>
1111
#include <vector>
12-
#include <catch.hpp>
12+
#include <catch2/catch.hpp>
1313
#include <gfx/timsort.hpp>
1414

1515
////////////////////////////////////////////////////////////

tests/cxx_98_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include <iostream>
1010
#include <utility>
1111
#include <vector>
12-
#include <catch.hpp>
12+
#include <catch2/catch.hpp>
1313
#include <gfx/timsort.hpp>
1414

1515
namespace {

tests/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
* SPDX-License-Identifier: MIT
66
*/
77
#define CATCH_CONFIG_MAIN
8-
#include <catch.hpp>
8+
#include <catch2/catch.hpp>

tests/windows.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#include <stdexcept>
1010
#include <utility>
1111
#include <vector>
12-
#include <catch.hpp>
1312
#include <windows.h>
13+
#include <catch2/catch.hpp>
1414
#include <gfx/timsort.hpp>
1515

1616
TEST_CASE( "check inclusion of windows.h" ) {

0 commit comments

Comments
 (0)