Lines Matching full:matches
53 // Tests that Eq() matches a 2-tuple where the first field == the
57 EXPECT_TRUE(m.Matches(Tuple2(5L, 5))); in TEST()
58 EXPECT_FALSE(m.Matches(Tuple2(5L, 6))); in TEST()
67 // Tests that Ge() matches a 2-tuple where the first field >= the
71 EXPECT_TRUE(m.Matches(Tuple2(5L, 4))); in TEST()
72 EXPECT_TRUE(m.Matches(Tuple2(5L, 5))); in TEST()
73 EXPECT_FALSE(m.Matches(Tuple2(5L, 6))); in TEST()
82 // Tests that Gt() matches a 2-tuple where the first field > the
86 EXPECT_TRUE(m.Matches(Tuple2(5L, 4))); in TEST()
87 EXPECT_FALSE(m.Matches(Tuple2(5L, 5))); in TEST()
88 EXPECT_FALSE(m.Matches(Tuple2(5L, 6))); in TEST()
97 // Tests that Le() matches a 2-tuple where the first field <= the
101 EXPECT_TRUE(m.Matches(Tuple2(5L, 6))); in TEST()
102 EXPECT_TRUE(m.Matches(Tuple2(5L, 5))); in TEST()
103 EXPECT_FALSE(m.Matches(Tuple2(5L, 4))); in TEST()
112 // Tests that Lt() matches a 2-tuple where the first field < the
116 EXPECT_TRUE(m.Matches(Tuple2(5L, 6))); in TEST()
117 EXPECT_FALSE(m.Matches(Tuple2(5L, 5))); in TEST()
118 EXPECT_FALSE(m.Matches(Tuple2(5L, 4))); in TEST()
127 // Tests that Ne() matches a 2-tuple where the first field != the
131 EXPECT_TRUE(m.Matches(Tuple2(5L, 6))); in TEST()
132 EXPECT_TRUE(m.Matches(Tuple2(5L, 4))); in TEST()
133 EXPECT_FALSE(m.Matches(Tuple2(5L, 5))); in TEST()
148 EXPECT_TRUE(matcher.Matches(pointers)); in TEST()
151 // Tests that IsNan() matches a NaN, with float.
158 EXPECT_TRUE(m.Matches(quiet_nan)); in TEST()
159 EXPECT_TRUE(m.Matches(other_nan)); in TEST()
160 EXPECT_FALSE(m.Matches(real_value)); in TEST()
163 EXPECT_TRUE(m_ref.Matches(quiet_nan)); in TEST()
164 EXPECT_TRUE(m_ref.Matches(other_nan)); in TEST()
165 EXPECT_FALSE(m_ref.Matches(real_value)); in TEST()
168 EXPECT_TRUE(m_cref.Matches(quiet_nan)); in TEST()
169 EXPECT_TRUE(m_cref.Matches(other_nan)); in TEST()
170 EXPECT_FALSE(m_cref.Matches(real_value)); in TEST()
173 // Tests that IsNan() matches a NaN, with double.
180 EXPECT_TRUE(m.Matches(quiet_nan)); in TEST()
181 EXPECT_TRUE(m.Matches(other_nan)); in TEST()
182 EXPECT_FALSE(m.Matches(real_value)); in TEST()
185 EXPECT_TRUE(m_ref.Matches(quiet_nan)); in TEST()
186 EXPECT_TRUE(m_ref.Matches(other_nan)); in TEST()
187 EXPECT_FALSE(m_ref.Matches(real_value)); in TEST()
190 EXPECT_TRUE(m_cref.Matches(quiet_nan)); in TEST()
191 EXPECT_TRUE(m_cref.Matches(other_nan)); in TEST()
192 EXPECT_FALSE(m_cref.Matches(real_value)); in TEST()
195 // Tests that IsNan() matches a NaN, with long double.
202 EXPECT_TRUE(m.Matches(quiet_nan)); in TEST()
203 EXPECT_TRUE(m.Matches(other_nan)); in TEST()
204 EXPECT_FALSE(m.Matches(real_value)); in TEST()
207 EXPECT_TRUE(m_ref.Matches(quiet_nan)); in TEST()
208 EXPECT_TRUE(m_ref.Matches(other_nan)); in TEST()
209 EXPECT_FALSE(m_ref.Matches(real_value)); in TEST()
212 EXPECT_TRUE(m_cref.Matches(quiet_nan)); in TEST()
213 EXPECT_TRUE(m_cref.Matches(other_nan)); in TEST()
214 EXPECT_FALSE(m_cref.Matches(real_value)); in TEST()
220 EXPECT_FALSE(mf.Matches(std::numeric_limits<float>::quiet_NaN())); in TEST()
221 EXPECT_FALSE(mf.Matches(std::nanf("1"))); in TEST()
222 EXPECT_TRUE(mf.Matches(1.0)); in TEST()
225 EXPECT_FALSE(md.Matches(std::numeric_limits<double>::quiet_NaN())); in TEST()
226 EXPECT_FALSE(md.Matches(std::nan("1"))); in TEST()
227 EXPECT_TRUE(md.Matches(1.0)); in TEST()
230 EXPECT_FALSE(mld.Matches(std::numeric_limits<long double>::quiet_NaN())); in TEST()
231 EXPECT_FALSE(mld.Matches(std::nanl("1"))); in TEST()
232 EXPECT_TRUE(mld.Matches(1.0)); in TEST()
259 // Tests that FloatEq() matches a 2-tuple where
260 // FloatEq(first field) matches the second field.
264 EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); in TEST()
265 EXPECT_TRUE(m.Matches(Tpl(0.3f, 0.1f + 0.1f + 0.1f))); in TEST()
266 EXPECT_FALSE(m.Matches(Tpl(1.1f, 1.0f))); in TEST()
275 // Tests that NanSensitiveFloatEq() matches a 2-tuple where
276 // NanSensitiveFloatEq(first field) matches the second field.
280 EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); in TEST()
281 EXPECT_TRUE(m.Matches(Tpl(std::numeric_limits<float>::quiet_NaN(), in TEST()
283 EXPECT_FALSE(m.Matches(Tpl(1.1f, 1.0f))); in TEST()
284 EXPECT_FALSE(m.Matches(Tpl(1.0f, std::numeric_limits<float>::quiet_NaN()))); in TEST()
285 EXPECT_FALSE(m.Matches(Tpl(std::numeric_limits<float>::quiet_NaN(), 1.0f))); in TEST()
294 // Tests that DoubleEq() matches a 2-tuple where
295 // DoubleEq(first field) matches the second field.
299 EXPECT_TRUE(m.Matches(Tpl(1.0, 1.0))); in TEST()
300 EXPECT_TRUE(m.Matches(Tpl(0.3, 0.1 + 0.1 + 0.1))); in TEST()
301 EXPECT_FALSE(m.Matches(Tpl(1.1, 1.0))); in TEST()
310 // Tests that NanSensitiveDoubleEq() matches a 2-tuple where
311 // NanSensitiveDoubleEq(first field) matches the second field.
315 EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); in TEST()
316 EXPECT_TRUE(m.Matches(Tpl(std::numeric_limits<double>::quiet_NaN(), in TEST()
318 EXPECT_FALSE(m.Matches(Tpl(1.1f, 1.0f))); in TEST()
319 EXPECT_FALSE(m.Matches(Tpl(1.0f, std::numeric_limits<double>::quiet_NaN()))); in TEST()
320 EXPECT_FALSE(m.Matches(Tpl(std::numeric_limits<double>::quiet_NaN(), 1.0f))); in TEST()
329 // Tests that FloatEq() matches a 2-tuple where
330 // FloatNear(first field, max_abs_error) matches the second field.
334 EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); in TEST()
335 EXPECT_TRUE(m.Matches(Tpl(1.3f, 1.0f))); in TEST()
336 EXPECT_FALSE(m.Matches(Tpl(1.8f, 1.0f))); in TEST()
345 // Tests that NanSensitiveFloatNear() matches a 2-tuple where
346 // NanSensitiveFloatNear(first field) matches the second field.
350 EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); in TEST()
351 EXPECT_TRUE(m.Matches(Tpl(1.1f, 1.0f))); in TEST()
352 EXPECT_TRUE(m.Matches(Tpl(std::numeric_limits<float>::quiet_NaN(), in TEST()
354 EXPECT_FALSE(m.Matches(Tpl(1.6f, 1.0f))); in TEST()
355 EXPECT_FALSE(m.Matches(Tpl(1.0f, std::numeric_limits<float>::quiet_NaN()))); in TEST()
356 EXPECT_FALSE(m.Matches(Tpl(std::numeric_limits<float>::quiet_NaN(), 1.0f))); in TEST()
365 // Tests that FloatEq() matches a 2-tuple where
366 // DoubleNear(first field, max_abs_error) matches the second field.
370 EXPECT_TRUE(m.Matches(Tpl(1.0, 1.0))); in TEST()
371 EXPECT_TRUE(m.Matches(Tpl(1.3, 1.0))); in TEST()
372 EXPECT_FALSE(m.Matches(Tpl(1.8, 1.0))); in TEST()
381 // Tests that NanSensitiveDoubleNear() matches a 2-tuple where
382 // NanSensitiveDoubleNear(first field) matches the second field.
386 EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); in TEST()
387 EXPECT_TRUE(m.Matches(Tpl(1.1f, 1.0f))); in TEST()
388 EXPECT_TRUE(m.Matches(Tpl(std::numeric_limits<double>::quiet_NaN(), in TEST()
390 EXPECT_FALSE(m.Matches(Tpl(1.6f, 1.0f))); in TEST()
391 EXPECT_FALSE(m.Matches(Tpl(1.0f, std::numeric_limits<double>::quiet_NaN()))); in TEST()
392 EXPECT_FALSE(m.Matches(Tpl(std::numeric_limits<double>::quiet_NaN(), 1.0f))); in TEST()
401 // Tests that Not(m) matches any value that doesn't match m.
405 EXPECT_TRUE(m.Matches(3)); in TEST()
406 EXPECT_FALSE(m.Matches(2)); in TEST()
428 EXPECT_TRUE(m.Matches(0)); in AllOfMatches()
430 EXPECT_FALSE(m.Matches(i)); in AllOfMatches()
432 EXPECT_TRUE(m.Matches(num + 1)); in AllOfMatches()
437 // Tests that AllOf(m1, ..., mn) matches any value that matches all of
442 EXPECT_TRUE(m.Matches(1)); in TEST()
443 EXPECT_TRUE(m.Matches(2)); in TEST()
444 EXPECT_FALSE(m.Matches(0)); in TEST()
445 EXPECT_FALSE(m.Matches(3)); in TEST()
448 EXPECT_TRUE(m.Matches(3)); in TEST()
449 EXPECT_FALSE(m.Matches(2)); in TEST()
450 EXPECT_FALSE(m.Matches(1)); in TEST()
451 EXPECT_FALSE(m.Matches(0)); in TEST()
454 EXPECT_TRUE(m.Matches(4)); in TEST()
455 EXPECT_FALSE(m.Matches(3)); in TEST()
456 EXPECT_FALSE(m.Matches(2)); in TEST()
457 EXPECT_FALSE(m.Matches(1)); in TEST()
458 EXPECT_FALSE(m.Matches(0)); in TEST()
461 EXPECT_TRUE(m.Matches(0)); in TEST()
462 EXPECT_TRUE(m.Matches(1)); in TEST()
463 EXPECT_FALSE(m.Matches(3)); in TEST()
607 EXPECT_FALSE(m.Matches(0)); in AnyOfMatches()
609 EXPECT_TRUE(m.Matches(i)); in AnyOfMatches()
611 EXPECT_FALSE(m.Matches(num + 1)); in AnyOfMatches()
616 EXPECT_FALSE(m.Matches(std::to_string(0))); in AnyOfStringMatches()
619 EXPECT_TRUE(m.Matches(std::to_string(i))); in AnyOfStringMatches()
621 EXPECT_FALSE(m.Matches(std::to_string(num + 1))); in AnyOfStringMatches()
626 // Tests that AnyOf(m1, ..., mn) matches any value that matches at
631 EXPECT_TRUE(m.Matches(1)); in TEST()
632 EXPECT_TRUE(m.Matches(4)); in TEST()
633 EXPECT_FALSE(m.Matches(2)); in TEST()
636 EXPECT_TRUE(m.Matches(-1)); in TEST()
637 EXPECT_TRUE(m.Matches(1)); in TEST()
638 EXPECT_TRUE(m.Matches(2)); in TEST()
639 EXPECT_FALSE(m.Matches(0)); in TEST()
642 EXPECT_TRUE(m.Matches(-1)); in TEST()
643 EXPECT_TRUE(m.Matches(1)); in TEST()
644 EXPECT_TRUE(m.Matches(2)); in TEST()
645 EXPECT_TRUE(m.Matches(3)); in TEST()
646 EXPECT_FALSE(m.Matches(0)); in TEST()
649 EXPECT_TRUE(m.Matches(0)); in TEST()
650 EXPECT_TRUE(m.Matches(11)); in TEST()
651 EXPECT_TRUE(m.Matches(3)); in TEST()
652 EXPECT_FALSE(m.Matches(2)); in TEST()
693 EXPECT_TRUE(m.Matches("red")); in TEST()
694 EXPECT_FALSE(m.Matches("green")); in TEST()
707 EXPECT_FALSE(m.Matches("red")); in TEST()
708 EXPECT_TRUE(m.Matches("green")); in TEST()
848 // Tests that Truly(predicate) matches what satisfies the given
852 EXPECT_TRUE(m.Matches(2.0)); in TEST()
853 EXPECT_FALSE(m.Matches(-1.5)); in TEST()
859 EXPECT_TRUE(m.Matches(6)); in TEST()
860 EXPECT_FALSE(m.Matches(4)); in TEST()
880 EXPECT_TRUE(m.Matches(1)); in TEST()
881 EXPECT_FALSE(m.Matches(0)); in TEST()
894 EXPECT_TRUE(m.Matches(foo)); in TEST()
896 EXPECT_FALSE(m.Matches(n)); in TEST()
906 // Tests that Matches(m) is a predicate satisfied by whatever that
907 // matches matcher m.
909 EXPECT_TRUE(Matches(Ge(0))(1)); in TEST()
910 EXPECT_FALSE(Matches(Eq('a'))('b')); in TEST()
913 // Tests that Matches(m) works when the matcher takes its argument by
917 EXPECT_TRUE(Matches(AllOf(Ref(n), Eq(0)))(n)); in TEST()
918 EXPECT_FALSE(Matches(Ref(m))(n)); in TEST()
922 // Matches().
925 EXPECT_TRUE(Matches(eq5)(5)); in TEST()
926 EXPECT_FALSE(Matches(eq5)(2)); in TEST()
930 // Matches(), which has been tested already, we don't spend a lot of
1049 // A battery of tests for FloatingEqMatcher::Matches.
1054 EXPECT_TRUE(m1.Matches(-0.0)); in TestMatches()
1055 EXPECT_TRUE(m1.Matches(close_to_positive_zero_)); in TestMatches()
1056 EXPECT_TRUE(m1.Matches(close_to_negative_zero_)); in TestMatches()
1057 EXPECT_FALSE(m1.Matches(1.0)); in TestMatches()
1060 EXPECT_FALSE(m2.Matches(further_from_negative_zero_)); in TestMatches()
1063 EXPECT_TRUE(m3.Matches(close_to_one_)); in TestMatches()
1064 EXPECT_FALSE(m3.Matches(further_from_one_)); in TestMatches()
1066 // Test commutativity: matcher_maker(0.0).Matches(1.0) was tested above. in TestMatches()
1067 EXPECT_FALSE(m3.Matches(0.0)); in TestMatches()
1070 EXPECT_TRUE(m4.Matches(-close_to_infinity_)); in TestMatches()
1073 EXPECT_TRUE(m5.Matches(close_to_infinity_)); in TestMatches()
1077 EXPECT_FALSE(m5.Matches(nan1_)); in TestMatches()
1082 EXPECT_TRUE(m6.Matches(-0.0)); in TestMatches()
1083 EXPECT_TRUE(m6.Matches(close_to_positive_zero_)); in TestMatches()
1084 EXPECT_FALSE(m6.Matches(1.0)); in TestMatches()
1090 EXPECT_TRUE(m7.Matches(x)); in TestMatches()
1092 EXPECT_FALSE(m7.Matches(x)); in TestMatches()
1131 // A battery of tests for FloatingEqMatcher::Matches with a fixed epsilon.
1136 EXPECT_TRUE(m1.Matches(0.0)); in TestNearMatches()
1137 EXPECT_TRUE(m1.Matches(-0.0)); in TestNearMatches()
1138 EXPECT_FALSE(m1.Matches(ParentType::close_to_positive_zero_)); in TestNearMatches()
1139 EXPECT_FALSE(m1.Matches(ParentType::close_to_negative_zero_)); in TestNearMatches()
1140 EXPECT_FALSE(m1.Matches(1.0)); in TestNearMatches()
1143 EXPECT_TRUE(m2.Matches(0.0)); in TestNearMatches()
1144 EXPECT_TRUE(m2.Matches(-0.0)); in TestNearMatches()
1145 EXPECT_TRUE(m2.Matches(1.0)); in TestNearMatches()
1146 EXPECT_TRUE(m2.Matches(-1.0)); in TestNearMatches()
1147 EXPECT_FALSE(m2.Matches(ParentType::close_to_one_)); in TestNearMatches()
1148 EXPECT_FALSE(m2.Matches(-ParentType::close_to_one_)); in TestNearMatches()
1150 // Check that inf matches inf, regardless of the of the specified max in TestNearMatches()
1153 EXPECT_TRUE(m3.Matches(ParentType::infinity_)); in TestNearMatches()
1154 EXPECT_FALSE(m3.Matches(ParentType::close_to_infinity_)); in TestNearMatches()
1155 EXPECT_FALSE(m3.Matches(-ParentType::infinity_)); in TestNearMatches()
1158 EXPECT_TRUE(m4.Matches(-ParentType::infinity_)); in TestNearMatches()
1159 EXPECT_FALSE(m4.Matches(-ParentType::close_to_infinity_)); in TestNearMatches()
1160 EXPECT_FALSE(m4.Matches(ParentType::infinity_)); in TestNearMatches()
1164 EXPECT_TRUE(m5.Matches(ParentType::max_)); in TestNearMatches()
1165 EXPECT_FALSE(m5.Matches(-ParentType::max_)); in TestNearMatches()
1168 EXPECT_FALSE(m6.Matches(ParentType::max_)); in TestNearMatches()
1169 EXPECT_TRUE(m6.Matches(-ParentType::max_)); in TestNearMatches()
1172 EXPECT_TRUE(m7.Matches(ParentType::max_)); in TestNearMatches()
1173 EXPECT_FALSE(m7.Matches(-ParentType::max_)); in TestNearMatches()
1176 EXPECT_FALSE(m8.Matches(ParentType::max_)); in TestNearMatches()
1177 EXPECT_TRUE(m8.Matches(-ParentType::max_)); in TestNearMatches()
1183 EXPECT_TRUE(m8.Matches(-ParentType::max_)); in TestNearMatches()
1188 EXPECT_TRUE(m10.Matches(-0.0)); in TestNearMatches()
1189 EXPECT_TRUE(m10.Matches(ParentType::close_to_positive_zero_)); in TestNearMatches()
1190 EXPECT_FALSE(m10.Matches(ParentType::close_to_one_)); in TestNearMatches()
1196 EXPECT_TRUE(m11.Matches(x)); in TestNearMatches()
1198 EXPECT_TRUE(m11.Matches(x)); in TestNearMatches()
1200 EXPECT_TRUE(m11.Matches(x)); in TestNearMatches()
1202 EXPECT_FALSE(m11.Matches(x)); in TestNearMatches()
1204 EXPECT_FALSE(m11.Matches(x)); in TestNearMatches()
1218 // FloatEq never matches NaN. in TEST_F()
1220 EXPECT_FALSE(m.Matches(nan1_)); in TEST_F()
1221 EXPECT_FALSE(m.Matches(nan2_)); in TEST_F()
1222 EXPECT_FALSE(m.Matches(1.0)); in TEST_F()
1228 EXPECT_TRUE(m.Matches(nan1_)); in TEST_F()
1229 EXPECT_TRUE(m.Matches(nan2_)); in TEST_F()
1230 EXPECT_FALSE(m.Matches(1.0)); in TEST_F()
1243 EXPECT_EQ("never matches", Describe(m3)); in TEST_F()
1283 EXPECT_EQ("never matches", Describe(m3)); in TEST_F()
1304 // FloatNear never matches NaN. in TEST_F()
1306 EXPECT_FALSE(m.Matches(nan1_)); in TEST_F()
1307 EXPECT_FALSE(m.Matches(nan2_)); in TEST_F()
1308 EXPECT_FALSE(m.Matches(1.0)); in TEST_F()
1314 EXPECT_TRUE(m.Matches(nan1_)); in TEST_F()
1315 EXPECT_TRUE(m.Matches(nan2_)); in TEST_F()
1316 EXPECT_FALSE(m.Matches(1.0)); in TEST_F()
1331 // DoubleEq never matches NaN. in TEST_F()
1333 EXPECT_FALSE(m.Matches(nan1_)); in TEST_F()
1334 EXPECT_FALSE(m.Matches(nan2_)); in TEST_F()
1335 EXPECT_FALSE(m.Matches(1.0)); in TEST_F()
1341 EXPECT_TRUE(m.Matches(nan1_)); in TEST_F()
1342 EXPECT_TRUE(m.Matches(nan2_)); in TEST_F()
1343 EXPECT_FALSE(m.Matches(1.0)); in TEST_F()
1356 EXPECT_EQ("never matches", Describe(m3)); in TEST_F()
1396 EXPECT_EQ("never matches", Describe(m3)); in TEST_F()
1431 // DoubleNear never matches NaN. in TEST_F()
1433 EXPECT_FALSE(m.Matches(nan1_)); in TEST_F()
1434 EXPECT_FALSE(m.Matches(nan2_)); in TEST_F()
1435 EXPECT_FALSE(m.Matches(1.0)); in TEST_F()
1441 EXPECT_TRUE(m.Matches(nan1_)); in TEST_F()
1442 EXPECT_TRUE(m.Matches(nan2_)); in TEST_F()
1443 EXPECT_FALSE(m.Matches(1.0)); in TEST_F()