proxygen
testing::internal::TuplePrefix< N > Class Template Reference

#include <gmock-matchers.h>

Static Public Member Functions

template<typename MatcherTuple , typename ValueTuple >
static bool Matches (const MatcherTuple &matcher_tuple, const ValueTuple &value_tuple)
 
template<typename MatcherTuple , typename ValueTuple >
static void ExplainMatchFailuresTo (const MatcherTuple &matchers, const ValueTuple &values,::std::ostream *os)
 
template<typename MatcherTuple , typename ValueTuple >
static bool Matches (const MatcherTuple &matcher_tuple, const ValueTuple &value_tuple)
 
template<typename MatcherTuple , typename ValueTuple >
static void ExplainMatchFailuresTo (const MatcherTuple &matchers, const ValueTuple &values,::std::ostream *os)
 
template<typename MatcherTuple , typename ValueTuple >
static bool Matches (const MatcherTuple &matcher_tuple, const ValueTuple &value_tuple)
 
template<typename MatcherTuple , typename ValueTuple >
static void ExplainMatchFailuresTo (const MatcherTuple &matchers, const ValueTuple &values,::std::ostream *os)
 

Detailed Description

template<size_t N>
class testing::internal::TuplePrefix< N >

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

Member Function Documentation

template<size_t N>
template<typename MatcherTuple , typename ValueTuple >
static void testing::internal::TuplePrefix< N >::ExplainMatchFailuresTo ( const MatcherTuple matchers,
const ValueTuple &  values,
::std::ostream *  os 
)
inlinestatic

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

References testing::internal::PrintIfNotEmpty(), type, testing::internal::UniversalPrint(), value, testing::Value(), and values().

