Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
exclude: 'test/(catch.hpp|tests-main.cpp)'
exclude: 'test/(catch(_amalgamated)?.[ch]pp|tests-main.cpp)'

repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
Expand Down
12 changes: 6 additions & 6 deletions exercises/practice/complex-numbers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@ else()
set(exercise_cpp "")
endif()

# Use the common Catch library?
if(EXERCISM_COMMON_CATCH)
# For Exercism track development only
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h $<TARGET_OBJECTS:catchlib>)
elseif(EXERCISM_TEST_SUITE)
if(EXERCISM_TEST_SUITE)
# The Exercism test suite is being run, the Docker image already
# includes a pre-built version of Catch.
find_package(Catch2 REQUIRED)
Expand All @@ -32,7 +28,11 @@ elseif(EXERCISM_TEST_SUITE)
target_compile_definitions(${exercise} PRIVATE EXERCISM_TEST_SUITE)
else()
# Build executable from sources and headers
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/tests-main.cpp)
# Other exercises have a third case where we use a local Catch2 copy from `test/`,
# which then only needs to be built once and not individually for each exercise.
# However, for complex-numbers we currently use a different version of Catch2 and
# therefore always build the version local to the exercise.
add_executable(${exercise} ${file}_test.cpp ${exercise_cpp} ${file}.h test/catch_amalgamated.cpp test/tests-main.cpp)
endif()

set_target_properties(${exercise} PROPERTIES
Expand Down
4 changes: 2 additions & 2 deletions exercises/practice/complex-numbers/complex_numbers_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#ifdef EXERCISM_TEST_SUITE
#include <catch2/catch.hpp>
#else
#include "test/catch.hpp"
#include "test/catch_amalgamated.hpp"
#endif

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

// Custom Catch2 matcher for approximate equality of Complex numbers
class ComplexApproxMatcher : public Catch::MatcherBase<Complex> {
class ComplexApproxMatcher : public Catch::Matchers::MatcherBase<Complex> {
public:
ComplexApproxMatcher(const Complex& expected, double epsilon)
: expected{expected}, epsilon{epsilon} {}
Expand Down
Loading
Loading