Lines Matching full:matches

51 // Tests that Eq() matches a 2-tuple where the first field == the
55 EXPECT_TRUE(m.Matches(Tuple2(5L, 5))); in TEST()
56 EXPECT_FALSE(m.Matches(Tuple2(5L, 6))); in TEST()
65 // Tests that Ge() matches a 2-tuple where the first field >= the
69 EXPECT_TRUE(m.Matches(Tuple2(5L, 4))); in TEST()
70 EXPECT_TRUE(m.Matches(Tuple2(5L, 5))); in TEST()
71 EXPECT_FALSE(m.Matches(Tuple2(5L, 6))); in TEST()
80 // Tests that Gt() matches a 2-tuple where the first field > the
84 EXPECT_TRUE(m.Matches(Tuple2(5L, 4))); in TEST()
85 EXPECT_FALSE(m.Matches(Tuple2(5L, 5))); in TEST()
86 EXPECT_FALSE(m.Matches(Tuple2(5L, 6))); in TEST()
95 // Tests that Le() matches a 2-tuple where the first field <= the
99 EXPECT_TRUE(m.Matches(Tuple2(5L, 6))); in TEST()
100 EXPECT_TRUE(m.Matches(Tuple2(5L, 5))); in TEST()
101 EXPECT_FALSE(m.Matches(Tuple2(5L, 4))); in TEST()
110 // Tests that Lt() matches a 2-tuple where the first field < the
114 EXPECT_TRUE(m.Matches(Tuple2(5L, 6))); in TEST()
115 EXPECT_FALSE(m.Matches(Tuple2(5L, 5))); in TEST()
116 EXPECT_FALSE(m.Matches(Tuple2(5L, 4))); in TEST()
125 // Tests that Ne() matches a 2-tuple where the first field != the
129 EXPECT_TRUE(m.Matches(Tuple2(5L, 6))); in TEST()
130 EXPECT_TRUE(m.Matches(Tuple2(5L, 4))); in TEST()
131 EXPECT_FALSE(m.Matches(Tuple2(5L, 5))); in TEST()
146 EXPECT_TRUE(matcher.Matches(pointers)); in TEST()
149 // Tests that IsNan() matches a NaN, with float.
156 EXPECT_TRUE(m.Matches(quiet_nan)); in TEST()
157 EXPECT_TRUE(m.Matches(other_nan)); in TEST()
158 EXPECT_FALSE(m.Matches(real_value)); in TEST()
161 EXPECT_TRUE(m_ref.Matches(quiet_nan)); in TEST()
162 EXPECT_TRUE(m_ref.Matches(other_nan)); in TEST()
163 EXPECT_FALSE(m_ref.Matches(real_value)); in TEST()
166 EXPECT_TRUE(m_cref.Matches(quiet_nan)); in TEST()
167 EXPECT_TRUE(m_cref.Matches(other_nan)); in TEST()
168 EXPECT_FALSE(m_cref.Matches(real_value)); in TEST()
171 // Tests that IsNan() matches a NaN, with double.
178 EXPECT_TRUE(m.Matches(quiet_nan)); in TEST()
179 EXPECT_TRUE(m.Matches(other_nan)); in TEST()
180 EXPECT_FALSE(m.Matches(real_value)); in TEST()
183 EXPECT_TRUE(m_ref.Matches(quiet_nan)); in TEST()
184 EXPECT_TRUE(m_ref.Matches(other_nan)); in TEST()
185 EXPECT_FALSE(m_ref.Matches(real_value)); in TEST()
188 EXPECT_TRUE(m_cref.Matches(quiet_nan)); in TEST()
189 EXPECT_TRUE(m_cref.Matches(other_nan)); in TEST()
190 EXPECT_FALSE(m_cref.Matches(real_value)); in TEST()
193 // Tests that IsNan() matches a NaN, with long double.
200 EXPECT_TRUE(m.Matches(quiet_nan)); in TEST()
201 EXPECT_TRUE(m.Matches(other_nan)); in TEST()
202 EXPECT_FALSE(m.Matches(real_value)); in TEST()
205 EXPECT_TRUE(m_ref.Matches(quiet_nan)); in TEST()
206 EXPECT_TRUE(m_ref.Matches(other_nan)); in TEST()
207 EXPECT_FALSE(m_ref.Matches(real_value)); in TEST()
210 EXPECT_TRUE(m_cref.Matches(quiet_nan)); in TEST()
211 EXPECT_TRUE(m_cref.Matches(other_nan)); in TEST()
212 EXPECT_FALSE(m_cref.Matches(real_value)); in TEST()
218 EXPECT_FALSE(mf.Matches(std::numeric_limits<float>::quiet_NaN())); in TEST()
219 EXPECT_FALSE(mf.Matches(std::nanf("1"))); in TEST()
220 EXPECT_TRUE(mf.Matches(1.0)); in TEST()
223 EXPECT_FALSE(md.Matches(std::numeric_limits<double>::quiet_NaN())); in TEST()
224 EXPECT_FALSE(md.Matches(std::nan("1"))); in TEST()
225 EXPECT_TRUE(md.Matches(1.0)); in TEST()
228 EXPECT_FALSE(mld.Matches(std::numeric_limits<long double>::quiet_NaN())); in TEST()
229 EXPECT_FALSE(mld.Matches(std::nanl("1"))); in TEST()
230 EXPECT_TRUE(mld.Matches(1.0)); in TEST()
257 // Tests that FloatEq() matches a 2-tuple where
258 // FloatEq(first field) matches the second field.
262 EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); in TEST()
263 EXPECT_TRUE(m.Matches(Tpl(0.3f, 0.1f + 0.1f + 0.1f))); in TEST()
264 EXPECT_FALSE(m.Matches(Tpl(1.1f, 1.0f))); in TEST()
273 // Tests that NanSensitiveFloatEq() matches a 2-tuple where
274 // NanSensitiveFloatEq(first field) matches the second field.
278 EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); in TEST()
279 EXPECT_TRUE(m.Matches(Tpl(std::numeric_limits<float>::quiet_NaN(), in TEST()
281 EXPECT_FALSE(m.Matches(Tpl(1.1f, 1.0f))); in TEST()
282 EXPECT_FALSE(m.Matches(Tpl(1.0f, std::numeric_limits<float>::quiet_NaN()))); in TEST()
283 EXPECT_FALSE(m.Matches(Tpl(std::numeric_limits<float>::quiet_NaN(), 1.0f))); in TEST()
292 // Tests that DoubleEq() matches a 2-tuple where
293 // DoubleEq(first field) matches the second field.
297 EXPECT_TRUE(m.Matches(Tpl(1.0, 1.0))); in TEST()
298 EXPECT_TRUE(m.Matches(Tpl(0.3, 0.1 + 0.1 + 0.1))); in TEST()
299 EXPECT_FALSE(m.Matches(Tpl(1.1, 1.0))); in TEST()
308 // Tests that NanSensitiveDoubleEq() matches a 2-tuple where
309 // NanSensitiveDoubleEq(first field) matches the second field.
313 EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); in TEST()
314 EXPECT_TRUE(m.Matches(Tpl(std::numeric_limits<double>::quiet_NaN(), in TEST()
316 EXPECT_FALSE(m.Matches(Tpl(1.1f, 1.0f))); in TEST()
317 EXPECT_FALSE(m.Matches(Tpl(1.0f, std::numeric_limits<double>::quiet_NaN()))); in TEST()
318 EXPECT_FALSE(m.Matches(Tpl(std::numeric_limits<double>::quiet_NaN(), 1.0f))); in TEST()
327 // Tests that FloatEq() matches a 2-tuple where
328 // FloatNear(first field, max_abs_error) matches the second field.
332 EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); in TEST()
333 EXPECT_TRUE(m.Matches(Tpl(1.3f, 1.0f))); in TEST()
334 EXPECT_FALSE(m.Matches(Tpl(1.8f, 1.0f))); in TEST()
343 // Tests that NanSensitiveFloatNear() matches a 2-tuple where
344 // NanSensitiveFloatNear(first field) matches the second field.
348 EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); in TEST()
349 EXPECT_TRUE(m.Matches(Tpl(1.1f, 1.0f))); in TEST()
350 EXPECT_TRUE(m.Matches(Tpl(std::numeric_limits<float>::quiet_NaN(), in TEST()
352 EXPECT_FALSE(m.Matches(Tpl(1.6f, 1.0f))); in TEST()
353 EXPECT_FALSE(m.Matches(Tpl(1.0f, std::numeric_limits<float>::quiet_NaN()))); in TEST()
354 EXPECT_FALSE(m.Matches(Tpl(std::numeric_limits<float>::quiet_NaN(), 1.0f))); in TEST()
363 // Tests that FloatEq() matches a 2-tuple where
364 // DoubleNear(first field, max_abs_error) matches the second field.
368 EXPECT_TRUE(m.Matches(Tpl(1.0, 1.0))); in TEST()
369 EXPECT_TRUE(m.Matches(Tpl(1.3, 1.0))); in TEST()
370 EXPECT_FALSE(m.Matches(Tpl(1.8, 1.0))); in TEST()
379 // Tests that NanSensitiveDoubleNear() matches a 2-tuple where
380 // NanSensitiveDoubleNear(first field) matches the second field.
384 EXPECT_TRUE(m.Matches(Tpl(1.0f, 1.0f))); in TEST()
385 EXPECT_TRUE(m.Matches(Tpl(1.1f, 1.0f))); in TEST()
386 EXPECT_TRUE(m.Matches(Tpl(std::numeric_limits<double>::quiet_NaN(), in TEST()
388 EXPECT_FALSE(m.Matches(Tpl(1.6f, 1.0f))); in TEST()
389 EXPECT_FALSE(m.Matches(Tpl(1.0f, std::numeric_limits<double>::quiet_NaN()))); in TEST()
390 EXPECT_FALSE(m.Matches(Tpl(std::numeric_limits<double>::quiet_NaN(), 1.0f))); in TEST()
399 // Tests that Not(m) matches any value that doesn't match m.
403 EXPECT_TRUE(m.Matches(3)); in TEST()
404 EXPECT_FALSE(m.Matches(2)); in TEST()
426 EXPECT_TRUE(m.Matches(0)); in AllOfMatches()
428 EXPECT_FALSE(m.Matches(i)); in AllOfMatches()
430 EXPECT_TRUE(m.Matches(num + 1)); in AllOfMatches()
435 // Tests that AllOf(m1, ..., mn) matches any value that matches all of
440 EXPECT_TRUE(m.Matches(1)); in TEST()
441 EXPECT_TRUE(m.Matches(2)); in TEST()
442 EXPECT_FALSE(m.Matches(0)); in TEST()
443 EXPECT_FALSE(m.Matches(3)); in TEST()
446 EXPECT_TRUE(m.Matches(3)); in TEST()
447 EXPECT_FALSE(m.Matches(2)); in TEST()
448 EXPECT_FALSE(m.Matches(1)); in TEST()
449 EXPECT_FALSE(m.Matches(0)); in TEST()
452 EXPECT_TRUE(m.Matches(4)); in TEST()
453 EXPECT_FALSE(m.Matches(3)); in TEST()
454 EXPECT_FALSE(m.Matches(2)); in TEST()
455 EXPECT_FALSE(m.Matches(1)); in TEST()
456 EXPECT_FALSE(m.Matches(0)); in TEST()
459 EXPECT_TRUE(m.Matches(0)); in TEST()
460 EXPECT_TRUE(m.Matches(1)); in TEST()
461 EXPECT_FALSE(m.Matches(3)); in TEST()
605 EXPECT_FALSE(m.Matches(0)); in AnyOfMatches()
607 EXPECT_TRUE(m.Matches(i)); in AnyOfMatches()
609 EXPECT_FALSE(m.Matches(num + 1)); in AnyOfMatches()
614 EXPECT_FALSE(m.Matches(std::to_string(0))); in AnyOfStringMatches()
617 EXPECT_TRUE(m.Matches(std::to_string(i))); in AnyOfStringMatches()
619 EXPECT_FALSE(m.Matches(std::to_string(num + 1))); in AnyOfStringMatches()
624 // Tests that AnyOf(m1, ..., mn) matches any value that matches at
629 EXPECT_TRUE(m.Matches(1)); in TEST()
630 EXPECT_TRUE(m.Matches(4)); in TEST()
631 EXPECT_FALSE(m.Matches(2)); in TEST()
634 EXPECT_TRUE(m.Matches(-1)); in TEST()
635 EXPECT_TRUE(m.Matches(1)); in TEST()
636 EXPECT_TRUE(m.Matches(2)); in TEST()
637 EXPECT_FALSE(m.Matches(0)); in TEST()
640 EXPECT_TRUE(m.Matches(-1)); in TEST()
641 EXPECT_TRUE(m.Matches(1)); in TEST()
642 EXPECT_TRUE(m.Matches(2)); in TEST()
643 EXPECT_TRUE(m.Matches(3)); in TEST()
644 EXPECT_FALSE(m.Matches(0)); in TEST()
647 EXPECT_TRUE(m.Matches(0)); in TEST()
648 EXPECT_TRUE(m.Matches(11)); in TEST()
649 EXPECT_TRUE(m.Matches(3)); in TEST()
650 EXPECT_FALSE(m.Matches(2)); in TEST()
691 EXPECT_TRUE(m.Matches("red")); in TEST()
692 EXPECT_FALSE(m.Matches("green")); in TEST()
705 EXPECT_FALSE(m.Matches("red")); in TEST()
706 EXPECT_TRUE(m.Matches("green")); in TEST()
846 // Tests that Truly(predicate) matches what satisfies the given
850 EXPECT_TRUE(m.Matches(2.0)); in TEST()
851 EXPECT_FALSE(m.Matches(-1.5)); in TEST()
857 EXPECT_TRUE(m.Matches(6)); in TEST()
858 EXPECT_FALSE(m.Matches(4)); in TEST()
878 EXPECT_TRUE(m.Matches(1)); in TEST()
879 EXPECT_FALSE(m.Matches(0)); in TEST()
892 EXPECT_TRUE(m.Matches(foo)); in TEST()
894 EXPECT_FALSE(m.Matches(n)); in TEST()
904 // Tests that Matches(m) is a predicate satisfied by whatever that
905 // matches matcher m.
907 EXPECT_TRUE(Matches(Ge(0))(1)); in TEST()
908 EXPECT_FALSE(Matches(Eq('a'))('b')); in TEST()
911 // Tests that Matches(m) works when the matcher takes its argument by
915 EXPECT_TRUE(Matches(AllOf(Ref(n), Eq(0)))(n)); in TEST()
916 EXPECT_FALSE(Matches(Ref(m))(n)); in TEST()
920 // Matches().
923 EXPECT_TRUE(Matches(eq5)(5)); in TEST()
924 EXPECT_FALSE(Matches(eq5)(2)); in TEST()
928 // Matches(), which has been tested already, we don't spend a lot of
1047 // A battery of tests for FloatingEqMatcher::Matches.
1052 EXPECT_TRUE(m1.Matches(-0.0)); in TestMatches()
1053 EXPECT_TRUE(m1.Matches(close_to_positive_zero_)); in TestMatches()
1054 EXPECT_TRUE(m1.Matches(close_to_negative_zero_)); in TestMatches()
1055 EXPECT_FALSE(m1.Matches(1.0)); in TestMatches()
1058 EXPECT_FALSE(m2.Matches(further_from_negative_zero_)); in TestMatches()
1061 EXPECT_TRUE(m3.Matches(close_to_one_)); in TestMatches()
1062 EXPECT_FALSE(m3.Matches(further_from_one_)); in TestMatches()
1064 // Test commutativity: matcher_maker(0.0).Matches(1.0) was tested above. in TestMatches()
1065 EXPECT_FALSE(m3.Matches(0.0)); in TestMatches()
1068 EXPECT_TRUE(m4.Matches(-close_to_infinity_)); in TestMatches()
1071 EXPECT_TRUE(m5.Matches(close_to_infinity_)); in TestMatches()
1075 EXPECT_FALSE(m5.Matches(nan1_)); in TestMatches()
1080 EXPECT_TRUE(m6.Matches(-0.0)); in TestMatches()
1081 EXPECT_TRUE(m6.Matches(close_to_positive_zero_)); in TestMatches()
1082 EXPECT_FALSE(m6.Matches(1.0)); in TestMatches()
1088 EXPECT_TRUE(m7.Matches(x)); in TestMatches()
1090 EXPECT_FALSE(m7.Matches(x)); in TestMatches()
1129 // A battery of tests for FloatingEqMatcher::Matches with a fixed epsilon.
1134 EXPECT_TRUE(m1.Matches(0.0)); in TestNearMatches()
1135 EXPECT_TRUE(m1.Matches(-0.0)); in TestNearMatches()
1136 EXPECT_FALSE(m1.Matches(ParentType::close_to_positive_zero_)); in TestNearMatches()
1137 EXPECT_FALSE(m1.Matches(ParentType::close_to_negative_zero_)); in TestNearMatches()
1138 EXPECT_FALSE(m1.Matches(1.0)); in TestNearMatches()
1141 EXPECT_TRUE(m2.Matches(0.0)); in TestNearMatches()
1142 EXPECT_TRUE(m2.Matches(-0.0)); in TestNearMatches()
1143 EXPECT_TRUE(m2.Matches(1.0)); in TestNearMatches()
1144 EXPECT_TRUE(m2.Matches(-1.0)); in TestNearMatches()
1145 EXPECT_FALSE(m2.Matches(ParentType::close_to_one_)); in TestNearMatches()
1146 EXPECT_FALSE(m2.Matches(-ParentType::close_to_one_)); in TestNearMatches()
1148 // Check that inf matches inf, regardless of the of the specified max in TestNearMatches()
1151 EXPECT_TRUE(m3.Matches(ParentType::infinity_)); in TestNearMatches()
1152 EXPECT_FALSE(m3.Matches(ParentType::close_to_infinity_)); in TestNearMatches()
1153 EXPECT_FALSE(m3.Matches(-ParentType::infinity_)); in TestNearMatches()
1156 EXPECT_TRUE(m4.Matches(-ParentType::infinity_)); in TestNearMatches()
1157 EXPECT_FALSE(m4.Matches(-ParentType::close_to_infinity_)); in TestNearMatches()
1158 EXPECT_FALSE(m4.Matches(ParentType::infinity_)); in TestNearMatches()
1162 EXPECT_TRUE(m5.Matches(ParentType::max_)); in TestNearMatches()
1163 EXPECT_FALSE(m5.Matches(-ParentType::max_)); in TestNearMatches()
1166 EXPECT_FALSE(m6.Matches(ParentType::max_)); in TestNearMatches()
1167 EXPECT_TRUE(m6.Matches(-ParentType::max_)); in TestNearMatches()
1170 EXPECT_TRUE(m7.Matches(ParentType::max_)); in TestNearMatches()
1171 EXPECT_FALSE(m7.Matches(-ParentType::max_)); in TestNearMatches()
1174 EXPECT_FALSE(m8.Matches(ParentType::max_)); in TestNearMatches()
1175 EXPECT_TRUE(m8.Matches(-ParentType::max_)); in TestNearMatches()
1181 EXPECT_TRUE(m8.Matches(-ParentType::max_)); in TestNearMatches()
1186 EXPECT_TRUE(m10.Matches(-0.0)); in TestNearMatches()
1187 EXPECT_TRUE(m10.Matches(ParentType::close_to_positive_zero_)); in TestNearMatches()
1188 EXPECT_FALSE(m10.Matches(ParentType::close_to_one_)); in TestNearMatches()
1194 EXPECT_TRUE(m11.Matches(x)); in TestNearMatches()
1196 EXPECT_TRUE(m11.Matches(x)); in TestNearMatches()
1198 EXPECT_TRUE(m11.Matches(x)); in TestNearMatches()
1200 EXPECT_FALSE(m11.Matches(x)); in TestNearMatches()
1202 EXPECT_FALSE(m11.Matches(x)); in TestNearMatches()
1216 // FloatEq never matches NaN. in TEST_F()
1218 EXPECT_FALSE(m.Matches(nan1_)); in TEST_F()
1219 EXPECT_FALSE(m.Matches(nan2_)); in TEST_F()
1220 EXPECT_FALSE(m.Matches(1.0)); in TEST_F()
1226 EXPECT_TRUE(m.Matches(nan1_)); in TEST_F()
1227 EXPECT_TRUE(m.Matches(nan2_)); in TEST_F()
1228 EXPECT_FALSE(m.Matches(1.0)); in TEST_F()
1241 EXPECT_EQ("never matches", Describe(m3)); in TEST_F()
1281 EXPECT_EQ("never matches", Describe(m3)); in TEST_F()
1302 // FloatNear never matches NaN. in TEST_F()
1304 EXPECT_FALSE(m.Matches(nan1_)); in TEST_F()
1305 EXPECT_FALSE(m.Matches(nan2_)); in TEST_F()
1306 EXPECT_FALSE(m.Matches(1.0)); in TEST_F()
1312 EXPECT_TRUE(m.Matches(nan1_)); in TEST_F()
1313 EXPECT_TRUE(m.Matches(nan2_)); in TEST_F()
1314 EXPECT_FALSE(m.Matches(1.0)); in TEST_F()
1329 // DoubleEq never matches NaN. in TEST_F()
1331 EXPECT_FALSE(m.Matches(nan1_)); in TEST_F()
1332 EXPECT_FALSE(m.Matches(nan2_)); in TEST_F()
1333 EXPECT_FALSE(m.Matches(1.0)); in TEST_F()
1339 EXPECT_TRUE(m.Matches(nan1_)); in TEST_F()
1340 EXPECT_TRUE(m.Matches(nan2_)); in TEST_F()
1341 EXPECT_FALSE(m.Matches(1.0)); in TEST_F()
1354 EXPECT_EQ("never matches", Describe(m3)); in TEST_F()
1394 EXPECT_EQ("never matches", Describe(m3)); in TEST_F()
1429 // DoubleNear never matches NaN. in TEST_F()
1431 EXPECT_FALSE(m.Matches(nan1_)); in TEST_F()
1432 EXPECT_FALSE(m.Matches(nan2_)); in TEST_F()
1433 EXPECT_FALSE(m.Matches(1.0)); in TEST_F()
1439 EXPECT_TRUE(m.Matches(nan1_)); in TEST_F()
1440 EXPECT_TRUE(m.Matches(nan2_)); in TEST_F()
1441 EXPECT_FALSE(m.Matches(1.0)); in TEST_F()