Skip to content

Commit

Permalink
Merge branch 'catchorg:devel' into feature/MessageMatches
Browse files Browse the repository at this point in the history
  • Loading branch information
lbckmnn authored Nov 22, 2022
2 parents e2a3a1a + 2d7be1f commit fd2188c
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 16 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/linux-simple-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,22 @@ jobs:
build_type: Release
std: 17
other_pkgs: clang-10
- cxx: clang++-10
build_type: Debug
std: 20
other_pkgs: clang-10
- cxx: clang++-10
build_type: Release
std: 20
other_pkgs: clang-10
- cxx: g++-10
build_type: Debug
std: 20
other_pkgs: g++-10
- cxx: g++-10
build_type: Release
std: 20
other_pkgs: g++-10

steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<a id="top"></a>
![Catch2 logo](data/artwork/catch2-logo-small.png)
![Catch2 logo](data/artwork/catch2-logo-small-with-background.png)

[![Github Releases](https://img.shields.io/github/release/catchorg/catch2.svg)](https://github.com/catchorg/catch2/releases)
[![Linux build status](https://github.com/catchorg/Catch2/actions/workflows/linux-simple-builds.yml/badge.svg)](https://github.com/catchorg/Catch2/actions/workflows/linux-simple-builds.yml)
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ set(IMPL_HEADERS
${SOURCES_DIR}/internal/catch_lazy_expr.hpp
${SOURCES_DIR}/internal/catch_leak_detector.hpp
${SOURCES_DIR}/internal/catch_list.hpp
${SOURCES_DIR}/internal/catch_logical_traits.hpp
${SOURCES_DIR}/internal/catch_message_info.hpp
${SOURCES_DIR}/internal/catch_meta.hpp
${SOURCES_DIR}/internal/catch_move_and_forward.hpp
Expand Down
1 change: 1 addition & 0 deletions src/catch2/catch_all.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
#include <catch2/internal/catch_lazy_expr.hpp>
#include <catch2/internal/catch_leak_detector.hpp>
#include <catch2/internal/catch_list.hpp>
#include <catch2/internal/catch_logical_traits.hpp>
#include <catch2/internal/catch_message_info.hpp>
#include <catch2/internal/catch_meta.hpp>
#include <catch2/internal/catch_move_and_forward.hpp>
Expand Down
44 changes: 44 additions & 0 deletions src/catch2/internal/catch_logical_traits.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

// Copyright Catch2 Authors
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)

// SPDX-License-Identifier: BSL-1.0
#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
17 changes: 2 additions & 15 deletions src/catch2/matchers/catch_matchers_templated.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <catch2/matchers/catch_matchers.hpp>
#include <catch2/internal/catch_stringref.hpp>
#include <catch2/internal/catch_move_and_forward.hpp>
#include <catch2/internal/catch_logical_traits.hpp>

#include <array>
#include <algorithm>
Expand Down Expand Up @@ -56,28 +57,14 @@ 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,
std::remove_cv_t<std::remove_reference_t<T>>
>;

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<
Expand Down
1 change: 1 addition & 0 deletions src/catch2/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ internal_headers = [
'internal/catch_lazy_expr.hpp',
'internal/catch_leak_detector.hpp',
'internal/catch_list.hpp',
'internal/catch_logical_traits.hpp',
'internal/catch_message_info.hpp',
'internal/catch_meta.hpp',
'internal/catch_move_and_forward.hpp',
Expand Down

0 comments on commit fd2188c

Please sign in to comment.