Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
testing::internal::PointwiseMatcher< TupleMatcher, RhsContainer >::Impl< LhsContainer > Class Template Reference

#include <gmock-matchers.h>

Inheritance diagram for testing::internal::PointwiseMatcher< TupleMatcher, RhsContainer >::Impl< LhsContainer >:
Collaboration diagram for testing::internal::PointwiseMatcher< TupleMatcher, RhsContainer >::Impl< LhsContainer >:

Public Types

typedef internal::StlContainerView< GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)> LhsView
 
typedef LhsView::type LhsStlContainer
 
typedef LhsView::const_reference LhsStlContainerReference
 
typedef LhsStlContainer::value_type LhsValue
 
typedef ::testing::tuple< const LhsValue &, const RhsValue & > InnerMatcherArg
 

Public Member Functions

 Impl (const TupleMatcher &tuple_matcher, const RhsStlContainer &rhs)
 
virtual void DescribeTo (::std::ostream *os) const
 
virtual void DescribeNegationTo (::std::ostream *os) const
 
virtual bool MatchAndExplain (LhsContainer lhs, MatchResultListener *listener) const
 
- Public Member Functions inherited from testing::MatcherInterface< LhsContainer >
- Public Member Functions inherited from testing::MatcherDescriberInterface
virtual ~MatcherDescriberInterface ()
 

Detailed Description

template<typename TupleMatcher, typename RhsContainer>
template<typename LhsContainer>
class testing::internal::PointwiseMatcher< TupleMatcher, RhsContainer >::Impl< LhsContainer >

Definition at line 3018 of file gmock-matchers.h.

Member Typedef Documentation

◆ InnerMatcherArg

template<typename TupleMatcher , typename RhsContainer >
template<typename LhsContainer >
::testing::tuple<const LhsValue&, const RhsValue&> testing::internal::PointwiseMatcher< TupleMatcher, RhsContainer >::Impl< LhsContainer >::InnerMatcherArg

Definition at line 3029 of file gmock-matchers.h.

◆ LhsStlContainer

template<typename TupleMatcher , typename RhsContainer >
template<typename LhsContainer >
LhsView::type testing::internal::PointwiseMatcher< TupleMatcher, RhsContainer >::Impl< LhsContainer >::LhsStlContainer

Definition at line 3022 of file gmock-matchers.h.

◆ LhsStlContainerReference

template<typename TupleMatcher , typename RhsContainer >
template<typename LhsContainer >
LhsView::const_reference testing::internal::PointwiseMatcher< TupleMatcher, RhsContainer >::Impl< LhsContainer >::LhsStlContainerReference

Definition at line 3023 of file gmock-matchers.h.

◆ LhsValue

template<typename TupleMatcher , typename RhsContainer >
template<typename LhsContainer >
LhsStlContainer::value_type testing::internal::PointwiseMatcher< TupleMatcher, RhsContainer >::Impl< LhsContainer >::LhsValue

Definition at line 3024 of file gmock-matchers.h.

◆ LhsView

template<typename TupleMatcher , typename RhsContainer >
template<typename LhsContainer >
internal::StlContainerView< GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)> testing::internal::PointwiseMatcher< TupleMatcher, RhsContainer >::Impl< LhsContainer >::LhsView

Definition at line 3021 of file gmock-matchers.h.

Constructor & Destructor Documentation

◆ Impl()

template<typename TupleMatcher , typename RhsContainer >
template<typename LhsContainer >
testing::internal::PointwiseMatcher< TupleMatcher, RhsContainer >::Impl< LhsContainer >::Impl ( const TupleMatcher & tuple_matcher,
const RhsStlContainer & rhs )
inline

Definition at line 3031 of file gmock-matchers.h.

3033 : mono_tuple_matcher_(SafeMatcherCast<InnerMatcherArg>(tuple_matcher)),
3034 rhs_(rhs) {}
Matcher< T > SafeMatcherCast(const M &polymorphic_matcher)

Member Function Documentation

◆ DescribeNegationTo()

