Skip to content

Commit cb8b499

Browse files
committed
fix(complex-numbers): use runner's Catch2 version
The test runner uses Catch2 v3.4.0, while locally we still had v2.13.6. The recent changes to the complex-numbers test work with v2.13.6, while they don't work with v3.4.0, causing compilation to always fail in the test runner. This commit changes the test to be compatible with v3.4.0 and updates the local Catch2 copy.
1 parent 85e3313 commit cb8b499

File tree

6 files changed

+23942
-17941
lines changed

6 files changed

+23942
-17941
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
exclude: 'test/(catch.hpp|tests-main.cpp)'
1+
exclude: 'test/(catch(_amalgamated)?.[ch]pp|tests-main.cpp)'
22

33
repos:
44
- repo: https://github.com/pre-commit/mirrors-clang-format

exercises/practice/complex-numbers/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ elseif(EXERCISM_TEST_SUITE)
3232
target_compile_definitions(${exercise} PRIVATE EXERCISM_TEST_SUITE)
3333
else()
3434
# Build executable from sources and headers
35-
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
35+
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/catch_amalgamated.cpp test/tests-main.cpp)
3636
endif()
3737

3838
set_target_properties(${exercise} PROPERTIES

exercises/practice/complex-numbers/complex_numbers_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#ifdef EXERCISM_TEST_SUITE
77
#include <catch2/catch.hpp>
88
#else
9-
#include "test/catch.hpp"
9+
#include "test/catch_amalgamated.hpp"
1010
#endif
1111

1212
// Complex Numbers exercise test case data version 1.3.0
@@ -26,7 +26,7 @@ using complex_numbers::Complex;
2626
static constexpr double eps = 0.005;
2727

2828
// Custom Catch2 matcher for approximate equality of Complex numbers
29-
class ComplexApproxMatcher : public Catch::MatcherBase<Complex> {
29+
class ComplexApproxMatcher : public Catch::Matchers::MatcherBase<Complex> {
3030
public:
3131
ComplexApproxMatcher(const Complex& expected, double epsilon)
3232
: expected{expected}, epsilon{epsilon} {}

0 commit comments

Comments
 (0)