proxygen
testing::internal::MatchMatrix Class Reference

#include <gmock-matchers.h>

Public Member Functions

 MatchMatrix (size_t num_elements, size_t num_matchers)
 
size_t LhsSize () const
 
size_t RhsSize () const
 
bool HasEdge (size_t ilhs, size_t irhs) const
 
void SetEdge (size_t ilhs, size_t irhs, bool b)
 
bool NextGraph ()
 
void Randomize ()
 
string DebugString () const
 
 MatchMatrix (size_t num_elements, size_t num_matchers)
 
size_t LhsSize () const
 
size_t RhsSize () const
 
bool HasEdge (size_t ilhs, size_t irhs) const
 
void SetEdge (size_t ilhs, size_t irhs, bool b)
 
bool NextGraph ()
 
void Randomize ()
 
string DebugString () const
 
 MatchMatrix (size_t num_elements, size_t num_matchers)
 
size_t LhsSize () const
 
size_t RhsSize () const
 
bool HasEdge (size_t ilhs, size_t irhs) const
 
void SetEdge (size_t ilhs, size_t irhs, bool b)
 
bool NextGraph ()
 
void Randomize ()
 
string DebugString () const
 

Private Member Functions

size_t SpaceIndex (size_t ilhs, size_t irhs) const
 
size_t SpaceIndex (size_t ilhs, size_t irhs) const
 
size_t SpaceIndex (size_t ilhs, size_t irhs) const
 

Private Attributes

size_t num_elements_
 
size_t num_matchers_
 
::std::vector< char > matched_
 

Detailed Description

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

Constructor & Destructor Documentation

testing::internal::MatchMatrix::MatchMatrix ( size_t  num_elements,
size_t  num_matchers 
)
inline

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

3260  : num_elements_(num_elements),
3261  num_matchers_(num_matchers),
3263  }
::std::vector< char > matched_
testing::internal::MatchMatrix::MatchMatrix ( size_t  num_elements,
size_t  num_matchers 
)
inline

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

3260  : num_elements_(num_elements),
3261  num_matchers_(num_matchers),
3263  }
::std::vector< char > matched_
testing::internal::MatchMatrix::MatchMatrix ( size_t  num_elements,
size_t  num_matchers 
)
inline

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

3260  : num_elements_(num_elements),
3261  num_matchers_(num_matchers),
3263  }
::std::vector< char > matched_

Member Function Documentation

string testing::internal::MatchMatrix::DebugString ( ) const

Definition at line 382 of file gmock-matchers.cc.

References i.

Referenced by testing::gmock_matchers_test::TEST_F(), and testing::gmock_matchers_test::TEST_P().

382  {
383  ::std::stringstream ss;
384  const char *sep = "";
385  for (size_t i = 0; i < LhsSize(); ++i) {
386  ss << sep;
387  for (size_t j = 0; j < RhsSize(); ++j) {
388  ss << HasEdge(i, j);
389  }
390  sep = ";";
391  }
392  return ss.str();
393 }
bool HasEdge(size_t ilhs, size_t irhs) const
string testing::internal::MatchMatrix::DebugString ( ) const
string testing::internal::MatchMatrix::DebugString ( ) const
bool testing::internal::MatchMatrix::HasEdge ( size_t  ilhs,
size_t  irhs 
) const
inline

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

3267  {
3268  return matched_[SpaceIndex(ilhs, irhs)] == 1;
3269  }
size_t SpaceIndex(size_t ilhs, size_t irhs) const
::std::vector< char > matched_
bool testing::internal::MatchMatrix::HasEdge ( size_t  ilhs,
size_t  irhs 
) const
inline

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

3267  {
3268  return matched_[SpaceIndex(ilhs, irhs)] == 1;
3269  }
size_t SpaceIndex(size_t ilhs, size_t irhs) const
::std::vector< char > matched_
bool testing::internal::MatchMatrix::HasEdge ( size_t  ilhs,
size_t  irhs 
) const
inline
size_t testing::internal::MatchMatrix::LhsSize ( ) const
inline

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

size_t testing::internal::MatchMatrix::LhsSize ( ) const
inline

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