745  {
746  // First, describes failures in the first N - 1 fields.
748 
749  // Then describes the failure (if any) in the (N - 1)-th (0-based)
750  // field.
751  typename tuple_element<N - 1, MatcherTuple>::type matcher =
752  get<N - 1>(matchers);
753  typedef typename tuple_element<N - 1, ValueTuple>::type Value;
754  Value value = get<N - 1>(values);
755  StringMatchResultListener listener;
756  if (!matcher.MatchAndExplain(value, &listener)) {
757  // TODO(wan): include in the message the name of the parameter
758  // as used in MOCK_METHOD*() when possible.
759  *os << " Expected arg #" << N - 1 << ": ";
760  get<N - 1>(matchers).DescribeTo(os);
761  *os << "\n Actual: ";
762  // We remove the reference in type Value to prevent the
763  // universal printer from printing the address of value, which
764  // isn't interesting to the user most of the time. The
765  // matcher's MatchAndExplain() method handles the case when
766  // the address is interesting.
767  internal::UniversalPrint(value, os);
768  PrintIfNotEmpty(listener.str(), os);
769  *os << "\n";
770  }
771  }
static void ExplainMatchFailuresTo(const MatcherTuple &matchers, const ValueTuple &values,::std::ostream *os)
PskType type
bool Value(const T &value, M matcher)
void PrintIfNotEmpty(const internal::string &explanation,::std::ostream *os)
void UniversalPrint(const T &value,::std::ostream *os)
static const char *const value
Definition: Conv.cpp:50
std::vector< int > values(1'000)
template<size_t N>
template<typename MatcherTuple , typename ValueTuple >
static void testing::internal::TuplePrefix< N >::ExplainMatchFailuresTo ( const MatcherTuple matchers,
const ValueTuple &  values,
::std::ostream *  os 
)
inlinestatic

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

References testing::internal::PrintIfNotEmpty(), type, testing::internal::UniversalPrint(), testing::Value(), and values().

745  {
746  // First, describes failures in the first N - 1 fields.
748 
749  // Then describes the failure (if any) in the (N - 1)-th (0-based)
750  // field.
751  typename tuple_element<N - 1, MatcherTuple>::type matcher =
752  get<N - 1>(matchers);
753  typedef typename tuple_element<N - 1, ValueTuple>::type Value;
754  Value value = get<N - 1>(values);
755  StringMatchResultListener listener;
756  if (!matcher.MatchAndExplain(value, &listener)) {
757  // TODO(wan): include in the message the name of the parameter
758  // as used in MOCK_METHOD*() when possible.
759  *os << " Expected arg #" << N - 1 << ": ";
760  get<N - 1>(matchers).DescribeTo(os);
761  *os << "\n Actual: ";
762  // We remove the reference in type Value to prevent the
763  // universal printer from printing the address of value, which
764  // isn't interesting to the user most of the time. The
765  // matcher's MatchAndExplain() method handles the case when
766  // the address is interesting.
767  internal::UniversalPrint(value, os);
768  PrintIfNotEmpty(listener.str(), os);
769  *os << "\n";
770  }
771  }
static void ExplainMatchFailuresTo(const MatcherTuple &matchers, const ValueTuple &values,::std::ostream *os)
PskType type
bool Value(const T &value, M matcher)
void PrintIfNotEmpty(const internal::string &explanation,::std::ostream *os)
void UniversalPrint(const T &value,::std::ostream *os)
static const char *const value
Definition: Conv.cpp:50
std::vector< int > values(1'000)
template<size_t N>
template<typename MatcherTuple , typename ValueTuple >
static void testing::internal::TuplePrefix< N >::ExplainMatchFailuresTo ( const MatcherTuple matchers,
const ValueTuple &  values,
::std::ostream *  os 
)
inlinestatic

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

References testing::internal::PrintIfNotEmpty(), type, testing::internal::UniversalPrint(), testing::Value(), and values().

745  {
746  // First, describes failures in the first N - 1 fields.
748 
749  // Then describes the failure (if any) in the (N - 1)-th (0-based)
750  // field.
751  typename tuple_element<N - 1, MatcherTuple>::type matcher =
752  get<N - 1>(matchers);
753  typedef typename tuple_element<N - 1, ValueTuple>::type Value;
754  Value value = get<N - 1>(values);
755  StringMatchResultListener listener;
756  if (!matcher.MatchAndExplain(value, &listener)) {
757  // TODO(wan): include in the message the name of the parameter
758  // as used in MOCK_METHOD*() when possible.
759  *os << " Expected arg #" << N - 1 << ": ";
760  get<N - 1>(matchers).DescribeTo(os);
761  *os << "\n Actual: ";
762  // We remove the reference in type Value to prevent the
763  // universal printer from printing the address of value, which
764  // isn't interesting to the user most of the time. The
765  // matcher's MatchAndExplain() method handles the case when
766  // the address is interesting.
767  internal::UniversalPrint(value, os);
768  PrintIfNotEmpty(listener.str(), os);
769  *os << "\n";
770  }
771  }
static void ExplainMatchFailuresTo(const MatcherTuple &matchers, const ValueTuple &values,::std::ostream *os)
PskType type
bool Value(const T &value, M matcher)
void PrintIfNotEmpty(const internal::string &explanation,::std::ostream *os)
void UniversalPrint(const T &value,::std::ostream *os)
static const char *const value
Definition: Conv.cpp:50
std::vector< int > values(1'000)
template<size_t N>
template<typename MatcherTuple , typename ValueTuple >
static bool testing::internal::TuplePrefix< N >::Matches ( const MatcherTuple matcher_tuple,
const ValueTuple &  value_tuple 
)
inlinestatic

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

References testing::Matches().

733  {
734  return TuplePrefix<N - 1>::Matches(matcher_tuple, value_tuple)
735  && get<N - 1>(matcher_tuple).Matches(get<N - 1>(value_tuple));
736  }
static bool Matches(const MatcherTuple &matcher_tuple, const ValueTuple &value_tuple)
template<size_t N>
template<typename MatcherTuple , typename ValueTuple >
static bool testing::internal::TuplePrefix< N >::Matches ( const MatcherTuple matcher_tuple,
const ValueTuple &  value_tuple 
)
inlinestatic

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

References testing::Matches().

733  {
734  return TuplePrefix<N - 1>::Matches(matcher_tuple, value_tuple)
735  && get<N - 1>(matcher_tuple).Matches(get<N - 1>(value_tuple));
736  }
static bool Matches(const MatcherTuple &matcher_tuple, const ValueTuple &value_tuple)
template<size_t N>
template<typename MatcherTuple , typename ValueTuple >
static bool testing::internal::TuplePrefix< N >::Matches ( const MatcherTuple matcher_tuple,
const ValueTuple &  value_tuple 
)
inlinestatic

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

References testing::Matches().

733  {
734  return TuplePrefix<N - 1>::Matches(matcher_tuple, value_tuple)
735  && get<N - 1>(matcher_tuple).Matches(get<N - 1>(value_tuple));
736  }
static bool Matches(const MatcherTuple &matcher_tuple, const ValueTuple &value_tuple)

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