Commit Graph

4473 Commits

Author SHA1 Message Date
Martin Hořeňovský 3cd90c5c3b Add tests for multiple args to DL_PATHS in catch_discover_tests 2024-03-26 18:04:17 +01:00
Cristian Le 202bdee977 Fix `TEST_DL_PATHS` to be multi-args
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
2024-03-26 18:04:17 +01:00
Chris Thrasher bfe3ff8f19 Specify minimum C++ version for amalgamated test build
This target previously did not specify its minimum C++ standard.
AppleClang was emitting warnings about the use of C++11 features
which is fixed by telling CMake that this target requires C++14.
Because this target does not link to the existing CMake targets
it never inherited that C++ standard requirement.
2024-03-13 21:12:59 +01:00
Uilian Ries a2a3c55058
Improve Conan recipe support (#2831)
* Improve Conan recipe support
* export files
* supports c++14
* update Conan client in the CI
* Better compatibility with Conan 1.x
* Manage options and cppstd for Conan 1.x
* copy eveything from extra


Signed-off-by: Uilian Ries <uilianries@gmail.com>
2024-03-12 22:59:28 +01:00
morinmorin eb8f2c5810 Add workaround for unguarded use of __has_extension 2024-03-12 22:57:59 +01:00
Chris Thrasher 88f4ec3cc5 Ignore C++98 related compiler warnings
Catch2 has long since required a standard newer than C++98 so we
can safely ignore any warnings related to such old standards.
2024-03-12 22:56:37 +01:00
Chris Thrasher 792c3b7549 Stop repeating conditional in endif()
This is not necessary so we can remove it. Most conditionals already
omit this anyways.
2024-03-12 22:55:12 +01:00
Chris Thrasher 1a44e6f661 Use built-in CMake feature for requiring a specific language standard
This feature was added in CMake 3.8. Requiring specific language
features is an outdated approach that CMake stopped supporting in
favor of simply specifyin the specific language standard you want.

https://cmake.org/cmake/help/v3.10/prop_gbl/CMAKE_CXX_KNOWN_FEATURES.html
2024-03-12 22:54:09 +01:00
Cristian Morales Vega 459ac8562b Fix build with gcc 5.4
The Core Guidelines state "A base class destructor should be either
public and virtual, or protected and non-virtual" so, hopefully, no
static analyser will complain.
2024-03-12 17:15:03 +01:00
Martin Hořeňovský 8ac8190e49
v3.5.3 2024-03-01 22:07:10 +01:00
Martin Jeřábek b20b365fd2 releaseCommon: fix SyntaxWarning: invalid escape sequence '\s' 2024-03-01 21:24:45 +01:00
Martin Jeřábek 4d8affc989 less copies and allocations in replaceInPlace 2024-03-01 21:24:45 +01:00
Martin Jeřábek cde3509664 Fix various useful clang-tidy warnings
* bugprone-branch-clone
* bugprone-copy-constructor-init
* bugprone-empty-catch
* bugprone-sizeof-expression
* bugprone-switch-missing-default-case
* bugprone-unused-local-non-trivial-variable
* clang-analyzer-core.uninitialized.Assign
* clang-analyzer-cplusplus.Move
* clang-analyzer-optin.cplusplus.VirtualCall
* modernize-loop-convert
* modernize-raw-string-literal
* modernize-use-equals-default
* modernize-use-override
* modernize-use-using
* performance-avoid-endl
* performance-inefficient-string-concatenation
* performance-inefficient-vector-operation
* performance-noexcept-move-constructor
* performance-unnecessary-value-param (and improve generator example)
* readability-duplicate-include
* readability-inconsistent-declaration-parameter-name
* readability-non-const-parameter
* readability-redundant-casting
* readability-redundant-member-init
* readability-redundant-smartptr-get
* readability-static-accessed-through-instance
* unused variable in amalgamted tests
2024-03-01 21:24:45 +01:00
Martin Jeřábek 7677c1658e ci: add clang-tidy run 2024-03-01 21:24:45 +01:00
Martin Jeřábek 92d3b23913 add .clang-tidy config 2024-03-01 21:24:45 +01:00
Martin Jeřábek dca87563bb Evaluate argument of TEST_CASE in static-analysis mode 2024-03-01 21:24:45 +01:00
Martin Jeřábek da303cc668 Evaluate argument of (DYNAMIC_)SECTION in static-analysis mode 2024-03-01 21:24:45 +01:00
Martin Hořeňovský c3fd4eb17e
Update outdated tests for stringifying characters
Previously the tests relied purely on output changes in approvals.
Now the stringification output is checked directly as part of the
unit tests.
2024-03-01 15:09:11 +01:00
Sven fb51116d5b
Avoid useless FDuration cast in benchmark analysis (#2823)
Co-authored-by: Sven Johannsen <s.johannsen@bretgeld-engineering.de>
2024-02-26 23:25:58 +01:00
Martin Hořeňovský ed6ac8a629
Update AppVeyor exclusion branch pattern for Github Actions 2024-02-23 20:52:04 +01:00
Martin Hořeňovský e7913f1363
Reinstate VS 2017 CI in AppVeyor 2024-02-23 20:51:26 +01:00
James Smith 4f3871d53f Compiler compatibility for Visual Studio 2017 (v141) for template friend operator == (#2792).
Make the operator not-friend is a sufficient solution. Closes #2792
2024-02-23 20:45:32 +01:00
Sven Johannsen f476bcb633 fix double promotion in catch_approx.cpp 2024-02-21 15:02:13 +01:00
itacud95 024cfb3542
Link Android's `log` with PRIVATE visibility (#2815)
INTERFACE should be used on dependencies from other than our source files.
PRIVATE should be used the include happens in our source files.

In this case (src/catch2/internal/catch_debug_console.cpp:20) the include
is from our source file.

I encountered a issue with this when building Catch2 for Android in
combination with BUILD_SHARED_LIBS. Changing the visibility to PRIVATE
fixes the issue.
2024-02-20 00:32:12 +01:00
Martin Hořeňovský 28c2f0b0c2
Mention x87 and ffast-math breaking FP random gen reproducibility 2024-02-19 15:02:11 +01:00
Martin Hořeňovský 2e1b02a0e2
Document issue with spaceship operator in assertion and MSVC 2024-02-19 15:02:10 +01:00
Martin Hořeňovský 82e9b9b5f2
Update CMake build instructions for current CMake version 2024-02-19 15:02:08 +01:00
Fernando J. Iglesias García 031a163a2c Improve tutorial.md with link to two-file setup instructions. 2024-02-19 15:01:14 +01:00
Martin Hořeňovský 562f31029a
Use the same Conan CMake target setup for Conan v1 and v2.
This requires Conan v1 in version 1.53.0 or greater, but that
should not pose a problem in practice.
2024-02-17 23:04:04 +01:00
Devon Adair 62d4aecb8c
Conan v2 (#2805)
* Removed Conan1 build.py file using conan package tools that are no longer supported

* Working conan 1 and 2 build with the test package. 

updated the test_package to be updated to conan 2 and fixed missing cmake. Still need to check that the license file is packaged up and that the packages look identical before the changes

* Removing debug prints and the license check that isn't working yet

* Working license file copied over as it was before

* Migrated the properties of cpp_info to conan 2. Keeping conan 1 support by checking the version of conan

https://docs.conan.io/1/migrating_to_2.0/properties.html

* Revert "Removed Conan1 build.py file using conan package tools that are no longer supported"

This reverts commit a606d1dfe6.

* Need to add a set_version to parse the version from CMakeLists.txt

Adding a package build yaml to ensure conan keeps building on 1 and 2

* Setting lowercase catch2 for pkg_config and cmake_target_name

* Fixing the namespace for conan file cmake_target_name
2024-02-17 16:42:44 +01:00
Letu Ren b817497528 Fix number of current reporter
There are nine reporters in Catch2 3.5.2, Automake, compact, console,
JSON, JUnit, SonarQube, TAP, TeamCity and XML.
2024-02-16 21:29:57 +01:00
Julia Paluch 4f1b24df77 clarify duration unit in docs 2024-02-16 21:29:19 +01:00
Fædon Jóhannes 3157d6bbf1
Add Bazel instructions to integration docs (#2812)
Co-authored-by: Fædon Jóhannes Sinis <fs@treble.tech>
2024-02-16 16:58:09 +01:00
Martin Hořeňovský 4570fca24b
Remove obsolete C++14 define
There is no reason to have code conditional on C++14, because C++14
is the minimum supported language standard for v3.
2024-02-13 00:01:19 +01:00
Martin Hořeňovský 0787132fc8
Add documentation for the current state of decomposer 2024-02-12 13:43:21 +01:00
Martin Hořeňovský dc51386b9f
Support literal-zero detectors using consteval int constructors
This was originally motivated by `REQUIRE((a <=> b) == 0)` no
longer compiling using MSVC. After some investigation, I found
that they changed their implementation of the zero literal
detector from the previous pointer-constructor with deleted
other constructors, into one that uses `consteval` constructor
from int.

This breaks the previous detection logic, because now
`is_foo_comparable<std::strong_ordering, int>` is true, but
actually trying to compare them is a compile-time error...
The solution was to make the decomposition `constexpr` and rely
on a late C++20 DR that makes it so that `consteval` propagates
up through the callstack of `constexpr` functions, until it either
runs out of `constexpr` functions, or succeeds.

However, the default handling of types in decomposition is to
take a reference to them. This reference never becomes dangling,
but because the constexpr evaluation engine cannot prove this,
decomposition paths taking references to objects cannot be
actually evaluated at compilation time. Thankfully we already
did have a value-oriented decomposition path for arithmetic types
(as these are common linkage-less types), so we could just
explicitly spell out the `std::foo_ordering` types as also being
supposed to be decomposed by-value.

Two more fun facts about these changes
 1) The original motivation of the MSVC change was to avoid
    trigering a `Wzero-as-null-pointer-constant` warning. I still
    do not believe this was a good decision.
 2) Current latest version of MSVC does not actually implement the
    aforementioned C++20 DR, so even with this commit, MSVC cannot
    compile `REQUIRE((a <=> b) == 0)`.
2024-02-12 00:52:53 +01:00
Martin Hořeňovský bbba3d8a06
Disable CI for GCC 5 and 6
They can't compile the new constexpr decomposer because
`ITransientExpression` has a defaulted virtual destructor. We could
instead drop the virtual destructor - it only exists to silence
static analysis tools complaining about having virtual functions
without virtual destructor - but GCC 5 and 6 are positively ancient,
so we drop them instead.
2024-02-11 14:36:17 +01:00
Martin Hořeňovský d937427f1f
Disable tests for reproducible FP on non-SSE2 x86 targets
Without SSE2 enabled, x86 targets will use x87 FPU, which breaks
the tests checking for reproducible results from our random
floating point number generators. The output is still reproducible,
at least between binaries targetting x87, but the tests hardcode
results for the whole pipeline being done in 32/64bit precision.

Closes #2796
2024-02-11 00:25:24 +01:00
Martin Hořeňovský 2a5de4e447
Fix OOB access when computing -# tag for file without extension
It is unlikely that this would ever come in practice, but there
is no reason to fix it.

Related to #2798
2024-02-10 23:27:19 +01:00
Chris Thrasher 1078e7e95b Fix clang-tidy `bugprone-chained-comparison` warnings
This triggers when running clang-tidy's bugprone-* family of checks
in code which uses Catch2 even if Catch2 headers are marked as
SYSTEM headers due to how code expanded from macros is treated as
first party even if the macro comes from a 3rd party library. The
fix is luckily pretty straightforward.

This check is added in clang-tidy-18 due for release later this year.
2024-01-24 22:41:00 -07:00
Martin Hořeňovský 79205da6a6
Fix typo in release notes for v3.5.2 2024-01-15 14:23:00 +01:00
Martin Hořeňovský 658acee86e
Run tests on all cores in GHA jobs 2024-01-15 14:22:45 +01:00
Martin Hořeňovský 05e10dfccc
v3.5.2 2024-01-15 14:13:53 +01:00
Tim Blechmann 597ce12b65 reporters: silence -Wsubobject-linkage
gcc emits `Wsubobject-linkage`, because the the publicly visible
`TablePrinter` contains `ColumnInfo`, which is part of an anonymous
namespace
2024-01-15 09:57:30 +01:00
Chris Thrasher 05786fa7ec
Remove redundant destructors
Classes will automatically inherit the virtual-ness of their base
class destructors. If the base class already has a virtual
destructor and the derived class needs default destructor semantics
then the derived class can omit defining the destructor in favor of
the compiler automatically defining it.

This has an additional benefit of reenabling move semantics. The
presence of a user-specified destructor automatically disables move
operations.
2024-01-14 23:33:51 +01:00
Martin Hořeňovský d79bfa05c7
More readable config default 2024-01-14 21:25:04 +01:00
Martin Hořeňovský 6ebdd8fac2
Add Wsubobject-linkage to warning flags 2024-01-14 21:22:09 +01:00
Martin Hořeňovský 7f931d6df4
Add tests for scaled ULP distance between +/- FLT/DBL_MAX 2024-01-14 21:15:02 +01:00
Martin Hořeňovský a0ef2115f8
Cleanup types in resample 2024-01-14 20:59:05 +01:00
Martin Hořeňovský 863c662c0e
Fix adding Opts with | to lvalue Parser
This is the recommended way of adding new Opts in our documentation
for using custom main, but we did not compile the code to see if it
works. We now compile the example as part of the BUILD_EXAMPLES
option.

Fixes #2787
2024-01-02 23:27:13 +01:00