bool testing::internal::MatchMatrix::NextGraph ( )

Definition at line 359 of file gmock-matchers.cc.

References b.

Referenced by testing::gmock_matchers_test::TEST_P().

359  {
360  for (size_t ilhs = 0; ilhs < LhsSize(); ++ilhs) {
361  for (size_t irhs = 0; irhs < RhsSize(); ++irhs) {
362  char& b = matched_[SpaceIndex(ilhs, irhs)];
363  if (!b) {
364  b = 1;
365  return true;
366  }
367  b = 0;
368  }
369  }
370  return false;
371 }
char b
size_t SpaceIndex(size_t ilhs, size_t irhs) const
::std::vector< char > matched_
bool testing::internal::MatchMatrix::NextGraph ( )
bool testing::internal::MatchMatrix::NextGraph ( )
void testing::internal::MatchMatrix::Randomize ( )
void testing::internal::MatchMatrix::Randomize ( )

Definition at line 373 of file gmock-matchers.cc.

References b.

Referenced by testing::gmock_matchers_test::TEST_P().

373  {
374  for (size_t ilhs = 0; ilhs < LhsSize(); ++ilhs) {
375  for (size_t irhs = 0; irhs < RhsSize(); ++irhs) {
376  char& b = matched_[SpaceIndex(ilhs, irhs)];
377  b = static_cast<char>(rand() & 1); // NOLINT
378  }
379  }
380 }
char b
size_t SpaceIndex(size_t ilhs, size_t irhs) const
::std::vector< char > matched_
void testing::internal::MatchMatrix::Randomize ( )
size_t testing::internal::MatchMatrix::RhsSize ( ) const
inline

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

size_t testing::internal::MatchMatrix::RhsSize ( ) const
inline

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

void testing::internal::MatchMatrix::SetEdge ( size_t  ilhs,
size_t  irhs,
bool  b 
)
inline

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

3270  {
3271  matched_[SpaceIndex(ilhs, irhs)] = b ? 1 : 0;
3272  }
char b
size_t SpaceIndex(size_t ilhs, size_t irhs) const
::std::vector< char > matched_
void testing::internal::MatchMatrix::SetEdge ( size_t  ilhs,
size_t  irhs,
bool  b 
)
inline

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

Referenced by testing::internal::UnorderedElementsAreMatcherImpl< Container >::AnalyzeElements(), and testing::gmock_matchers_test::TEST_F().

3270  {
3271  matched_[SpaceIndex(ilhs, irhs)] = b ? 1 : 0;
3272  }
char b
size_t SpaceIndex(size_t ilhs, size_t irhs) const
::std::vector< char > matched_
void testing::internal::MatchMatrix::SetEdge ( size_t  ilhs,
size_t  irhs,
bool  b 
)
inline

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

3270  {
3271  matched_[SpaceIndex(ilhs, irhs)] = b ? 1 : 0;
3272  }
char b
size_t SpaceIndex(size_t ilhs, size_t irhs) const
::std::vector< char > matched_
size_t testing::internal::MatchMatrix::SpaceIndex ( size_t  ilhs,
size_t  irhs 
) const
inlineprivate

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

References testing::internal::FindMaxBipartiteMatching(), testing::internal::FindPairing(), g(), and GTEST_API_.

3284  {
3285  return ilhs * num_matchers_ + irhs;
3286  }
size_t testing::internal::MatchMatrix::SpaceIndex ( size_t  ilhs,
size_t  irhs 
) const
inlineprivate

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

3284  {
3285  return ilhs * num_matchers_ + irhs;
3286  }
size_t testing::internal::MatchMatrix::SpaceIndex ( size_t  ilhs,
size_t  irhs 
) const
inlineprivate

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

References testing::internal::FindMaxBipartiteMatching(), testing::internal::FindPairing(), g(), and GTEST_API_.

3284  {
3285  return ilhs * num_matchers_ + irhs;
3286  }

Member Data Documentation

std::vector< char > testing::internal::MatchMatrix::matched_
private

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

size_t testing::internal::MatchMatrix::num_elements_
private

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

size_t testing::internal::MatchMatrix::num_matchers_
private

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


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