template<typename TupleMatcher , typename RhsContainer >
template<typename LhsContainer >
virtual void testing::internal::PointwiseMatcher< TupleMatcher, RhsContainer >::Impl< LhsContainer >::DescribeNegationTo ( ::std::ostream * os) const
inlinevirtual

Reimplemented from testing::MatcherDescriberInterface.

Definition at line 3043 of file gmock-matchers.h.

3043 {
3044 *os << "doesn't contain exactly " << rhs_.size()
3045 << " values, or contains a value x at some index i"
3046 << " where x and the i-th value of ";
3047 UniversalPrint(rhs_, os);
3048 *os << " ";
3049 mono_tuple_matcher_.DescribeNegationTo(os);
3050 }
void DescribeNegationTo(::std::ostream *os) const
os_t os
void UniversalPrint(const T &value, ::std::ostream *os)
Here is the call graph for this function:

◆ DescribeTo()

template<typename TupleMatcher , typename RhsContainer >
template<typename LhsContainer >
virtual void testing::internal::PointwiseMatcher< TupleMatcher, RhsContainer >::Impl< LhsContainer >::DescribeTo ( ::std::ostream * os) const
inlinevirtual

Implements testing::MatcherDescriberInterface.

Definition at line 3036 of file gmock-matchers.h.

3036 {
3037 *os << "contains " << rhs_.size()
3038 << " values, where each value and its corresponding value in ";
3040 *os << " ";
3041 mono_tuple_matcher_.DescribeTo(os);
3042 }
void DescribeTo(::std::ostream *os) const
static void Print(const T &value, ::std::ostream *os)
Here is the call graph for this function:

◆ MatchAndExplain()

template<typename TupleMatcher , typename RhsContainer >
template<typename LhsContainer >
virtual bool testing::internal::PointwiseMatcher< TupleMatcher, RhsContainer >::Impl< LhsContainer >::MatchAndExplain ( LhsContainer lhs,
MatchResultListener * listener ) const
inlinevirtual

Implements testing::MatcherInterface< LhsContainer >.

Definition at line 3052 of file gmock-matchers.h.

3053 {
3054 LhsStlContainerReference lhs_stl_container = LhsView::ConstReference(lhs);
3055 const size_t actual_size = lhs_stl_container.size();
3056 if (actual_size != rhs_.size()) {
3057 *listener << "which contains " << actual_size << " values";
3058 return false;
3059 }
3060
3061 typename LhsStlContainer::const_iterator left = lhs_stl_container.begin();
3062 typename RhsStlContainer::const_iterator right = rhs_.begin();
3063 for (size_t i = 0; i != actual_size; ++i, ++left, ++right) {
3064 if (listener->IsInterested()) {
3065 StringMatchResultListener inner_listener;
3066 // Create InnerMatcherArg as a temporarily object to avoid it outlives
3067 // *left and *right. Dereference or the conversion to `const T&` may
3068 // return temp objects, e.g for vector<bool>.
3069 if (!mono_tuple_matcher_.MatchAndExplain(
3072 &inner_listener)) {
3073 *listener << "where the value pair (";
3074 UniversalPrint(*left, listener->stream());
3075 *listener << ", ";
3076 UniversalPrint(*right, listener->stream());
3077 *listener << ") at index #" << i << " don't match";
3078 PrintIfNotEmpty(inner_listener.str(), listener->stream());
3079 return false;
3080 }
3081 } else {
3082 if (!mono_tuple_matcher_.Matches(
3085 return false;
3086 }
3087 }
3088
3089 return true;
3090 }
bool MatchAndExplain(GTEST_REFERENCE_TO_CONST_(T) x, MatchResultListener *listener) const
bool Matches(GTEST_REFERENCE_TO_CONST_(T) x) const
LhsView::const_reference LhsStlContainerReference
::testing::tuple< const LhsValue &, const RhsValue & > InnerMatcherArg
static const_reference ConstReference(const RawContainer &container)
To ImplicitCast_(To x)
void PrintIfNotEmpty(const std::string &explanation, ::std::ostream *os)
Here is the call graph for this function:

The documentation for this class was generated from the following file: