Lines Matching full:container

2296 // Implements a matcher that checks the size of an STL-style container.
2303 template <typename Container>
2304 operator Matcher<Container>() const {
2305 return Matcher<Container>(new Impl<const Container&>(size_matcher_));
2308 template <typename Container>
2309 class Impl : public MatcherInterface<Container> {
2311 using SizeType = decltype(std::declval<Container>().size());
2324 bool MatchAndExplain(Container container,
2326 SizeType size = container.size();
2344 // container.
2351 template <typename Container>
2352 operator Matcher<Container>() const {
2353 return Matcher<Container>(new Impl<const Container&>(distance_matcher_));
2356 template <typename Container>
2357 class Impl : public MatcherInterface<Container> {
2360 Container)>
2377 bool MatchAndExplain(Container container,
2381 DistanceType distance = std::distance(begin(container), end(container));
2399 // Implements an equality matcher for any STL-style container whose elements
2401 // more detailed information that is useful when the container is used as a set.
2407 // Uses the container's const_iterator, value_type, operator ==,
2409 template <typename Container>
2412 typedef internal::StlContainerView<Container> View;
2416 static_assert(!std::is_const<Container>::value,
2417 "Container type must not be const");
2418 static_assert(!std::is_reference<Container>::value,
2419 "Container type must not be a reference");
2423 explicit ContainerEqMatcher(const Container& expected)
2576 // container and the RHS container respectively.
2695 template <typename Container>
2696 class QuantifierMatcherImpl : public MatcherInterface<Container> {
2698 typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
2710 // * All elements in the container match, if all_elements_should_match.
2711 // * Any element in the container matches, if !all_elements_should_match.
2712 bool MatchAndExplainImpl(bool all_elements_should_match, Container container,
2714 StlContainerReference stl_container = View::ConstReference(container);
2732 Container container,
2734 StlContainerReference stl_container = View::ConstReference(container);
2783 // Implements Contains(element_matcher) for the given argument type Container.
2785 template <typename Container>
2786 class ContainsMatcherImpl : public QuantifierMatcherImpl<Container> {
2790 : QuantifierMatcherImpl<Container>(inner_matcher) {}
2803 bool MatchAndExplain(Container container,
2805 return this->MatchAndExplainImpl(false, container, listener);
2809 // Implements Each(element_matcher) for the given argument type Container.
2811 template <typename Container>
2812 class EachMatcherImpl : public QuantifierMatcherImpl<Container> {
2816 : QuantifierMatcherImpl<Container>(inner_matcher) {}
2829 bool MatchAndExplain(Container container,
2831 return this->MatchAndExplainImpl(true, container, listener);
2836 // Container.
2837 template <typename Container>
2838 class ContainsTimesMatcherImpl : public QuantifierMatcherImpl<Container> {
2843 : QuantifierMatcherImpl<Container>(inner_matcher),
2860 bool MatchAndExplain(Container container,
2862 return this->MatchAndExplainImpl(count_matcher_, container, listener);
2876 template <typename Container>
2877 operator Matcher<Container>() const { // NOLINT
2878 return Matcher<Container>(new ContainsTimesMatcherImpl<const Container&>(
2893 template <typename Container>
2894 operator Matcher<Container>() const { // NOLINT
2895 return Matcher<Container>(
2896 new ContainsMatcherImpl<const Container&>(inner_matcher_));
2913 template <typename Container>
2914 operator Matcher<Container>() const { // NOLINT
2915 return Matcher<Container>(
2916 new EachMatcherImpl<const Container&>(inner_matcher_));
3367 template <typename Container>
3368 class ElementsAreMatcherImpl : public MatcherInterface<Container> {
3370 typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
3421 bool MatchAndExplain(Container container,
3430 StlContainerReference stl_container = View::ConstReference(container);
3455 // Find how many elements the actual container has. We avoid
3464 // The element count doesn't match. If the container is empty,
3466 // prints the empty container. Otherwise we just need to show
3611 template <typename Container>
3613 : public MatcherInterface<Container>,
3616 typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
3644 bool MatchAndExplain(Container container,
3646 StlContainerReference stl_container = View::ConstReference(container);
3705 template <typename Container>
3706 operator Matcher<Container>() const {
3707 typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
3715 return Matcher<Container>(
3716 new UnorderedElementsAreMatcherImpl<const Container&>(
3731 template <typename Container>
3732 operator Matcher<Container>() const {
3734 !IsHashTable<GTEST_REMOVE_REFERENCE_AND_CONST_(Container)>::value ||
3738 typedef GTEST_REMOVE_REFERENCE_AND_CONST_(Container) RawContainer;
3746 return Matcher<Container>(new ElementsAreMatcherImpl<const Container&>(
3763 template <typename Container>
3764 operator Matcher<Container>() const {
3765 return Matcher<Container>(
3766 new UnorderedElementsAreMatcherImpl<const Container&>(
3782 template <typename Container>
3783 operator Matcher<Container>() const {
3785 !IsHashTable<GTEST_REMOVE_REFERENCE_AND_CONST_(Container)>::value,
3788 return Matcher<Container>(new ElementsAreMatcherImpl<const Container&>(
4139 // ElementsAreArray(container)
4171 template <typename Container>
4172 inline auto ElementsAreArray(const Container& container)
4173 -> decltype(ElementsAreArray(container.begin(), container.end())) {
4174 return ElementsAreArray(container.begin(), container.end());
4186 // UnorderedElementsAreArray(container)
4192 // The matchers can be specified as an array, a pointer and count, a container,
4217 template <typename Container>
4219 typename Container::value_type>
4220 UnorderedElementsAreArray(const Container& container) {
4221 return UnorderedElementsAreArray(container.begin(), container.end());
4676 // Returns a matcher that matches the container size. The container must
4680 // EXPECT_THAT(container, SizeIs(2)); // Checks container has 2 elements.
4681 // EXPECT_THAT(container, SizeIs(Le(2)); // Checks container has at most 2.
4688 // Returns a matcher that matches the distance between the container's begin()
4689 // iterator and its end() iterator, i.e. the size of the container. This matcher
4691 // do not implement size(). The container must provide const_iterator (with
4699 // Returns a matcher that matches an equal container.
4701 // values that are included in one container but not the other. (Duplicate
4703 template <typename Container>
4705 internal::ContainerEqMatcher<typename std::remove_const<Container>::type>>
4706 ContainerEq(const Container& rhs) {
4707 return MakePolymorphicMatcher(internal::ContainerEqMatcher<Container>(rhs));
4710 // Returns a matcher that matches a container that, when sorted using
4719 // Returns a matcher that matches a container that, when sorted using
4729 // Matches an STL-style container or a native array that contains the
4734 // LHS container and the RHS container respectively.
4735 template <typename TupleMatcher, typename Container>
4737 typename std::remove_const<Container>::type>
4738 Pointwise(const TupleMatcher& tuple_matcher, const Container& rhs) {
4739 return internal::PointwiseMatcher<TupleMatcher, Container>(tuple_matcher,
4751 // container or a native array that contains the same number of
4752 // elements as in rhs, where in some permutation of the container, its
4756 // the types of elements in the LHS container and the RHS container
4770 // STL-style container and it being a native C-style array.
4797 // Matches an STL-style container or a native array that contains at
4836 // IsSupersetOf(container)
4840 // of matchers exists. In other words, a container matches
4842 // {y1, ..., yn} of some of the container's elements where y1 matches e1,
4843 // ..., and yn matches en. Obviously, the size of the container must be >= n
4850 // for elements in different slots of the container.
4856 // The matchers can be specified as an array, a pointer and count, a container,
4881 template <typename Container>
4883 typename Container::value_type>
4884 IsSupersetOf(const Container& container) {
4885 return IsSupersetOf(container.begin(), container.end());
4897 // IsSubsetOf(container)
4901 // exists. In other words, a container matches IsSubsetOf({e1, ..., en}) if and
4903 // container using UnorderedElementsAre. Obviously, the size of the container
4911 // elements in different slots of the container.
4913 // The matchers can be specified as an array, a pointer and count, a container,
4938 template <typename Container>
4940 typename Container::value_type>
4941 IsSubsetOf(const Container& container) {
4942 return IsSubsetOf(container.begin(), container.end());
4951 // Matches an STL-style container or a native array that contains only
4959 // // Each(m) matches an empty container, regardless of what m is.
5131 // AnyOfArray(container)
5140 // AllOfArray(container)
5147 // The matchers can be specified as an array, a pointer and count, a container,
5187 template <typename Container>
5188 inline internal::AnyOfArrayMatcher<typename Container::value_type> AnyOfArray(
5189 const Container& container) {
5190 return AnyOfArray(container.begin(), container.end());
5193 template <typename Container>
5194 inline internal::AllOfArrayMatcher<typename Container::value_type> AllOfArray(
5195 const Container& container) {
5196 return AllOfArray(container.begin(), container.end());