proxygen
testing::internal::PredicateFormatterFromMatcher< M > Class Template Reference

#include <gmock-matchers.h>

Public Member Functions

 PredicateFormatterFromMatcher (M m)
 
template<typename T >
AssertionResult operator() (const char *value_text, const T &x) const
 
 PredicateFormatterFromMatcher (M m)
 
template<typename T >
AssertionResult operator() (const char *value_text, const T &x) const
 
 PredicateFormatterFromMatcher (M m)
 
template<typename T >
AssertionResult operator() (const char *value_text, const T &x) const
 

Private Member Functions

 GTEST_DISALLOW_ASSIGN_ (PredicateFormatterFromMatcher)
 
 GTEST_DISALLOW_ASSIGN_ (PredicateFormatterFromMatcher)
 
 GTEST_DISALLOW_ASSIGN_ (PredicateFormatterFromMatcher)
 

Private Attributes

const M matcher_
 

Detailed Description

template<typename M>
class testing::internal::PredicateFormatterFromMatcher< M >

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

Constructor & Destructor Documentation

template<typename M >
testing::internal::PredicateFormatterFromMatcher< M >::PredicateFormatterFromMatcher ( M  m)
inlineexplicit

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

1836 : matcher_(internal::move(m)) {}
static map< string, int > m
const T & move(const T &t)
Definition: gtest-port.h:1317
template<typename M >
testing::internal::PredicateFormatterFromMatcher< M >::PredicateFormatterFromMatcher ( M  m)
inlineexplicit

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

1836 : matcher_(internal::move(m)) {}
static map< string, int > m
const T & move(const T &t)
Definition: gtest-port.h:1317
template<typename M >
testing::internal::PredicateFormatterFromMatcher< M >::PredicateFormatterFromMatcher ( M  m)
inlineexplicit

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

1836 : matcher_(internal::move(m)) {}
static map< string, int > m
const T & move(const T &t)
Definition: gtest-port.h:1317

Member Function Documentation

template<typename M >
testing::internal::PredicateFormatterFromMatcher< M >::GTEST_DISALLOW_ASSIGN_ ( PredicateFormatterFromMatcher< M )
private
template<typename M >
testing::internal::PredicateFormatterFromMatcher< M >::GTEST_DISALLOW_ASSIGN_ ( PredicateFormatterFromMatcher< M )
private
template<typename M >
testing::internal::PredicateFormatterFromMatcher< M >::GTEST_DISALLOW_ASSIGN_ ( PredicateFormatterFromMatcher< M )
private
template<typename M >
template<typename T >
AssertionResult testing::internal::PredicateFormatterFromMatcher< M >::operator() ( const char *  value_text,
const T x 
) const
inline

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

References testing::AssertionFailure(), testing::AssertionSuccess(), testing::internal::MatcherBase< T >::DescribeTo(), and testing::internal::MatchPrintAndExplain().

1842  {
1843  // We convert matcher_ to a Matcher<const T&> *now* instead of
1844  // when the PredicateFormatterFromMatcher object was constructed,
1845  // as matcher_ may be polymorphic (e.g. NotNull()) and we won't
1846  // know which type to instantiate it to until we actually see the
1847  // type of x here.
1848  //
1849  // We write SafeMatcherCast<const T&>(matcher_) instead of
1850  // Matcher<const T&>(matcher_), as the latter won't compile when
1851  // matcher_ has type Matcher<T> (e.g. An<int>()).
1852  // We don't write MatcherCast<const T&> either, as that allows
1853  // potentially unsafe downcasting of the matcher argument.
1854  const Matcher<const T&> matcher = SafeMatcherCast<const T&>(matcher_);
1855  StringMatchResultListener listener;
1856  if (MatchPrintAndExplain(x, matcher, &listener))
1857  return AssertionSuccess();
1858 
1859  ::std::stringstream ss;
1860  ss << "Value of: " << value_text << "\n"
1861  << "Expected: ";
1862  matcher.DescribeTo(&ss);
1863  ss << "\n Actual: " << listener.str();
1864  return AssertionFailure() << ss.str();
1865  }
Definition: InvokeTest.cpp:58
GTEST_API_ AssertionResult AssertionFailure()
Definition: gtest.cc:1015
bool MatchPrintAndExplain(Value &value, const Matcher< T > &matcher, MatchResultListener *listener)
GTEST_API_ AssertionResult AssertionSuccess()
Definition: gtest.cc:1010
template<typename M >
template<typename T >
AssertionResult testing::internal::PredicateFormatterFromMatcher< M >::operator() ( const char *  value_text,
const T x 
) const
inline

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

