Electroneum
Loading...
Searching...
No Matches
testing::internal::ContainerEqMatcher< Container > Class Template Reference

#include <gmock-matchers.h>

Public Types

typedef internal::StlContainerView< Container > View
typedef View::type StlContainer
typedef View::const_reference StlContainerReference

Public Member Functions

 ContainerEqMatcher (const Container &expected)
void DescribeTo (::std::ostream *os) const
void DescribeNegationTo (::std::ostream *os) const
template<typename LhsContainer>
bool MatchAndExplain (const LhsContainer &lhs, MatchResultListener *listener) const

Detailed Description

template<typename Container>
class testing::internal::ContainerEqMatcher< Container >

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

Member Typedef Documentation

◆ StlContainer

template<typename Container>
typedef View::type testing::internal::ContainerEqMatcher< Container >::StlContainer

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

◆ StlContainerReference

template<typename Container>
typedef View::const_reference testing::internal::ContainerEqMatcher< Container >::StlContainerReference

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

◆ View

template<typename Container>
typedef internal::StlContainerView<Container> testing::internal::ContainerEqMatcher< Container >::View

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

Constructor & Destructor Documentation

◆ ContainerEqMatcher()

template<typename Container>
testing::internal::ContainerEqMatcher< Container >::ContainerEqMatcher ( const Container & expected)
inlineexplicit

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

2530 : expected_(View::Copy(expected)) {
2531 // Makes sure the user doesn't instantiate this class template
2532 // with a const or reference type.
2535 }
static type Copy(const Container &container)
#define GTEST_REMOVE_REFERENCE_AND_CONST_(T)
Here is the call graph for this function:

Member Function Documentation

◆ DescribeNegationTo()

template<typename Container>
void testing::internal::ContainerEqMatcher< Container >::DescribeNegationTo ( ::std::ostream * os) const
inline

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

2541 {
2542 *os << "does not equal ";
2543 UniversalPrint(expected_, os);
2544 }
void UniversalPrint(const T &value, ::std::ostream *os)
Here is the call graph for this function:

◆ DescribeTo()

template<typename Container>
void testing::internal::ContainerEqMatcher< Container >::DescribeTo ( ::std::ostream * os) const
inline

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

2537 {
2538 *os << "equals ";
2539 UniversalPrint(expected_, os);
2540 }
Here is the call graph for this function:

◆ MatchAndExplain()

template<typename Container>
template<typename LhsContainer>
bool testing::internal::ContainerEqMatcher< Container >::MatchAndExplain ( const LhsContainer & lhs,
MatchResultListener * listener ) const
inline

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

2548 {
2549 // GTEST_REMOVE_CONST_() is needed to work around an MSVC 8.0 bug
2550 // that causes LhsContainer to be a const type sometimes.
2552 LhsView;
2553 typedef typename LhsView::type LhsStlContainer;
2555 if (lhs_stl_container == expected_)
2556 return true;
2557
2558 ::std::ostream* const os = listener->stream();
2559 if (os != NULL) {
2560 // Something is different. Check for extra values first.
2561 bool printed_header = false;
2562 for (typename LhsStlContainer::const_iterator it =
2563 lhs_stl_container.begin();
2564 it != lhs_stl_container.end(); ++it) {
2565 if (internal::ArrayAwareFind(expected_.begin(), expected_.end(), *it) ==
2566 expected_.end()) {
2567 if (printed_header) {
2568 *os << ", ";
2569 } else {
2570 *os << "which has these unexpected elements: ";
2571 printed_header = true;
2572 }
2573 UniversalPrint(*it, os);
2574 }
2575 }
2576
2577 // Now check for missing values.
2578 bool printed_header2 = false;
2579 for (typename StlContainer::const_iterator it = expected_.begin();
2580 it != expected_.end(); ++it) {
2582 lhs_stl_container.begin(), lhs_stl_container.end(), *it) ==
2583 lhs_stl_container.end()) {
2584 if (printed_header2) {
2585 *os << ", ";
2586 } else {
2587 *os << (printed_header ? ",\nand" : "which")
2588 << " doesn't have these expected elements: ";
2589 printed_header2 = true;
2590 }
2591 UniversalPrint(*it, os);
2592 }
2593 }
2594 }
2595
2596 return false;
2597 }
View::const_reference StlContainerReference
#define GTEST_REMOVE_CONST_(T)
Here is the call graph for this function:

The documentation for this class was generated from the following file:
  • /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-matchers.h