Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

v3.2.1

Commit
ab6c7375be9a8e71ee84c6f8537113f9f47daf99
Author
Martin Hořeňovský ·
Parents
24607694cba4

Files · Download .tar.gz

Changes

 CMakeLists.txt                      |   2 +-
 docs/release-notes.md               |   8 ++
 extras/catch_amalgamated.cpp        |   6 +-
 extras/catch_amalgamated.hpp        | 237 ++++++++++++++++++++----------------
 meson.build                         |   2 +-
 src/catch2/catch_version.cpp        |   2 +-
 src/catch2/catch_version_macros.hpp |   2 +-
 7 files changed, 149 insertions(+), 110 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a9b4ca72..d5a6b67a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,7 +31,7 @@ if (CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
 endif()
 
 project(Catch2
-  VERSION 3.2.0 # CML version placeholder, don't delete
+  VERSION 3.2.1 # CML version placeholder, don't delete
   LANGUAGES CXX
   # HOMEPAGE_URL is not supported until CMake version 3.12, which
   # we do not target yet.
diff --git a/docs/release-notes.md b/docs/release-notes.md
index f83721e3..7659404b 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -2,6 +2,7 @@
 
 # Release notes
 **Contents**<br>
+[3.2.1](#321)<br>
 [3.2.0](#320)<br>
 [3.1.1](#311)<br>
 [3.1.0](#310)<br>
@@ -53,6 +54,13 @@
 
 
 
+## 3.2.1
+
+### Improvements
+* Fix the reworked decomposer to work with older (pre 9) GCC versions (#2571)
+  * **This required more significant changes to properly support C++20, there might be bugs.**
+
+
 ## 3.2.0
 
 ### Improvements
diff --git a/extras/catch_amalgamated.cpp b/extras/catch_amalgamated.cpp
index f2437d19..b27c4ec8 100644
--- a/extras/catch_amalgamated.cpp
+++ b/extras/catch_amalgamated.cpp
@@ -5,8 +5,8 @@
 
 // SPDX-License-Identifier: BSL-1.0
 
-//  Catch v3.2.0
-//  Generated: 2022-11-16 19:30:16.114602
+//  Catch v3.2.1
+//  Generated: 2022-12-09 23:01:15.713081
 //  ----------------------------------------------------------
 //  This file is an amalgamation of multiple different files.
 //  You probably shouldn't edit it directly.
@@ -2012,7 +2012,7 @@ namespace Catch {
     }
 
     Version const& libraryVersion() {
-        static Version version( 3, 2, 0, "", 0 );
+        static Version version( 3, 2, 1, "", 0 );
         return version;
     }
 
diff --git a/extras/catch_amalgamated.hpp b/extras/catch_amalgamated.hpp
index b2e002fc..e91734a4 100644
--- a/extras/catch_amalgamated.hpp
+++ b/extras/catch_amalgamated.hpp
@@ -5,8 +5,8 @@
 
 // SPDX-License-Identifier: BSL-1.0
 
-//  Catch v3.2.0
-//  Generated: 2022-11-16 19:30:14.116909
+//  Catch v3.2.1
+//  Generated: 2022-12-09 23:01:14.526666
 //  ----------------------------------------------------------
 //  This file is an amalgamation of multiple different files.
 //  You probably shouldn't edit it directly.
@@ -1759,10 +1759,9 @@ namespace Catch {
 #include <type_traits>
 
 namespace Catch {
-    template<typename T>
-    struct always_false : std::false_type {};
+    template <typename>
+    struct true_given : std::true_type {};
 
-    template <typename> struct true_given : std::true_type {};
     struct is_callable_tester {
         template <typename Fun, typename... Args>
         static true_given<decltype(std::declval<Fun>()(std::declval<Args>()...))> test(int);
@@ -5393,6 +5392,13 @@ namespace Catch {
 #    pragma GCC diagnostic ignored "-Wfloat-equal"
 #endif
 
+#if defined( __clang__ )
+#    pragma clang diagnostic push
+    // Did you know that comparing floats with `0` directly
+    // is super-duper dangerous in unevaluated context?
+#    pragma clang diagnostic ignored "-Wfloat-equal"
+#endif
+
 #define CATCH_DEFINE_COMPARABLE_TRAIT( id, op )                               \
     template <typename, typename, typename = void>                            \
     struct is_##id##_comparable : std::false_type {};                         \
@@ -5421,6 +5427,9 @@ namespace Catch {
 
 #if defined( __GNUC__ ) && !defined( __clang__ )
 #    pragma GCC diagnostic pop
+#endif
+#if defined( __clang__ )
+#    pragma clang diagnostic pop
 #endif
 
 
@@ -5429,6 +5438,45 @@ namespace Catch {
 
 #endif // CATCH_COMPARE_TRAITS_HPP_INCLUDED
 
+
+#ifndef CATCH_LOGICAL_TRAITS_HPP_INCLUDED
+#define CATCH_LOGICAL_TRAITS_HPP_INCLUDED
+
+#include <type_traits>
+
+namespace Catch {
+namespace Detail {
+
+#if defined( __cpp_lib_logical_traits ) && __cpp_lib_logical_traits >= 201510
+
+    using std::conjunction;
+    using std::disjunction;
+    using std::negation;
+
+#else
+
+    template <class...> struct conjunction : std::true_type {};
+    template <class B1> struct conjunction<B1> : B1 {};
+    template <class B1, class... Bn>
+    struct conjunction<B1, Bn...>
+        : std::conditional_t<bool( B1::value ), conjunction<Bn...>, B1> {};
+
+    template <class...> struct disjunction : std::false_type {};
+    template <class B1> struct disjunction<B1> : B1 {};
+    template <class B1, class... Bn>
+    struct disjunction<B1, Bn...>
+        : std::conditional_t<bool( B1::value ), B1, disjunction<Bn...>> {};
+
+    template <class B>
+    struct negation : std::integral_constant<bool, !bool(B::value)> {};
+
+#endif
+
+} // namespace Detail
+} // namespace Catch
+
+#endif // CATCH_LOGICAL_TRAITS_HPP_INCLUDED
+
 #include <type_traits>
 #include <iosfwd>
 
@@ -5451,6 +5499,9 @@ namespace Catch {
 
 namespace Catch {
 
+    template <typename T>
+    struct always_false : std::false_type {};
+
     class ITransientExpression {
         bool m_isBinaryExpression;
         bool m_result;
@@ -5580,112 +5631,99 @@ namespace Catch {
         explicit ExprLhs( LhsT lhs ) : m_lhs( lhs ) {}
 
 #define CATCH_INTERNAL_DEFINE_EXPRESSION_EQUALITY_OPERATOR( id, op )           \
-    template <                                                                 \
-        typename RhsT,                                                         \
-        std::enable_if_t<                                                      \
-            Detail::is_##id##_comparable<LhsT, RhsT>::value &&                 \
-                !std::is_arithmetic<std::remove_reference_t<RhsT>>::value,     \
-            int> = 0>                                                          \
+    template <typename RhsT>                                                   \
     friend auto operator op( ExprLhs&& lhs, RhsT&& rhs )                       \
-        ->BinaryExpr<LhsT, RhsT const&> {                                      \
+        ->std::enable_if_t<                                                    \
+            Detail::conjunction<Detail::is_##id##_comparable<LhsT, RhsT>,      \
+                                Detail::negation<std::is_arithmetic<           \
+                                    std::remove_reference_t<RhsT>>>>::value,   \
+            BinaryExpr<LhsT, RhsT const&>> {                                   \
         return {                                                               \
             static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
     }                                                                          \
-    template <                                                                 \
-        typename RhsT,                                                         \
-        std::enable_if_t<Detail::is_##id##_comparable<LhsT, RhsT>::value &&    \
-                             std::is_arithmetic<RhsT>::value,                  \
-                         int> = 0>                                             \
+    template <typename RhsT>                                                   \
     friend auto operator op( ExprLhs&& lhs, RhsT rhs )                         \
-        ->BinaryExpr<LhsT, RhsT> {                                             \
+        ->std::enable_if_t<                                                    \
+            Detail::conjunction<Detail::is_##id##_comparable<LhsT, RhsT>,      \
+                                std::is_arithmetic<RhsT>>::value,              \
+            BinaryExpr<LhsT, RhsT>> {                                          \
         return {                                                               \
             static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
     }                                                                          \
-    template <                                                                 \
-        typename RhsT,                                                         \
-        std::enable_if_t<!Detail::is_##id##_comparable<LhsT, RhsT>::value &&   \
-                             Detail::is_eq_0_comparable<LhsT>::                \
-                                 value && /* We allow long because we want     \
-                                             `ptr op NULL to be accepted */    \
-                             ( std::is_same<RhsT, int>::value ||               \
-                               std::is_same<RhsT, long>::value ),              \
-                         int> = 0>                                             \
+    template <typename RhsT>                                                   \
     friend auto operator op( ExprLhs&& lhs, RhsT rhs )                         \
-        ->BinaryExpr<LhsT, RhsT> {                                             \
-        if ( rhs != 0 ) {                                                      \
-            throw_test_failure_exception();                                    \
-        }                                                                      \
+        ->std::enable_if_t<                                                    \
+            Detail::conjunction<                                               \
+                Detail::negation<Detail::is_##id##_comparable<LhsT, RhsT>>,    \
+                Detail::is_eq_0_comparable<LhsT>,                              \
+              /* We allow long because we want `ptr op NULL` to be accepted */ \
+                Detail::disjunction<std::is_same<RhsT, int>,                   \
+                                    std::is_same<RhsT, long>>>::value,         \
+            BinaryExpr<LhsT, RhsT>> {                                          \
+        if ( rhs != 0 ) { throw_test_failure_exception(); }                    \
         return {                                                               \
             static_cast<bool>( lhs.m_lhs op 0 ), lhs.m_lhs, #op##_sr, rhs };   \
     }                                                                          \
-    template <                                                                 \
-        typename RhsT,                                                         \
-        std::enable_if_t<!Detail::is_##id##_comparable<LhsT, RhsT>::value &&   \
-                             Detail::is_eq_0_comparable<RhsT>::                \
-                                 value && /* We allow long because we want     \
-                                             `ptr op NULL` to be accepted */   \
-                             ( std::is_same<LhsT, int>::value ||               \
-                               std::is_same<LhsT, long>::value ),              \
-                         int> = 0>                                             \
+    template <typename RhsT>                                                   \
     friend auto operator op( ExprLhs&& lhs, RhsT rhs )                         \
-        ->BinaryExpr<LhsT, RhsT> {                                             \
-        if ( lhs.m_lhs != 0 ) {                                                \
-            throw_test_failure_exception();                                    \
-        }                                                                      \
+        ->std::enable_if_t<                                                    \
+            Detail::conjunction<                                               \
+                Detail::negation<Detail::is_##id##_comparable<LhsT, RhsT>>,    \
+                Detail::is_eq_0_comparable<RhsT>,                              \
+              /* We allow long because we want `ptr op NULL` to be accepted */ \
+                Detail::disjunction<std::is_same<LhsT, int>,                   \
+                                    std::is_same<LhsT, long>>>::value,         \
+            BinaryExpr<LhsT, RhsT>> {                                          \
+        if ( lhs.m_lhs != 0 ) { throw_test_failure_exception(); }              \
         return { static_cast<bool>( 0 op rhs ), lhs.m_lhs, #op##_sr, rhs };    \
     }
+
         CATCH_INTERNAL_DEFINE_EXPRESSION_EQUALITY_OPERATOR( eq, == )
         CATCH_INTERNAL_DEFINE_EXPRESSION_EQUALITY_OPERATOR( ne, != )
 
     #undef CATCH_INTERNAL_DEFINE_EXPRESSION_EQUALITY_OPERATOR
 
-    #define CATCH_INTERNAL_DEFINE_EXPRESSION_COMPARISON_OPERATOR( id, op )     \
-    template <                                                                 \
-        typename RhsT,                                                         \
-        std::enable_if_t<                                                      \
-            Detail::is_##id##_comparable<LhsT, RhsT>::value &&                 \
-                !std::is_arithmetic<std::remove_reference_t<RhsT>>::value,     \
-            int> = 0>                                                          \
+#define CATCH_INTERNAL_DEFINE_EXPRESSION_COMPARISON_OPERATOR( id, op )         \
+    template <typename RhsT>                                                   \
     friend auto operator op( ExprLhs&& lhs, RhsT&& rhs )                       \
-        ->BinaryExpr<LhsT, RhsT const&> {                                      \
+        ->std::enable_if_t<                                                    \
+            Detail::conjunction<Detail::is_##id##_comparable<LhsT, RhsT>,      \
+                                Detail::negation<std::is_arithmetic<           \
+                                    std::remove_reference_t<RhsT>>>>::value,   \
+            BinaryExpr<LhsT, RhsT const&>> {                                   \
         return {                                                               \
             static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
     }                                                                          \
-    template <                                                                 \
-        typename RhsT,                                                         \
-        std::enable_if_t<Detail::is_##id##_comparable<LhsT, RhsT>::value &&    \
-                             std::is_arithmetic<RhsT>::value,                  \
-                         int> = 0>                                             \
+    template <typename RhsT>                                                   \
     friend auto operator op( ExprLhs&& lhs, RhsT rhs )                         \
-        ->BinaryExpr<LhsT, RhsT> {                                             \
+        ->std::enable_if_t<                                                    \
+            Detail::conjunction<Detail::is_##id##_comparable<LhsT, RhsT>,      \
+                                std::is_arithmetic<RhsT>>::value,              \
+            BinaryExpr<LhsT, RhsT>> {                                          \
         return {                                                               \
             static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
     }                                                                          \
-    template <                                                                 \
-        typename RhsT,                                                         \
-        std::enable_if_t<!Detail::is_##id##_comparable<LhsT, RhsT>::value &&   \
-                             Detail::is_##id##_0_comparable<LhsT>::value &&    \
-                             std::is_same<RhsT, int>::value,                   \
-                         int> = 0>                                             \
+    template <typename RhsT>                                                   \
     friend auto operator op( ExprLhs&& lhs, RhsT rhs )                         \
-        ->BinaryExpr<LhsT, RhsT> {                                             \
-        if ( rhs != 0 ) {                                                      \
-            throw_test_failure_exception();                                    \
-        }                                                                      \
+        ->std::enable_if_t<                                                    \
+            Detail::conjunction<                                               \
+                Detail::negation<Detail::is_##id##_comparable<LhsT, RhsT>>,    \
+                Detail::is_##id##_0_comparable<LhsT>,                          \
+                std::is_same<RhsT, int>>::value,                               \
+            BinaryExpr<LhsT, RhsT>> {                                          \
+        if ( rhs != 0 ) { throw_test_failure_exception(); }                    \
         return {                                                               \
             static_cast<bool>( lhs.m_lhs op 0 ), lhs.m_lhs, #op##_sr, rhs };   \
     }                                                                          \
-    template <                                                                 \
-        typename RhsT,                                                         \
-        std::enable_if_t<!Detail::is_##id##_comparable<LhsT, RhsT>::value &&   \
-                             Detail::is_##id##_0_comparable<RhsT>::value &&    \
-                             std::is_same<LhsT, int>::value,                   \
-                         int> = 0>                                             \
+    template <typename RhsT>                                                   \
     friend auto operator op( ExprLhs&& lhs, RhsT rhs )                         \
-        ->BinaryExpr<LhsT, RhsT> {                                             \
-        if ( lhs.m_lhs != 0 ) {                                                \
-            throw_test_failure_exception();                                    \
-        }                                                                      \
+        ->std::enable_if_t<                                                    \
+            Detail::conjunction<                                               \
+                Detail::negation<Detail::is_##id##_comparable<LhsT, RhsT>>,    \
+                Detail::is_##id##_0_comparable<RhsT>,                          \
+                std::is_same<LhsT, int>>::value,                               \
+            BinaryExpr<LhsT, RhsT>> {                                          \
+        if ( lhs.m_lhs != 0 ) { throw_test_failure_exception(); }              \
         return { static_cast<bool>( 0 op rhs ), lhs.m_lhs, #op##_sr, rhs };    \
     }
 
@@ -5697,15 +5735,22 @@ namespace Catch {
     #undef CATCH_INTERNAL_DEFINE_EXPRESSION_COMPARISON_OPERATOR
 
 
-    #define CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(op) \
-        template<typename RhsT, std::enable_if_t<!std::is_arithmetic<std::remove_reference_t<RhsT>>::value, int> = 0> \
-        friend auto operator op ( ExprLhs && lhs, RhsT && rhs ) -> BinaryExpr<LhsT, RhsT const&> { \
-            return { static_cast<bool>(lhs.m_lhs op rhs), lhs.m_lhs, #op##_sr, rhs }; \
-        } \
-        template<typename RhsT, std::enable_if_t<std::is_arithmetic<RhsT>::value, int> = 0> \
-        friend auto operator op ( ExprLhs && lhs, RhsT rhs ) -> BinaryExpr<LhsT, RhsT> { \
-            return { static_cast<bool>(lhs.m_lhs op rhs), lhs.m_lhs, #op##_sr, rhs }; \
-        }
+#define CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR( op )                        \
+    template <typename RhsT>                                                   \
+    friend auto operator op( ExprLhs&& lhs, RhsT&& rhs )                       \
+        ->std::enable_if_t<                                                    \
+            !std::is_arithmetic<std::remove_reference_t<RhsT>>::value,         \
+            BinaryExpr<LhsT, RhsT const&>> {                                   \
+        return {                                                               \
+            static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
+    }                                                                          \
+    template <typename RhsT>                                                   \
+    friend auto operator op( ExprLhs&& lhs, RhsT rhs )                         \
+        ->std::enable_if_t<std::is_arithmetic<RhsT>::value,                    \
+                           BinaryExpr<LhsT, RhsT>> {                           \
+        return {                                                               \
+            static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \
+    }
 
         CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(|)
         CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(&)
@@ -7313,7 +7358,7 @@ namespace Catch {
 
 #define CATCH_VERSION_MAJOR 3
 #define CATCH_VERSION_MINOR 2
-#define CATCH_VERSION_PATCH 0
+#define CATCH_VERSION_PATCH 1
 
 #endif // CATCH_VERSION_MACROS_HPP_INCLUDED
 
@@ -10479,20 +10524,6 @@ namespace Matchers {
             return arr;
         }
 
-#if defined( __cpp_lib_logical_traits ) && __cpp_lib_logical_traits >= 201510
-
-        using std::conjunction;
-
-#else // __cpp_lib_logical_traits
-
-        template<typename... Cond>
-        struct conjunction : std::true_type {};
-
-        template<typename Cond, typename... Rest>
-        struct conjunction<Cond, Rest...> : std::integral_constant<bool, Cond::value && conjunction<Rest...>::value> {};
-
-#endif // __cpp_lib_logical_traits
-
         template<typename T>
         using is_generic_matcher = std::is_base_of<
             Catch::Matchers::MatcherGenericBase,
@@ -10500,7 +10531,7 @@ namespace Matchers {
         >;
 
         template<typename... Ts>
-        using are_generic_matchers = conjunction<is_generic_matcher<Ts>...>;
+        using are_generic_matchers = Catch::Detail::conjunction<is_generic_matcher<Ts>...>;
 
         template<typename T>
         using is_matcher = std::is_base_of<
diff --git a/meson.build b/meson.build
index 230e24bd..0cab573e 100644
--- a/meson.build
+++ b/meson.build
@@ -8,7 +8,7 @@
 project(
   'catch2',
   'cpp',
-  version: '3.2.0', # CML version placeholder, don't delete
+  version: '3.2.1', # CML version placeholder, don't delete
   license: 'BSL-1.0',
   meson_version: '>=0.50.0',
 )
diff --git a/src/catch2/catch_version.cpp b/src/catch2/catch_version.cpp
index 027f0f41..b6b818a0 100644
--- a/src/catch2/catch_version.cpp
+++ b/src/catch2/catch_version.cpp
@@ -36,7 +36,7 @@ namespace Catch {
     }
 
     Version const& libraryVersion() {
-        static Version version( 3, 2, 0, "", 0 );
+        static Version version( 3, 2, 1, "", 0 );
         return version;
     }
 
diff --git a/src/catch2/catch_version_macros.hpp b/src/catch2/catch_version_macros.hpp
index 36185fc6..f61d999d 100644
--- a/src/catch2/catch_version_macros.hpp
+++ b/src/catch2/catch_version_macros.hpp
@@ -10,6 +10,6 @@
 
 #define CATCH_VERSION_MAJOR 3
 #define CATCH_VERSION_MINOR 2
-#define CATCH_VERSION_PATCH 0
+#define CATCH_VERSION_PATCH 1
 
 #endif // CATCH_VERSION_MACROS_HPP_INCLUDED