References testing::AssertionFailure(), testing::AssertionSuccess(), testing::internal::MatcherBase< T >::DescribeTo(), GTEST_DISALLOW_ASSIGN_, M, testing::internal::MakePredicateFormatterFromMatcher(), testing::internal::MatchPrintAndExplain(), and testing::internal::move().

1842  {
1843  // We convert matcher_ to a Matcher<const T&> *now* instead of
1844  // when the PredicateFormatterFromMatcher object was constructed,
1845  // as matcher_ may be polymorphic (e.g. NotNull()) and we won't
1846  // know which type to instantiate it to until we actually see the
1847  // type of x here.
1848  //
1849  // We write SafeMatcherCast<const T&>(matcher_) instead of
1850  // Matcher<const T&>(matcher_), as the latter won't compile when
1851  // matcher_ has type Matcher<T> (e.g. An<int>()).
1852  // We don't write MatcherCast<const T&> either, as that allows
1853  // potentially unsafe downcasting of the matcher argument.
1854  const Matcher<const T&> matcher = SafeMatcherCast<const T&>(matcher_);
1855  StringMatchResultListener listener;
1856  if (MatchPrintAndExplain(x, matcher, &listener))
1857  return AssertionSuccess();
1858 
1859  ::std::stringstream ss;
1860  ss << "Value of: " << value_text << "\n"
1861  << "Expected: ";
1862  matcher.DescribeTo(&ss);
1863  ss << "\n Actual: " << listener.str();
1864  return AssertionFailure() << ss.str();
1865  }
Definition: InvokeTest.cpp:58
GTEST_API_ AssertionResult AssertionFailure()
Definition: gtest.cc:1015
bool MatchPrintAndExplain(Value &value, const Matcher< T > &matcher, MatchResultListener *listener)
GTEST_API_ AssertionResult AssertionSuccess()
Definition: gtest.cc:1010
template<typename M >
template<typename T >
AssertionResult testing::internal::PredicateFormatterFromMatcher< M >::operator() ( const char *  value_text,
const T x 
) const
inline

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

References testing::AssertionFailure(), testing::AssertionSuccess(), testing::internal::MatcherBase< T >::DescribeTo(), GTEST_DISALLOW_ASSIGN_, M, testing::internal::MakePredicateFormatterFromMatcher(), testing::internal::MatchPrintAndExplain(), and testing::internal::move().

1842  {
1843  // We convert matcher_ to a Matcher<const T&> *now* instead of
1844  // when the PredicateFormatterFromMatcher object was constructed,
1845  // as matcher_ may be polymorphic (e.g. NotNull()) and we won't
1846  // know which type to instantiate it to until we actually see the
1847  // type of x here.
1848  //
1849  // We write SafeMatcherCast<const T&>(matcher_) instead of
1850  // Matcher<const T&>(matcher_), as the latter won't compile when
1851  // matcher_ has type Matcher<T> (e.g. An<int>()).
1852  // We don't write MatcherCast<const T&> either, as that allows
1853  // potentially unsafe downcasting of the matcher argument.
1854  const Matcher<const T&> matcher = SafeMatcherCast<const T&>(matcher_);
1855  StringMatchResultListener listener;
1856  if (MatchPrintAndExplain(x, matcher, &listener))
1857  return AssertionSuccess();
1858 
1859  ::std::stringstream ss;
1860  ss << "Value of: " << value_text << "\n"
1861  << "Expected: ";
1862  matcher.DescribeTo(&ss);
1863  ss << "\n Actual: " << listener.str();
1864  return AssertionFailure() << ss.str();
1865  }
Definition: InvokeTest.cpp:58
GTEST_API_ AssertionResult AssertionFailure()
Definition: gtest.cc:1015
bool MatchPrintAndExplain(Value &value, const Matcher< T > &matcher, MatchResultListener *listener)
GTEST_API_ AssertionResult AssertionSuccess()
Definition: gtest.cc:1010

Member Data Documentation

template<typename M >
const M testing::internal::PredicateFormatterFromMatcher< M >::matcher_
private

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


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