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