Commit Graph

4536 Commits

Author SHA1 Message Date
Martin Hořeňovský
05fb437cbb
Fix & extend tests for comparing const instances of zero lit types 2024-04-08 13:15:35 +02:00
Martin Hořeňovský
71b11c4e33
Fix assertion for const instance of std::ordering
The issue was that `capture_by_value` was meant to be specialized
by plain type, e.g. `capture_by_value<std::weak_ordering>`, but
the TMP in Decomposer did not properly throw away `const` (and
`volatile`) qualifiers, before taking the value of `capture_by_value`.
2024-04-08 11:33:43 +02:00
Martin Hořeňovský
0a6a2ce887
Fix preprocessor check for enabling FP reproducibility tests
This solves warning about the `uniform_fp_test_params` helper
being unused on M1 mac (or any other platform using GCC and not
using SSE2).

Closes #2845
2024-04-06 20:27:15 +02:00
Martin Hořeňovský
355a6e273b
Add M1 MacOS workflow 2024-04-06 20:27:14 +02:00
Martin Hořeňovský
bff6e35e2b
Replace last use of std::uniform_int_distribution with our own
Our implementation should be slightly faster, and has the
advantage of being consistent between platforms. This does not
have immediate user impact, because we currently use random_device
to generate random seed for resampling, but if we decide to change
this in the future, it is one less place to fix.
2024-04-03 13:28:26 +02:00
Martin Hořeňovský
d99eb8bec8
Optimize 64x64 extended multiplication implementation
Now we use intrinsics when possible, and fallback to optimized
implementation in portable C++. The difference is about 4x when
we can use intrinsics and about 2x when we cannot.

This should speed up our Lemire's algorithm implementation nicely.
2024-04-03 13:28:25 +02:00
Martin Hořeňovský
f181de9df4
Use SizedUnsignedType_t to pick UnsignedType for uniform_integer_distribution
The previously used `make_unsigned` approach combined with the overload
set of `extendedMult` caused compilation issues on MacOS platform. By
forcing the selection to be one of `std::uintX_t` types we don't need
to complicate the overload set further.
2024-04-03 13:27:10 +02:00
Martin Hořeňovský
9271083a04
Merge pull request #2850 from jeremy-rifkin/jr/mention-succeed-in-loggingmd
Mention SUCCEED along with FAIL in logging.md
2024-03-30 15:59:43 +01:00
Jeremy
07701f946a
Mention SUCCEED along with FAIL in logging.md 2024-03-29 15:40:18 -05:00
Martin Hořeňovský
7ce3579976
Allow CATCH_CONFIG_DEFAULT_REPORTER to be arbitrary reporter spec
Previously it could be just plain reporter name, e.g. `xml`, but
it could not specify other reporter options. This change is not
particularly useful for the built-in reporters, as it mostly comes
in handy for combining specific custom reporter with custom arguments,
and the built-in reporters do not have those.
2024-03-27 10:03:51 +01:00
Martin Hořeňovský
c0dfe13bb6
Improve example for custom options in reporter spec 2024-03-26 23:28:48 +01:00
Martin Hořeňovský
cad65c5003
Fix insufficiently escaped backslash in docs 2024-03-26 23:23:15 +01:00
Martin Hořeňovský
ad99834c14
Add back g++ 5 and 6 to the CI builds
Previously these were removed in bbba3d8a06,
to allow Decomposer changes that were not compatible with old
GCCs. However, the compatibility was restored in
459ac8562b, and so we can restore
the builds again.
2024-03-26 18:11:01 +01:00
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