Lines Matching defs:std

137 //       std::string(negation ? "is not" : "is") + " in range [" +
309 std::string str() const { return ss_.str(); }
315 ::std::stringstream ss_;
354 std::is_convertible<M, Matcher<T>>{},
355 std::is_convertible<M, T>{});
361 std::true_type /* convertible_to_matcher */,
362 std::integral_constant<bool, Ignore>) {
378 std::false_type /* convertible_to_matcher */,
379 std::true_type /* convertible_to_T */) {
390 // (e.g. std::pair<const int, int> vs. std::pair<int, int>).
394 std::false_type /* convertible_to_matcher */,
395 std::false_type /* convertible_to_T */);
416 using FromType = typename std::remove_cv<typename std::remove_pointer<
417 typename std::remove_reference<T>::type>::type>::type;
418 using ToType = typename std::remove_cv<typename std::remove_pointer<
419 typename std::remove_reference<U>::type>::type>::type;
424 (std::is_pointer<typename std::remove_reference<T>::type>::value !=
425 std::is_pointer<typename std::remove_reference<U>::type>::value) ||
426 std::is_same<FromType, ToType>::value ||
427 !std::is_base_of<FromType, ToType>::value,
433 typename std::conditional<std::is_convertible<T&, const U&>::value,
440 void DescribeTo(::std::ostream* os) const override {
444 void DescribeNegationTo(::std::ostream* os) const override {
480 template <typename E = std::enable_if<sizeof...(Ts) == 1>,
483 : params_(std::forward<Ts>(params)...) {}
484 template <typename E = std::enable_if<sizeof...(Ts) != 1>,
487 : params_(std::forward<Ts>(params)...) {}
495 template <typename F, std::size_t... tuple_ids>
499 std::get<tuple_ids>(params_)...));
502 const std::tuple<Ts...> params_;
535 static_assert(std::is_convertible<const T&, const U&>::value,
539 static_assert(std::is_reference<T>::value || !std::is_reference<U>::value,
563 inline void PrintIfNotEmpty(const std::string& explanation,
564 ::std::ostream* os) {
573 inline bool IsReadableTypeName(const std::string& type_name) {
577 type_name.find_first_of("<(") == std::string::npos);
599 const std::string& type_name = GetTypeName<Value>();
620 std::get<N - 1>(matcher_tuple).Matches(std::get<N - 1>(value_tuple));
630 ::std::ostream* os) {
636 typename std::tuple_element<N - 1, MatcherTuple>::type matcher =
637 std::get<N - 1>(matchers);
638 typedef typename std::tuple_element<N - 1, ValueTuple>::type Value;
639 const Value& value = std::get<N - 1>(values);
643 std::get<N - 1>(matchers).DescribeTo(os);
670 ::std::ostream* /* os */) {}
683 static_assert(std::tuple_size<MatcherTuple>::value ==
684 std::tuple_size<ValueTuple>::value,
686 return TuplePrefix<std::tuple_size<ValueTuple>::value>::Matches(matcher_tuple,
694 const ValueTuple& values, ::std::ostream* os) {
695 TuplePrefix<std::tuple_size<MatcherTuple>::value>::ExplainMatchFailuresTo(
706 typedef ::std::tuple_size<Tuple> TupleSize;
719 *out++ = f(::std::get<TupleSize::value - kRemainingSize>(t));
748 bool MatchAndExplain(const T& /* x */, std::ostream* /* listener */) const {
751 void DescribeTo(std::ostream* os) const { *os << "is anything"; }
752 void DescribeNegationTo(::std::ostream* os) const {
770 void DescribeTo(::std::ostream* os) const { *os << "is NULL"; }
771 void DescribeNegationTo(::std::ostream* os) const { *os << "isn't NULL"; }
784 void DescribeTo(::std::ostream* os) const { *os << "isn't NULL"; }
785 void DescribeNegationTo(::std::ostream* os) const { *os << "is NULL"; }
841 void DescribeTo(::std::ostream* os) const override {
846 void DescribeNegationTo(::std::ostream* os) const override {
897 : string_(std::move(str)),
906 const StringType& str = std::string(s);
937 void DescribeTo(::std::ostream* os) const {
941 void DescribeNegationTo(::std::ostream* os) const {
946 void DescribeToHelper(bool expect_eq, ::std::ostream* os) const {
974 const StringType& str = std::string(s);
1000 void DescribeTo(::std::ostream* os) const {
1005 void DescribeNegationTo(::std::ostream* os) const {
1027 const StringType& str = std::string(s);
1054 void DescribeTo(::std::ostream* os) const {
1059 void DescribeNegationTo(::std::ostream* os) const {
1081 const StringType& str = std::string(s);
1108 void DescribeTo(::std::ostream* os) const {
1113 void DescribeNegationTo(::std::ostream* os) const {
1129 const Matcher<const std::string&>& internal_matcher)
1132 // Matches anything that can convert to std::string.
1136 const std::string s2(s); // NOLINT (needed for working with string_view).
1137 std::string unescaped;
1147 void DescribeTo(::std::ostream* os) const {
1152 void DescribeNegationTo(::std::ostream* os) const {
1158 const Matcher<const std::string&> internal_matcher_;
1166 // used to match a std::tuple<int, short>, a std::tuple<const long&, double>,
1173 operator Matcher<::std::tuple<T1, T2>>() const {
1174 return Matcher<::std::tuple<T1, T2>>(new Impl<const ::std::tuple<T1, T2>&>);
1177 operator Matcher<const ::std::tuple<T1, T2>&>() const {
1178 return MakeMatcher(new Impl<const ::std::tuple<T1, T2>&>);
1182 static ::std::ostream& GetDesc(::std::ostream& os) { // NOLINT
1191 return Op()(::std::get<0>(args), ::std::get<1>(args));
1193 void DescribeTo(::std::ostream* os) const override {
1196 void DescribeNegationTo(::std::ostream* os) const override {
1241 void DescribeTo(::std::ostream* os) const override {
1245 void DescribeNegationTo(::std::ostream* os) const override {
1278 explicit AllOfMatcherImpl(std::vector<Matcher<T>> matchers)
1279 : matchers_(std::move(matchers)) {}
1281 void DescribeTo(::std::ostream* os) const override {
1290 void DescribeNegationTo(::std::ostream* os) const override {
1303 std::string all_match_result;
1311 std::string result = slistener.str();
1329 const std::vector<Matcher<T>> matchers_;
1352 std::vector<Matcher<T>> values;
1353 CreateVariadicMatcher<T>(&values, std::integral_constant<size_t, 0>());
1354 return Matcher<T>(new CombiningMatcher<T>(std::move(values)));
1359 void CreateVariadicMatcher(std::vector<Matcher<T>>* values,
1360 std::integral_constant<size_t, I>) const {
1361 values->push_back(SafeMatcherCast<T>(std::get<I>(matchers_)));
1362 CreateVariadicMatcher<T>(values, std::integral_constant<size_t, I + 1>());
1367 std::vector<Matcher<T>>*,
1368 std::integral_constant<size_t, sizeof...(Args)>) const {}
1370 std::tuple<Args...> matchers_;
1383 explicit AnyOfMatcherImpl(std::vector<Matcher<T>> matchers)
1384 : matchers_(std::move(matchers)) {}
1386 void DescribeTo(::std::ostream* os) const override {
1395 void DescribeNegationTo(::std::ostream* os) const override {
1406 std::string no_match_result;
1419 std::string result = slistener.str();
1434 const std::vector<Matcher<T>> matchers_;
1448 matcher_true_(std::move(matcher_true)),
1449 matcher_false_(std::move(matcher_false)) {}
1474 using RawU = typename std::decay<U>::type;
1475 std::vector<Matcher<RawU>> matchers;
1479 return Matcher<U>(new MatcherImpl<RawU>(std::move(matchers)));
1483 const ::std::vector<T> matchers_;
1517 void DescribeTo(::std::ostream* os) const {
1521 void DescribeNegationTo(::std::ostream* os) const {
1570 explicit PredicateFormatterFromMatcher(M m) : matcher_(std::move(m)) {}
1596 ::std::stringstream ss;
1622 return PredicateFormatterFromMatcher<M>(std::move(matcher));
1632 return (::std::isnan)(f);
1635 void DescribeTo(::std::ostream* os) const { *os << "is NaN"; }
1636 void DescribeNegationTo(::std::ostream* os) const { *os << "isn't NaN"; }
1698 if (::std::fabs(diff) <= max_abs_error_) {
1711 void DescribeTo(::std::ostream* os) const override {
1715 const ::std::streamsize old_precision =
1716 os->precision(::std::numeric_limits<FloatType>::digits10 + 2);
1732 void DescribeNegationTo(::std::ostream* os) const override {
1734 const ::std::streamsize old_precision =
1735 os->precision(::std::numeric_limits<FloatType>::digits10 + 2);
1807 operator Matcher<::std::tuple<T1, T2>>() const {
1809 new Impl<::std::tuple<T1, T2>>(max_abs_error_, nan_eq_nan_));
1812 operator Matcher<const ::std::tuple<T1, T2>&>() const {
1814 new Impl<const ::std::tuple<T1, T2>&>(max_abs_error_, nan_eq_nan_));
1818 static ::std::ostream& GetDesc(::std::ostream& os) { // NOLINT
1831 FloatingEqMatcher<FloatType> fm(::std::get<0>(args), nan_eq_nan_);
1833 ::std::get<1>(args), listener);
1835 FloatingEqMatcher<FloatType> fm(::std::get<0>(args), nan_eq_nan_,
1838 ::std::get<1>(args), listener);
1841 void DescribeTo(::std::ostream* os) const override {
1844 void DescribeNegationTo(::std::ostream* os) const override {
1887 typename std::pointer_traits<GTEST_REMOVE_REFERENCE_AND_CONST_(
1893 void DescribeTo(::std::ostream* os) const override {
1898 void DescribeNegationTo(::std::ostream* os) const override {
1946 const typename std::pointer_traits<GTEST_REMOVE_REFERENCE_AND_CONST_(
1952 void DescribeTo(::std::ostream* os) const override {
1957 void DescribeNegationTo(::std::ostream* os) const override {
1989 void DescribeTo(::std::ostream* os) const {
1994 void DescribeNegationTo(::std::ostream* os) const {
2002 static std::string GetToName() { return GetTypeName<To>(); }
2005 static void GetCastTypeDescription(::std::ostream* os) {
2035 // We don't want an std::bad_cast here, so do the cast with pointers.
2055 FieldMatcher(const std::string& field_name, FieldType Class::*field,
2061 void DescribeTo(::std::ostream* os) const {
2066 void DescribeNegationTo(::std::ostream* os) const {
2073 // FIXME: The dispatch on std::is_pointer was introduced as a workaround for
2076 typename std::is_pointer<typename std::remove_const<T>::type>::type(),
2081 bool MatchAndExplainImpl(std::false_type /* is_not_pointer */,
2088 bool MatchAndExplainImpl(std::true_type /* is_pointer */, const Class* p,
2096 return MatchAndExplainImpl(std::false_type(), *p, listener);
2104 const std::string whose_field_;
2122 PropertyMatcher(const std::string& property_name, Property property,
2128 void DescribeTo(::std::ostream* os) const {
2133 void DescribeNegationTo(::std::ostream* os) const {
2141 typename std::is_pointer<typename std::remove_const<T>::type>::type(),
2146 bool MatchAndExplainImpl(std::false_type /* is_not_pointer */,
2156 bool MatchAndExplainImpl(std::true_type /* is_pointer */, const Class* p,
2164 return MatchAndExplainImpl(std::false_type(), *p, listener);
2172 const std::string whose_property_;
2211 : ResultOfMatcher(/*result_description=*/"", std::move(callable),
2212 std::move(matcher)) {}
2214 ResultOfMatcher(const std::string& result_description, Callable callable,
2217 callable_(std::move(callable)),
2218 matcher_(std::move(matcher)) {
2234 std::declval<CallableStorageType>(), std::declval<T>()));
2238 Impl(const std::string& result_description,
2244 void DescribeTo(::std::ostream* os) const override {
2253 void DescribeNegationTo(::std::ostream* os) const override {
2278 const std::string result_description_;
2288 const std::string result_description_;
2308 using SizeType = decltype(std::declval<Container>().size());
2312 void DescribeTo(::std::ostream* os) const override {
2316 void DescribeNegationTo(::std::ostream* os) const override {
2359 typedef typename std::iterator_traits<
2365 void DescribeTo(::std::ostream* os) const override {
2369 void DescribeNegationTo(::std::ostream* os) const override {
2376 using std::begin;
2377 using std::end;
2378 DistanceType distance = std::distance(begin(container), end(container));
2413 static_assert(!std::is_const<Container>::value,
2415 static_assert(!std::is_reference<Container>::value,
2423 void DescribeTo(::std::ostream* os) const {
2427 void DescribeNegationTo(::std::ostream* os) const {
2436 typename std::remove_const<LhsContainer>::type>
2441 ::std::ostream* const os = listener->stream();
2513 // Transforms std::pair<const Key, Value> into std::pair<Key, Value>
2522 void DescribeTo(::std::ostream* os) const override {
2527 void DescribeNegationTo(::std::ostream* os) const override {
2535 ::std::vector<LhsValue> sorted_container(lhs_stl_container.begin(),
2537 ::std::sort(sorted_container.begin(), sorted_container.end(),
2559 const Matcher<const ::std::vector<LhsValue>&> matcher_;
2571 // must be able to be safely cast to Matcher<std::tuple<const T1&, const
2585 static_assert(!std::is_const<RhsContainer>::value,
2587 static_assert(!std::is_reference<RhsContainer>::value,
2618 typedef ::std::tuple<const LhsValue&, const RhsValue&> InnerMatcherArg;
2625 void DescribeTo(::std::ostream* os) const override {
2632 void DescribeNegationTo(::std::ostream* os) const override {
2733 std::vector<size_t> match_elements;
2749 std::string sep = "";
2790 void DescribeTo(::std::ostream* os) const override {
2795 void DescribeNegationTo(::std::ostream* os) const override {
2816 void DescribeTo(::std::ostream* os) const override {
2821 void DescribeNegationTo(::std::ostream* os) const override {
2841 count_matcher_(std::move(count_matcher)) {}
2843 void DescribeTo(::std::ostream* os) const override {
2850 void DescribeNegationTo(::std::ostream* os) const override {
2871 : inner_matcher_(m), count_matcher_(std::move(count_matcher)) {}
2897 return ContainsTimesMatcher<M>(inner_matcher_, std::move(count_matcher));
2924 using std::get;
2945 // Key(inner_matcher) matches an std::pair whose 'first' field matches
2947 // std::map that contains at least one element whose key is >= 5.
2966 const std::string explanation = inner_listener.str();
2974 void DescribeTo(::std::ostream* os) const override {
2980 void DescribeNegationTo(::std::ostream* os) const override {
3025 void DescribeTo(::std::ostream* os) const override {
3030 void DescribeNegationTo(::std::ostream* os) const override {
3038 Address address = std::addressof(object);
3065 void DescribeTo(::std::ostream* os) const override {
3073 void DescribeNegationTo(::std::ostream* os) const override {
3110 void ExplainSuccess(const std::string& first_explanation,
3111 const std::string& second_explanation,
3152 -> decltype(std::tie(get<I>(t)...)) {
3153 static_assert(std::tuple_size<T>::value == sizeof...(I),
3155 return std::tie(get<I>(t)...);
3162 return std::tie(a);
3167 return std::tie(a, b);
3172 return std::tie(a, b, c);
3177 return std::tie(a, b, c, d);
3182 return std::tie(a, b, c, d, e);
3187 return std::tie(a, b, c, d, e, f);
3192 return std::tie(a, b, c, d, e, f, g);
3197 return std::tie(a, b, c, d, e, f, g, h);
3202 return std::tie(a, b, c, d, e, f, g, h, i);
3207 return std::tie(a, b, c, d, e, f, g, h, i, j);
3212 return std::tie(a, b, c, d, e, f, g, h, i, j, k);
3217 return std::tie(a, b, c, d, e, f, g, h, i, j, k, l);
3222 return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m);
3227 return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n);
3232 return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o);
3237 return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p);
3242 return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q);
3247 return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r);
3252 return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s);
3275 decltype(UnpackStruct<sizeof...(I)>(std::declval<const Struct&>()));
3276 using MatchersType = std::tuple<
3277 Matcher<const typename std::tuple_element<I, UnpackedType>::type&>...>;
3283 const typename std::tuple_element<I, UnpackedType>::type&>(
3284 std::get<I>(matchers))...) {}
3286 void DescribeTo(::std::ostream* os) const override {
3290 std::get<I>(matchers_).DescribeTo(os), separator = ", and ")...});
3293 void DescribeNegationTo(::std::ostream* os) const override {
3296 std::get<I>(matchers_).DescribeNegationTo(os),
3310 VariadicExpand({good = good && std::get<I>(matchers_).Matches(
3311 std::get<I>(tuple))...});
3317 std::vector<StringMatchResultListener> inner_listener(sizeof...(I));
3320 {failed_pos == ~size_t{}&& !std::get<I>(matchers_).MatchAndExplain(
3321 std::get<I>(tuple), &inner_listener[I])
3333 const std::string str = inner_listener[index].str();
3349 explicit FieldsAreMatcher(Inner... inner) : matchers_(std::move(inner)...) {}
3359 std::tuple<Inner...> matchers_;
3382 void DescribeTo(::std::ostream* os) const override {
3401 void DescribeNegationTo(::std::ostream* os) const override {
3425 ::std::vector<std::string> explanations(count());
3484 const std::string& s = explanations[i];
3504 ::std::vector<Matcher<const Element&>> matchers_;
3534 std::string DebugString() const;
3547 ::std::vector<char> matched_;
3550 typedef ::std::pair<size_t, size_t> ElementMatcherPair;
3551 typedef ::std::vector<ElementMatcherPair> ElementMatcherPairs;
3577 typedef ::std::vector<const MatcherDescriberInterface*> MatcherDescriberVec;
3580 void DescribeToImpl(::std::ostream* os) const;
3583 void DescribeNegationToImpl(::std::ostream* os) const;
3585 bool VerifyMatchMatrix(const ::std::vector<std::string>& element_printouts,
3631 void DescribeTo(::std::ostream* os) const override {
3636 void DescribeNegationTo(::std::ostream* os) const override {
3643 ::std::vector<std::string> element_printouts;
3655 ::std::vector<std::string>* element_printouts,
3658 ::std::vector<char> did_match;
3672 ::std::vector<char>::const_iterator did_match_iter = did_match.begin();
3681 ::std::vector<Matcher<const Element&>> matchers_;
3706 typedef ::std::vector<Matcher<const Element&>> MatcherVec;
3708 matchers.reserve(::std::tuple_size<MatcherTuple>::value);
3710 ::std::back_inserter(matchers));
3731 ::std::tuple_size<MatcherTuple>::value < 2,
3737 typedef ::std::vector<Matcher<const Element&>> MatcherVec;
3739 matchers.reserve(::std::tuple_size<MatcherTuple>::value);
3741 ::std::back_inserter(matchers));
3768 ::std::vector<T> matchers_;
3789 const ::std::vector<T> matchers_;
3830 typedef ::std::tuple<T, Second> ArgTuple;
3836 void DescribeTo(::std::ostream* os) const override {
3872 GTEST_API_ std::string FormatMatcherDescription(
3874 const std::vector<const char*>& param_names, const Strings& param_values);
3896 void DescribeTo(::std::ostream* os) const override {
3901 void DescribeNegationTo(::std::ostream* os) const override {
3941 : matcher_(std::move(matcher)) {}
3946 using std::get;
3965 void DescribeTo(std::ostream* os) const {
3971 void DescribeNegationTo(std::ostream* os) const {
3978 static std::string GetTypeName() {
4026 void DescribeTo(std::ostream* os) const {
4032 void DescribeNegationTo(std::ostream* os) const {
4039 static std::string GetTypeName() {
4056 using RawArgsTuple = typename std::decay<ArgsTuple>::type;
4058 std::tuple<typename std::tuple_element<k, RawArgsTuple>::type...>;
4070 std::forward_as_tuple(std::get<k>(args)...);
4083 void DescribeTo(::std::ostream* os) const override {
4089 void DescribeNegationTo(::std::ostream* os) const override {
4097 static void PrintIndices(::std::ostream* os) {
4119 : inner_matcher_(std::move(inner_matcher)) {}
4149 typename ::std::iterator_traits<Iter>::value_type>
4151 typedef typename ::std::iterator_traits<Iter>::value_type T;
4174 inline auto ElementsAreArray(::std::initializer_list<T> xs)
4194 typename ::std::iterator_traits<Iter>::value_type>
4196 typedef typename ::std::iterator_traits<Iter>::value_type T;
4222 ::std::initializer_list<T> xs) {
4231 // is not the global namespace or ::std.
4250 const M& value, std::false_type /* convertible_to_matcher */,
4251 std::false_type /* convertible_to_T */) {
4377 const std::string& field_name, FieldType Class::*field,
4407 Property(const std::string& property_name,
4432 Property(const std::string& property_name,
4452 return internal::ResultOfMatcher<Callable, InnerMatcher>(std::move(callable),
4453 std::move(matcher));
4460 const std::string& result_description, Callable callable,
4463 result_description, std::move(callable), std::move(matcher));
4469 template <typename T = std::string>
4470 PolymorphicMatcher<internal::StrEqualityMatcher<std::string>> StrEq(
4473 internal::StrEqualityMatcher<std::string>(std::string(str), true, true));
4477 template <typename T = std::string>
4478 PolymorphicMatcher<internal::StrEqualityMatcher<std::string>> StrNe(
4481 internal::StrEqualityMatcher<std::string>(std::string(str), false, true));
4485 template <typename T = std::string>
4486 PolymorphicMatcher<internal::StrEqualityMatcher<std::string>> StrCaseEq(
4489 internal::StrEqualityMatcher<std::string>(std::string(str), true, false));
4493 template <typename T = std::string>
4494 PolymorphicMatcher<internal::StrEqualityMatcher<std::string>> StrCaseNe(
4496 return MakePolymorphicMatcher(internal::StrEqualityMatcher<std::string>(
4497 std::string(str), false, false));
4500 // Creates a matcher that matches any string, std::string, or C string
4502 template <typename T = std::string>
4503 PolymorphicMatcher<internal::HasSubstrMatcher<std::string>> HasSubstr(
4506 internal::HasSubstrMatcher<std::string>(std::string(substring)));
4510 template <typename T = std::string>
4511 PolymorphicMatcher<internal::StartsWithMatcher<std::string>> StartsWith(
4514 internal::StartsWithMatcher<std::string>(std::string(prefix)));
4518 template <typename T = std::string>
4519 PolymorphicMatcher<internal::EndsWithMatcher<std::string>> EndsWith(
4522 internal::EndsWithMatcher<std::string>(std::string(suffix)));
4529 inline PolymorphicMatcher<internal::StrEqualityMatcher<std::wstring>> StrEq(
4530 const std::wstring& str) {
4532 internal::StrEqualityMatcher<std::wstring>(str, true, true));
4536 inline PolymorphicMatcher<internal::StrEqualityMatcher<std::wstring>> StrNe(
4537 const std::wstring& str) {
4539 internal::StrEqualityMatcher<std::wstring>(str, false, true));
4543 inline PolymorphicMatcher<internal::StrEqualityMatcher<std::wstring>> StrCaseEq(
4544 const std::wstring& str) {
4546 internal::StrEqualityMatcher<std::wstring>(str, true, false));
4550 inline PolymorphicMatcher<internal::StrEqualityMatcher<std::wstring>> StrCaseNe(
4551 const std::wstring& str) {
4553 internal::StrEqualityMatcher<std::wstring>(str, false, false));
4556 // Creates a matcher that matches any ::wstring, std::wstring, or C wide string
4558 inline PolymorphicMatcher<internal::HasSubstrMatcher<std::wstring>> HasSubstr(
4559 const std::wstring& substring) {
4561 internal::HasSubstrMatcher<std::wstring>(substring));
4565 inline PolymorphicMatcher<internal::StartsWithMatcher<std::wstring>> StartsWith(
4566 const std::wstring& prefix) {
4568 internal::StartsWithMatcher<std::wstring>(prefix));
4572 inline PolymorphicMatcher<internal::EndsWithMatcher<std::wstring>> EndsWith(
4573 const std::wstring& suffix) {
4575 internal::EndsWithMatcher<std::wstring>(suffix));
4686 // can be used instead of SizeIs with containers such as std::forward_list which
4701 internal::ContainerEqMatcher<typename std::remove_const<Container>::type>>
4728 // TupleMatcher must be able to be safely cast to Matcher<std::tuple<const
4733 typename std::remove_const<Container>::type>
4741 inline internal::PointwiseMatcher<TupleMatcher, std::vector<T>> Pointwise(
4742 const TupleMatcher& tuple_matcher, std::initializer_list<T> rhs) {
4743 return Pointwise(tuple_matcher, std::vector<T>(rhs));
4751 // cast to Matcher<std::tuple<const T1&, const T2&> >, where T1 and T2 are
4762 typename std::remove_const<RhsContainer>::type>::type::value_type>>
4774 ::std::vector<internal::BoundSecondMatcher<Tuple2Matcher, Second>> matchers;
4789 std::initializer_list<T> rhs) {
4790 return UnorderedPointwise(tuple2_matcher, std::vector<T>(rhs));
4797 // ::std::set<int> page_ids;
4804 // ::std::map<int, size_t> page_lengths;
4807 // Contains(::std::pair<const int, size_t>(1, 100)));
4810 // EXPECT_THAT(user_ids, Contains(Eq(::std::string("tom"))));
4816 // ::std::vector<int> ids;
4858 typename ::std::iterator_traits<Iter>::value_type>
4860 typedef typename ::std::iterator_traits<Iter>::value_type T;
4886 ::std::initializer_list<T> xs) {
4915 typename ::std::iterator_traits<Iter>::value_type>
4917 typedef typename ::std::iterator_traits<Iter>::value_type T;
4943 ::std::initializer_list<T> xs) {
4954 // ::std::set<int> page_ids;
4965 // ::std::map<int, size_t> page_lengths;
4973 // EXPECT_THAT(user_ids, Not(Each(Eq(::std::string("tom")))));
4979 // Key(inner_matcher) matches an std::pair whose 'first' field matches
4981 // std::map that contains at least one element whose key is >= 5.
4987 // Pair(first_matcher, second_matcher) matches a std::pair whose 'first' field
4990 // to match a std::map<int, string> that contains exactly one element whose key
5009 condition, std::move(matcher_true), std::move(matcher_false));
5015 // In particular, `std::tuple`, `std::pair`, `std::array` and aggregate types.
5017 internal::FieldsAreMatcher<typename std::decay<M>::type...> FieldsAre(
5019 return internal::FieldsAreMatcher<typename std::decay<M>::type...>(
5020 std::forward<M>(matchers)...);
5081 std::string DescribeMatcher(const M& matcher, bool negation = false) {
5082 ::std::stringstream ss;
5094 std::tuple<typename std::decay<const Args&>::type...>>
5097 std::tuple<typename std::decay<const Args&>::type...>>(
5098 std::make_tuple(matchers...));
5103 std::tuple<typename std::decay<const Args&>::type...>>
5106 std::tuple<typename std::decay<const Args&>::type...>>(
5107 std::make_tuple(matchers...));
5112 internal::AllOfMatcher<typename std::decay<const Args&>::type...> AllOf(
5114 return internal::AllOfMatcher<typename std::decay<const Args&>::type...>(
5119 internal::AnyOfMatcher<typename std::decay<const Args&>::type...> AnyOf(
5121 return internal::AnyOfMatcher<typename std::decay<const Args&>::type...>(
5149 typename ::std::iterator_traits<Iter>::value_type>
5152 typename ::std::iterator_traits<Iter>::value_type>(first, last);
5157 typename ::std::iterator_traits<Iter>::value_type>
5160 typename ::std::iterator_traits<Iter>::value_type>(first, last);
5197 ::std::initializer_list<T> xs) {
5203 ::std::initializer_list<T> xs) {
5211 internal::ArgsMatcher<typename std::decay<InnerMatcher>::type, k...> Args(
5213 return internal::ArgsMatcher<typename std::decay<InnerMatcher>::type, k...>(
5214 std::forward<InnerMatcher>(matcher));
5233 // std::optional/std::experimental::optional.
5254 // It is compatible with std::variant.
5270 WithWhatMatcherImpl(Matcher<std::string> matcher)
5271 : matcher_(std::move(matcher)) {}
5273 void DescribeTo(std::ostream* os) const {
5278 void DescribeNegationTo(std::ostream* os) const {
5291 const Matcher<std::string> matcher_;
5295 Matcher<std::string> m) {
5296 return MakePolymorphicMatcher(WithWhatMatcherImpl(std::move(m)));
5314 // catch (const std::exception&) { /* exception of a wrong type */ }
5316 // However, if the `Err` itself is `std::exception`, we'd end up with two
5320 // catch (const std::exception&) { /* an expected exception */ }
5321 // catch (const std::exception&) { /* exception of a wrong type */ }
5324 // the issue, we use a fake error type whenever `Err` is `std::exception`:
5327 // catch (const std::exception&) { /* an expected exception */ }
5329 using DefaultExceptionType = typename std::conditional<
5330 std::is_same<typename std::remove_cv<
5331 typename std::remove_reference<Err>::type>::type,
5332 std::exception>::value,
5333 const NeverThrown&, const std::exception&>::type;
5337 : matcher_(std::move(matcher)) {}
5339 void DescribeTo(std::ostream* os) const {
5345 void DescribeNegationTo(std::ostream* os) const {
5354 (void)(std::forward<T>(x)());
5364 *listener << "throws an std::exception-derived type ";
5393 // []() { throw std::runtime_error("message"); },
5394 // Throws<std::runtime_error>());
5397 // []() { throw std::runtime_error("message"); },
5398 // ThrowsMessage<std::runtime_error>(HasSubstr("message")));
5401 // []() { throw std::runtime_error("message"); },
5402 // Throws<std::runtime_error>(
5403 // Property(&std::runtime_error::what, HasSubstr("message"))));
5415 // For example user may want to pass Matcher<std::exception>
5416 // to Throws<std::runtime_error>, or Matcher<int64> to Throws<int32>.
5424 static_assert(std::is_base_of<std::exception, Err>::value,
5425 "expected an std::exception-derived type");
5427 MatcherCast<std::string>(std::forward<MessageMatcher>(message_matcher))));
5455 void DescribeTo(::std::ostream* gmock_os) const override { \
5458 void DescribeNegationTo(::std::ostream* gmock_os) const override { \
5463 ::std::string FormatDescription(bool negation) const { \
5465 ::std::string gmock_description = (description); \
5536 void DescribeTo(::std::ostream* gmock_os) const override { \
5539 void DescribeNegationTo(::std::ostream* gmock_os) const override { \
5545 ::std::string FormatDescription(bool negation) const { \
5546 ::std::string gmock_description = (description); \
5553 ::std::tuple<GMOCK_INTERNAL_MATCHER_TYPE_PARAMS(args)>( \
5592 , arg(::std::forward<arg##_type>(gmock_p##i))