66 #if GTEST_HAS_STRING_PIECE_
82 *
this =
Eq(s.ToString());
97 *
this =
Eq(s.ToString());
99 #endif // GTEST_HAS_STRING_PIECE_
106 switch (fields.size()) {
112 string result =
"(" + fields[0];
113 for (
size_t i = 1;
i < fields.size();
i++) {
128 const char* matcher_name,
131 if (param_values.size() >= 1)
133 return negation ?
"not (" + result +
")" : result;
209 ::std::vector<char> seen;
226 <<
"ilhs: " << ilhs <<
", left_[ilhs]: " <<
left_[ilhs];
232 for (
size_t ilhs = 0; ilhs <
left_.size(); ++ilhs) {
233 size_t irhs =
left_[ilhs];
241 static const size_t kUnused =
static_cast<size_t>(-1);
313 ::std::ostream* stream) {
314 typedef ElementMatcherPairs::const_iterator
Iter;
315 ::std::ostream&
os = *stream;
317 const char *sep =
"";
318 for (Iter
it = pairs.begin();
it != pairs.end(); ++
it) {
320 <<
"element #" <<
it->first <<
", "
321 <<
"matcher #" <<
it->second <<
")";
332 size_t max_flow = matches.size();
333 bool result = (max_flow == matrix.
RhsSize());
337 *listener <<
"where no permutation of the elements can "
338 "satisfy all matchers, and the closest match is "
339 << max_flow <<
" of " << matrix.
RhsSize()
340 <<
" matchers with the pairings:\n";
346 if (matches.size() > 1) {
348 const char *sep =
"where:\n";
349 for (
size_t mi = 0; mi < matches.size(); ++mi) {
350 *listener << sep <<
" - element #" << matches[mi].first
351 <<
" is matched by matcher #" << matches[mi].second;
360 for (
size_t ilhs = 0; ilhs <
LhsSize(); ++ilhs) {
361 for (
size_t irhs = 0; irhs <
RhsSize(); ++irhs) {
374 for (
size_t ilhs = 0; ilhs <
LhsSize(); ++ilhs) {
375 for (
size_t irhs = 0; irhs <
RhsSize(); ++irhs) {
377 b =
static_cast<char>(rand() & 1);
383 ::std::stringstream ss;
384 const char *sep =
"";
396 ::std::ostream*
os)
const {
402 *os <<
"has " <<
Elements(1) <<
" and that element ";
407 <<
" and there exists some permutation of elements such that:\n";
408 const char* sep =
"";
410 *os << sep <<
" - element #" <<
i <<
" ";
417 ::std::ostream*
os)
const {
419 *os <<
"isn't empty";
423 *os <<
"doesn't have " <<
Elements(1)
424 <<
", or has " <<
Elements(1) <<
" that ";
429 <<
", or there exists no permutation of elements such that:\n";
430 const char* sep =
"";
432 *os << sep <<
" - element #" <<
i <<
" ";
445 const ::std::vector<string>& element_printouts,
449 ::std::vector<char> element_matched(matrix.
LhsSize(), 0);
450 ::std::vector<char> matcher_matched(matrix.
RhsSize(), 0);
452 for (
size_t ilhs = 0; ilhs < matrix.
LhsSize(); ilhs++) {
453 for (
size_t irhs = 0; irhs < matrix.
RhsSize(); irhs++) {
454 char matched = matrix.
HasEdge(ilhs, irhs);
455 element_matched[ilhs] |= matched;
456 matcher_matched[irhs] |= matched;
462 "where the following matchers don't match any elements:\n";
463 for (
size_t mi = 0; mi < matcher_matched.size(); ++mi) {
464 if (matcher_matched[mi])
468 *listener << sep <<
"matcher #" << mi <<
": ";
477 "where the following elements don't match any matchers:\n";
478 const char* outer_sep =
"";
480 outer_sep =
"\nand ";
482 for (
size_t ei = 0;
ei < element_matched.size(); ++
ei) {
483 if (element_matched[
ei])
487 *listener << outer_sep << sep <<
"element #" << ei <<
": "
488 << element_printouts[
ei];