Lines Matching +full:int +full:- +full:property
30 // Google Mock - a framework for writing C++ mock classes.
48 // Silence warning C4244: 'initializing': conversion from 'int' to 'short',
52 #include "test/gmock-matchers_test.h"
58 std::vector<std::unique_ptr<int>> MakeUniquePtrs(const std::vector<int>& ints) {
59 std::vector<std::unique_ptr<int>> pointers;
60 for (int i : ints) pointers.emplace_back(new int(i));
82 vector<int> test_vector{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
100 vector<int> test_vector{2, 1, 8, 5, 4, 6, 7, 3, 9, 12, 11, 10};
142 static int n;
150 "Actual: 0" + OfType("int") + ", which is located @");
166 Matcher<int> is_greater_than_5 = Gt(5);
171 OfType("int"));
175 const Matcher<int*> m = Pointee(Ge(0));
177 int n = 1;
179 n = -1;
189 x = -1;
195 const Matcher<int* const&> m = Pointee(Ge(0));
197 int n = 1;
199 n = -1;
210 x = -1;
217 const Matcher<std::unique_ptr<int>> m = Pointee(Ge(0));
219 std::unique_ptr<int> n(new int(1));
224 const Matcher<std::unique_ptr<const int>> m = Pointee(Ge(0));
226 // There's no implicit conversion from unique_ptr<int> to const
227 // unique_ptr<const int>, so we must pass a unique_ptr<const int> into the
229 std::unique_ptr<const int> n(new int(1));
234 int n = 1;
235 const Matcher<int*> m = Pointer(Eq(&n));
239 int* p = nullptr;
245 int n = 1;
246 const Matcher<const int*> m = Pointer(Eq(&n));
250 int* p = nullptr;
256 std::unique_ptr<int> n(new int(10));
257 int* raw_n = n.get();
258 const Matcher<std::unique_ptr<int>> m = Pointer(Eq(raw_n));
264 std::unique_ptr<const int> n(new int(10));
265 const int* raw_n = n.get();
266 const Matcher<std::unique_ptr<const int>> m = Pointer(Eq(raw_n));
268 // There's no implicit conversion from unique_ptr<int> to const
269 // unique_ptr<const int>, so we must pass a unique_ptr<const int> into the
271 std::unique_ptr<const int> p(new int(10));
275 // Minimal const-propagating pointer.
287 // Most smart pointers return non-const T* and T& from the next methods.
298 const Matcher<ConstPropagatingPtr<int>> m = Pointee(Lt(5));
299 int three = 3;
300 const ConstPropagatingPtr<int> co(&three);
301 ConstPropagatingPtr<int> o(&three);
306 EXPECT_FALSE(m.Matches(ConstPropagatingPtr<int>()));
316 const Matcher<int*> m = Pointee(5);
318 int n = 5;
320 n = -1;
326 const Matcher<int*> m = Pointee(Gt(3));
343 const Matcher<int*> m = Pointee(0);
344 int n = 42;
345 EXPECT_EQ("which points to 42" + OfType("int"), Explain(m, &n));
351 Uncopyable() : value_(-1) {}
352 explicit Uncopyable(int a_value) : value_(a_value) {}
354 int value() const { return value_; }
355 void set_value(int i) { value_ = i; }
358 int value_;
370 // A user-defined struct for testing Field().
376 int x; // A non-const field.
389 // Tests that Field(&Foo::field, ...) works when field is non-const.
397 a.x = -1;
449 a.x = -1;
454 // is a sub-type of Foo.
462 d.x = -1;
469 // The field is an int, but the inner matcher expects a signed char.
474 a.x = -1;
500 EXPECT_EQ("whose given field is 1" + OfType("int"), Explain(m, a));
504 "whose given field is 1" + OfType("int") + ", which is 1 more than 0",
513 EXPECT_EQ("whose field `field_name` is 1" + OfType("int"), Explain(m, a));
516 EXPECT_EQ("whose field `field_name` is 1" + OfType("int") +
529 a.x = -1;
533 // Tests that Field() works when the argument is a pointer to non-const.
539 a.x = -1;
549 a.x = -1;
560 // is a sub-type of const Foo*.
568 d.x = -1;
595 EXPECT_EQ("which points to an object whose given field is 1" + OfType("int"),
599 EXPECT_EQ("which points to an object whose given field is 1" + OfType("int") +
611 "which points to an object whose field `field_name` is 1" + OfType("int"),
616 OfType("int") + ", which is 1 more than 0",
620 // A user-defined class for testing Property().
625 // A getter that returns a non-reference.
626 int n() const { return n_; }
628 void set_n(int new_n) { n_ = new_n; }
637 // A getter that returns a reference to non-const.
641 int n_;
649 // A derived class for testing Property().
652 int k() const { return k_; }
655 int k_;
660 // Tests that Property(&Foo::property, ...) works when property()
661 // returns a non-reference.
663 Matcher<const AClass&> m = Property(&AClass::n, Ge(0));
664 Matcher<const AClass&> m_with_name = Property("n", &AClass::n, Ge(0));
671 a.set_n(-1);
676 // Tests that Property(&Foo::property, ...) works when property()
679 Matcher<const AClass&> m = Property(&AClass::s, StartsWith("hi"));
681 Property("s", &AClass::s, StartsWith("hi"));
693 // Tests that Property(&Foo::property, ...) works when property() is
694 // ref-qualified.
696 Matcher<const AClass&> m = Property(&AClass::s_ref, StartsWith("hi"));
698 Property("s", &AClass::s_ref, StartsWith("hi"));
710 // Tests that Property(&Foo::property, ...) works when property()
711 // returns a reference to non-const.
716 Matcher<const AClass&> m = Property(&AClass::x, Ref(x));
719 m = Property(&AClass::x, Not(Ref(x)));
723 // Tests that Property(&Foo::property, ...) works when the argument is
726 Matcher<AClass> m = Property(&AClass::s, StartsWith("hi"));
736 // Tests that Property(&Foo::property, ...) works when the argument's
737 // type is a sub-type of Foo.
739 // The matcher expects a DerivedClass, but inside the Property() we
741 Matcher<const DerivedClass&> m = Property(&AClass::n, Ge(0));
747 d.set_n(-1);
751 // Tests that Property(&Foo::property, m) works when property()'s type
754 // n() returns an int but the inner matcher expects a signed char.
755 Matcher<const AClass&> m = Property(&AClass::n, Matcher<signed char>(Ge(0)));
758 Property("n", &AClass::n, Matcher<signed char>(Ge(0)));
763 a.set_n(-1);
768 // Tests that Property() can describe itself.
770 Matcher<const AClass&> m = Property(&AClass::n, Ge(0));
772 EXPECT_EQ("is an object whose given property is >= 0", Describe(m));
773 EXPECT_EQ("is an object whose given property isn't >= 0",
778 Matcher<const AClass&> m = Property("fancy_name", &AClass::n, Ge(0));
780 EXPECT_EQ("is an object whose property `fancy_name` is >= 0", Describe(m));
781 EXPECT_EQ("is an object whose property `fancy_name` isn't >= 0",
785 // Tests that Property() can explain the match result.
787 Matcher<const AClass&> m = Property(&AClass::n, Ge(0));
791 EXPECT_EQ("whose given property is 1" + OfType("int"), Explain(m, a));
793 m = Property(&AClass::n, GreaterThan(0));
795 "whose given property is 1" + OfType("int") + ", which is 1 more than 0",
800 Matcher<const AClass&> m = Property("fancy_name", &AClass::n, Ge(0));
804 EXPECT_EQ("whose property `fancy_name` is 1" + OfType("int"), Explain(m, a));
806 m = Property("fancy_name", &AClass::n, GreaterThan(0));
807 EXPECT_EQ("whose property `fancy_name` is 1" + OfType("int") +
814 // Tests that Property() works when the argument is a pointer to const.
816 Matcher<const AClass*> m = Property(&AClass::n, Ge(0));
822 a.set_n(-1);
826 // Tests that Property() works when the argument is a pointer to non-const.
828 Matcher<AClass*> m = Property(&AClass::s, StartsWith("hi"));
838 // Tests that Property() works when the argument is a reference to a
841 Matcher<AClass* const&> m = Property(&AClass::s, StartsWith("hi"));
851 // Tests that Property() does not match the NULL pointer.
853 Matcher<const AClass*> m = Property(&AClass::x, _);
857 // Tests that Property(&Foo::property, ...) works when the argument's
858 // type is a sub-type of const Foo*.
860 // The matcher expects a DerivedClass, but inside the Property() we
862 Matcher<const DerivedClass*> m = Property(&AClass::n, Ge(0));
868 d.set_n(-1);
872 // Tests that Property() can describe itself when used to match a pointer.
874 Matcher<const AClass*> m = Property(&AClass::n, Ge(0));
876 EXPECT_EQ("is an object whose given property is >= 0", Describe(m));
877 EXPECT_EQ("is an object whose given property isn't >= 0",
882 Matcher<const AClass*> m = Property("fancy_name", &AClass::n, Ge(0));
884 EXPECT_EQ("is an object whose property `fancy_name` is >= 0", Describe(m));
885 EXPECT_EQ("is an object whose property `fancy_name` isn't >= 0",
889 // Tests that Property() can explain the result of matching a pointer.
891 Matcher<const AClass*> m = Property(&AClass::n, Ge(0));
897 "which points to an object whose given property is 1" + OfType("int"),
900 m = Property(&AClass::n, GreaterThan(0));
901 EXPECT_EQ("which points to an object whose given property is 1" +
902 OfType("int") + ", which is 1 more than 0",
907 Matcher<const AClass*> m = Property("fancy_name", &AClass::n, Ge(0));
912 EXPECT_EQ("which points to an object whose property `fancy_name` is 1" +
913 OfType("int"),
916 m = Property("fancy_name", &AClass::n, GreaterThan(0));
917 EXPECT_EQ("which points to an object whose property `fancy_name` is 1" +
918 OfType("int") + ", which is 1 more than 0",
926 std::string IntToStringFunction(int input) {
933 Matcher<int> matcher = ResultOf(&IntToStringFunction, Eq(std::string("foo")));
941 Matcher<int> matcher = ResultOf(&IntToStringFunction, StrEq("foo"));
955 Matcher<int> matcher =
964 int IntFunction(int input) { return input == 42 ? 80 : 90; }
967 Matcher<int> matcher = ResultOf(&IntFunction, Ge(85));
968 EXPECT_EQ("which is mapped by the given callable to 90" + OfType("int"),
972 EXPECT_EQ("which is mapped by the given callable to 90" + OfType("int") +
978 Matcher<int> matcher = ResultOf("magic int conversion", &IntFunction, Ge(85));
979 EXPECT_EQ("whose magic int conversion is 90" + OfType("int"),
982 matcher = ResultOf("magic int conversion", &IntFunction, GreaterThan(85));
983 EXPECT_EQ("whose magic int conversion is 90" + OfType("int") +
989 // returns a non-reference.
991 Matcher<int> matcher = ResultOf(&IntFunction, Eq(80));
998 // returns a reference to non-const.
1038 // IntFunction() returns int but the inner matcher expects a signed char.
1039 Matcher<int> matcher = ResultOf(IntFunction, Matcher<signed char>(Ge(85)));
1049 ResultOf(static_cast<std::string (*)(int dummy)>(nullptr),
1057 Matcher<int> matcher = ResultOf(IntToStringFunction, StrEq("foo"));
1065 std::string operator()(int input) const { return IntToStringFunction(input); }
1069 Matcher<int> matcher = ResultOf(Functor(), Eq(std::string("foo")));
1079 typedef int result_type;
1080 int operator()(int n) { return n; }
1081 int operator()(const char* s) { return static_cast<int>(strlen(s)); }
1082 std::string operator()(int* p) { return p ? "good ptr" : "null"; }
1086 Matcher<int> matcher_int = ResultOf(PolymorphicFunctor(), Ge(5));
1098 Matcher<int*> matcher = ResultOf(PolymorphicFunctor(), "good ptr");
1100 int n = 0;
1106 Matcher<int> matcher = ResultOf(
1107 [](int str_len) {
1116 Matcher<std::unique_ptr<int>> matcher = ResultOf(
1117 [](const std::unique_ptr<int>& str_len) {
1121 EXPECT_TRUE(matcher.Matches(std::unique_ptr<int>(new int(3))));
1122 EXPECT_FALSE(matcher.Matches(std::unique_ptr<int>(new int(1))));
1125 const int* ReferencingFunction(const int& n) { return &n; }
1128 typedef const int* result_type;
1129 result_type operator()(const int& n) { return &n; }
1133 const int n = 1;
1134 const int n2 = 1;
1135 Matcher<const int&> matcher2 = ResultOf(ReferencingFunction, Eq(&n));
1139 Matcher<const int&> matcher3 = ResultOf(ReferencingFunctor(), Eq(&n));
1145 vector<int> container;
1157 map<std::string, int> container;
1169 vector<int> container;
1170 Matcher<const vector<int>&> m = SizeIs(1);
1185 int size() const { return 1; }
1194 Matcher<vector<int>> m = SizeIs(2);
1200 Matcher<vector<int>> m1 = SizeIs(2);
1201 Matcher<vector<int>> m2 = SizeIs(Lt(2u));
1202 Matcher<vector<int>> m3 = SizeIs(AnyOf(0, 3));
1203 Matcher<vector<int>> m4 = SizeIs(Gt(1u));
1204 vector<int> container;
1218 const vector<int> numbers;
1219 EXPECT_THAT(numbers, WhenSortedBy(less<int>(), ElementsAre()));
1220 EXPECT_THAT(numbers, Not(WhenSortedBy(less<int>(), ElementsAre(1))));
1247 const int numbers[] = {1, 3, 2, 4};
1248 const int sorted_numbers[] = {1, 2, 3, 4};
1249 EXPECT_THAT(numbers, WhenSortedBy(less<int>(), ElementsAre(1, 2, 3, 4)));
1251 WhenSortedBy(less<int>(), ElementsAreArray(sorted_numbers)));
1252 EXPECT_THAT(numbers, Not(WhenSortedBy(less<int>(), ElementsAre(1, 3, 2, 4))));
1256 const Matcher<vector<int>> m = WhenSortedBy(less<int>(), ElementsAre(1, 2));
1270 const int a[] = {2, 1};
1272 Explain(WhenSortedBy(less<int>(), ElementsAre(2, 3)), a));
1274 Explain(WhenSortedBy(less<int>(), ElementsAre(1, 2)), a));
1281 const vector<int> numbers;
1297 map<std::string, int> word_counts;
1310 multimap<int, int> ifib;
1326 std::deque<int> d;
1334 std::deque<int> d;
1337 Matcher<const std::vector<int>&> vector_match = ElementsAre(1, 2);
1339 Matcher<const std::vector<int>&> not_vector_match = ElementsAre(2, 1);
1343 // Deliberately bare pseudo-container.
1375 const value_type* operator->() const { return &*pos_; }
1377 s_->remainder_.erase(pos_++);
1391 PostIncrProxy operator++(int) {
1425 const int a[5] = {2, 1, 4, 5, 3};
1426 Streamlike<int> s(a, a + 5);
1427 Streamlike<int>::const_iterator it = s.begin();
1428 const int* ip = a;
1430 SCOPED_TRACE(ip - a);
1438 std::forward_list<int> container;
1450 const int a[5] = {1, 2, 3, 4, 5};
1451 Streamlike<int> s(a, a + 5);
1456 Matcher<vector<int>> m = BeginEndDistanceIs(2);
1469 Matcher<vector<int>> m1 = BeginEndDistanceIs(2);
1470 Matcher<vector<int>> m2 = BeginEndDistanceIs(Lt(2));
1471 Matcher<vector<int>> m3 = BeginEndDistanceIs(AnyOf(0, 3));
1472 Matcher<vector<int>> m4 = BeginEndDistanceIs(GreaterThan(1));
1473 vector<int> container;
1501 const int a[5] = {2, 1, 4, 5, 3};
1502 Streamlike<int> s(std::begin(a), std::end(a));
1508 const int a[] = {2, 1, 4, 5, 3};
1509 Streamlike<int> s(std::begin(a), std::end(a));
1510 Matcher<const std::vector<int>&> vector_match = ElementsAre(1, 2, 3, 4, 5);
1516 const int subset[] = {1, 4};
1517 const int superset[] = {1, 2, 4};
1518 const int disjoint[] = {1, 0, 3};
1527 const int not_enough[] = {1, 2};
1528 const int enough[] = {1, 1, 2};
1529 const int expected[] = {1, 1};
1535 vector<int> numbers;
1536 vector<int> expected;
1553 const int a[5] = {1, 2, 3, 4, 5};
1554 Streamlike<int> s(std::begin(a), std::end(a));
1556 vector<int> expected;
1567 const int actual[] = {3, 1, 2};
1569 ::std::list<int> expected;
1579 typedef std::vector<int> IntVec;
1587 " - an element is equal to 111\n"
1588 " - an element is equal to 222\n"
1589 " - an element is equal to 333"));
1593 typedef std::vector<int> IntVec;
1601 " - an element is equal to 111\n"
1602 " - an element is equal to 222\n"
1603 " - an element is equal to 333"));
1607 std::vector<int> v;
1610 std::vector<int> expected;
1625 " - element #0 is matched by matcher #1,\n"
1626 " - element #2 is matched by matcher #0"));
1630 const int numbers[] = {1, 3, 6, 2, 4, 5};
1644 const int subset[] = {1, 4};
1645 const int superset[] = {1, 2, 4};
1646 const int disjoint[] = {1, 0, 3};
1655 const int not_enough[] = {1, 2};
1656 const int enough[] = {1, 1, 2};
1657 const int actual[] = {1, 1};
1663 vector<int> numbers;
1664 vector<int> expected;
1681 const int a[5] = {1, 2};
1682 Streamlike<int> s(std::begin(a), std::end(a));
1684 vector<int> expected;
1693 const int actual[] = {3, 1, 2};
1695 ::std::list<int> expected;
1706 typedef std::vector<int> IntVec;
1715 " - an element is equal to 111\n"
1716 " - an element is equal to 222\n"
1717 " - an element is equal to 333"));
1721 typedef std::vector<int> IntVec;
1729 " - an element is equal to 111\n"
1730 " - an element is equal to 222\n"
1731 " - an element is equal to 333"));
1735 std::vector<int> v;
1738 std::vector<int> expected;
1753 " - element #0 is matched by matcher #1,\n"
1754 " - element #1 is matched by matcher #2"));
1758 const int numbers[] = {1, 2, 3};
1771 // Tests using ElementsAre() and ElementsAreArray() with stream-like
1775 const int a[5] = {1, 2, 3, 4, 5};
1776 Streamlike<int> s(std::begin(a), std::end(a));
1782 const int a[5] = {1, 2, 3, 4, 5};
1783 Streamlike<int> s(std::begin(a), std::end(a));
1785 vector<int> expected;
1799 objs[0].set_value(-3);
1801 EXPECT_THAT(objs, ElementsAre(UncopyableIs(-3), Truly(ValueIsPositive)));
1814 const int actual[] = {3, 1, 2};
1816 ::std::list<int> expected;
1829 const int a[] = {0, 1, 2, 3, 4};
1830 std::vector<int> s(std::begin(a), std::end(a));
1853 const int a[5] = {2, 1, 4, 5, 3};
1854 Streamlike<int> s(std::begin(a), std::end(a));
1856 ::std::vector<int> expected;
1869 const int actual[] = {3, 1, 2};
1871 ::std::list<int> expected;
1882 const int a[5] = {2, 1, 4, 5, 3};
1894 const int a[5] = {2, 1, 4, 5, 3};
1903 const int a[5] = {2, 1, 4, 5, 3};
1907 EXPECT_THAT(a, UnorderedElementsAreArray<Matcher<int>>(
1908 {Eq(1), Ne(-2), Ge(3), Le(4), Eq(5)}));
1909 EXPECT_THAT(a, Not(UnorderedElementsAreArray<Matcher<int>>(
1910 {Eq(1), Ne(-2), Ge(3), Le(4), Eq(6)})));
1922 typedef std::vector<int> IntVec;
1927 objs[0].set_value(-3);
1930 UnorderedElementsAre(Truly(ValueIsPositive), UncopyableIs(-3)));
1934 const int a[] = {1, 2, 3};
1935 std::vector<int> s(std::begin(a), std::end(a));
1944 const int a[] = {1, 2, 3};
1945 std::vector<int> s(std::begin(a), std::end(a));
1946 std::vector<Matcher<int>> mv;
1960 const int a[5] = {2, 1, 4, 5, 3};
1961 Streamlike<int> s(std::begin(a), std::end(a));
1974 // slow for many real-world inputs. This test shows that our matcher can match
1980 std::vector<int> s;
1981 std::vector<Matcher<int>> mv;
1982 for (int i = 0; i < 100; ++i) {
1996 std::vector<int> s;
1997 std::vector<Matcher<int>> mv;
1998 for (int i = 0; i < 100; ++i) {
2012 std::vector<int> v;
2028 std::vector<int> v;
2040 std::vector<int> v;
2052 std::vector<int> v;
2064 std::vector<int> v;
2081 static std::string EMString(int element, int matcher) {
2122 " - element #0 is equal to 111, and\n"
2123 " - element #1 is equal to 222, and\n"
2124 " - element #2 is equal to 333"));
2136 " - element #0 is equal to 123, and\n"
2137 " - element #1 is equal to 234, and\n"
2138 " - element #2 is equal to 345"));
2146 set<int> a; // empty
2148 Matcher<set<int>> m = Each(2);
2151 Matcher<const int(&)[1]> n = Each(1); // NOLINT
2153 const int b[1] = {1};
2171 Matcher<vector<int>> m = Each(1);
2174 Matcher<vector<int>> m2 = Not(m);
2179 vector<int> some_vector;
2199 map<const char*, int> my_map;
2204 map<std::string, int> another_map;
2217 const int a[] = {1, 2, 3};
2223 const int a[] = {1, 2};
2224 const int* const pointer = a;
2264 vector<int> rhs;
2268 const Matcher<const vector<int>&> m = Pointwise(IsHalfOf(), rhs);
2275 "index i where x and the i-th value of { 1, 2, 3 } are a pair "
2285 int lhs[] = {1, 2};
2286 const Matcher<const int(&)[2]> m = Pointwise(IsHalfOf(), rhs);
2295 const int lhs[] = {1, 2, 3};
2296 vector<int> rhs;
2305 const int rhs[] = {1, 2, 3};
2306 vector<int> lhs;
2325 const vector<int> lhs{2, 4, 6};
2332 const int rhs[1] = {0};
2336 const int rhs2[3] = {0, 1, 2};
2342 const int rhs[3] = {2, 6, 4};
2352 const int rhs[3] = {2, 4, 6};
2359 const int rhs[3] = {2, 4, 6};
2360 const Matcher<std::tuple<const double&, const int&>> m1 = IsHalfOf();
2364 // This type works as a std::tuple<const double&, const int&> can be
2365 // implicitly cast to std::tuple<double, int>.
2366 const Matcher<std::tuple<double, int>> m2 = IsHalfOf();
2378 EXPECT_CALL(helper, Call(Pointwise(PointeeEquals(), std::vector<int>{1, 2})));
2383 vector<int> rhs;
2387 const Matcher<const vector<int>&> m = UnorderedPointwise(IsHalfOf(), rhs);
2391 " - element #0 and 1 are a pair where the first is half of the second, "
2393 " - element #1 and 2 are a pair where the first is half of the second, "
2395 " - element #2 and 3 are a pair where the first is half of the second",
2400 " - element #0 and 1 are a pair where the first is half of the second, "
2402 " - element #1 and 2 are a pair where the first is half of the second, "
2404 " - element #2 and 3 are a pair where the first is half of the second",
2413 int lhs[] = {2, 1};
2414 const Matcher<const int(&)[2]> m = UnorderedPointwise(IsHalfOf(), rhs);
2423 const int lhs[] = {1, 2, 3};
2424 vector<int> rhs;
2433 const int rhs[] = {1, 2, 3};
2434 vector<int> lhs;
2443 const vector<int> lhs{2, 4, 6};
2450 const int rhs[1] = {0};
2455 const int rhs2[3] = {0, 1, 2};
2461 const int rhs[3] = {2, 6, 6};
2471 const int rhs[3] = {2, 4, 6};
2477 const int rhs[3] = {6, 4, 2};
2483 const int rhs[3] = {4, 6, 2};
2484 const Matcher<std::tuple<const double&, const int&>> m1 = IsHalfOf();
2487 // This type works as a std::tuple<const double&, const int&> can be
2488 // implicitly cast to std::tuple<double, int>.
2489 const Matcher<std::tuple<double, int>> m2 = IsHalfOf();
2496 std::vector<int>{1, 2})));
2501 std::unique_ptr<int> p(new int(3));
2523 return !listener->IsInterested();
2533 return listener->IsInterested();
2551 return predicate_formatter("dummy-name", behavior);
2566 "Value of: dummy-name\nExpected: [DescribeTo]\n"
2576 "Value of: dummy-name\nExpected: [DescribeTo]\n"
2587 Matcher<const vector<int>&> m = ElementsAre();
2592 Matcher<vector<int>> m = ElementsAre(Gt(5));
2606 Matcher<vector<int>> m = ElementsAre();
2611 Matcher<const list<int>&> m = ElementsAre(Gt(5));
2628 Matcher<const list<int>&> m = ElementsAre(1, Ne(2));
2630 list<int> test_list;
2637 Matcher<const vector<int>&> m =
2640 const int a[] = {10, 0, 100};
2641 vector<int> test_vector(std::begin(a), std::end(a));
2649 Matcher<const list<int>&> m = ElementsAre(1, 3);
2651 list<int> test_list;
2660 Matcher<const vector<int>&> m = ElementsAre(1, GreaterThan(5));
2662 vector<int> v;
2696 vector<int> test_vector;
2703 vector<int> test_vector;
2710 vector<int> test_vector;
2717 vector<int> test_vector;
2726 const int a[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
2727 vector<int> test_vector(std::begin(a), std::end(a));
2778 int a[] = {0, 1, 2};
2779 vector<int> v(std::begin(a), std::end(a));
2786 int a[] = {0, 1, 2};
2787 vector<int> v(std::begin(a), std::end(a));
2794 int array[] = {0, 1, 2};
2804 MOCK_METHOD(void, Helper, (int* array, int size));
2814 int array[] = {0, 1};
2815 ::std::tuple<int*, size_t> array_as_tuple(array, 2);
2856 int x = 1;
2857 int y = 2;
2859 ::testing::internal::ElementsAreMatcher<std::tuple<int, int>>
2863 const int array1[] = {1, 2};
2865 const int array2[] = {0, 0};
2874 const int a[] = {1, 2, 3};
2876 vector<int> test_vector(std::begin(a), std::end(a));
2919 const int a[] = {1, 2, 3};
2920 vector<int> test_vector(std::begin(a), std::end(a));
2921 const vector<int> expected(std::begin(a), std::end(a));
2928 const int a[5] = {1, 2, 3, 4, 5};
2942 const int a[5] = {1, 2, 3, 4, 5};
2948 const int a[5] = {1, 2, 3, 4, 5};
2953 a, ElementsAreArray<Matcher<int>>({Eq(1), Ne(-2), Ge(3), Le(4), Eq(5)}));
2954 EXPECT_THAT(a, Not(ElementsAreArray<Matcher<int>>(
2955 {Eq(1), Ne(-2), Ge(3), Le(4), Eq(6)})));
2959 const int a[] = {1, 2, 3};
2960 const Matcher<int> kMatchers[] = {Eq(1), Eq(2), Eq(3)};
2961 vector<int> test_vector(std::begin(a), std::end(a));
2962 const vector<Matcher<int>> expected(std::begin(kMatchers),
2970 const int a[] = {1, 2, 3};
2971 const vector<int> test_vector(std::begin(a), std::end(a));
2972 const vector<int> expected(std::begin(a), std::end(a));
2977 int* const null_int = nullptr;
2979 EXPECT_THAT((vector<int>()), ElementsAreArray(null_int, null_int));
2994 const int a[] = {1, 2, 3};
2995 vector<int> test_vector(std::begin(a), std::end(a));
2996 vector<int> expect(std::begin(a), std::end(a));
2997 ElementsAreArrayMatcher<int> matcher_maker =
3002 for (int& i : expect) {
3015 list<int> some_list;
3033 list<int> some_list;
3040 set<int> some_set;
3057 set<int> some_set;
3068 const int a[2] = {1, 2};
3069 Matcher<const int(&)[2]> m = Contains(2);
3083 Matcher<vector<int>> m = Contains(1);
3086 Matcher<vector<int>> m2 = Not(m);
3091 map<std::string, int> my_map;
3094 EXPECT_THAT(my_map, Contains(pair<const char* const, int>(bar, 2)));
3096 map<std::string, int> another_map;
3102 Contains(pair<const std::string, int>(std::string("fee"), 1)));
3103 EXPECT_THAT(another_map, Contains(pair<const std::string, int>("fie", 2)));
3107 map<int, int> some_map;
3110 EXPECT_THAT(some_map, Not(Contains(pair<const int, int>(2, 23))));
3119 int int_array[] = {1, 2, 3, 4};
3124 const int a[] = {1, 2, 3};
3130 const int a[] = {1, 2};
3131 const int* const pointer = a;
3137 int a[][3] = {{1, 2, 3}, {4, 5, 6}};