Merge 8ffc42998b
into 6dae7eb4a5
This commit is contained in:
commit
0558d639df
@ -1796,9 +1796,15 @@ class FloatingEqMatcher {
|
||||
const FloatType max_abs_error_;
|
||||
};
|
||||
|
||||
// The following 3 type conversion operators allow FloatEq(expected) and
|
||||
// NanSensitiveFloatEq(expected) to be used as a Matcher<float>, a
|
||||
// Matcher<const float&>, or a Matcher<float&>, but nothing else.
|
||||
// The following 4 type conversion operators allow FloatEq(expected) and
|
||||
// NanSensitiveFloatEq(expected) to be used as a Matcher<const float>,
|
||||
// a Matcher<float>, a Matcher<const float&>, or a Matcher<float&>,
|
||||
// but nothing else.
|
||||
operator Matcher<const FloatType>() const {
|
||||
return MakeMatcher(
|
||||
new Impl<const FloatType>(expected_, nan_eq_nan_, max_abs_error_));
|
||||
}
|
||||
|
||||
operator Matcher<FloatType>() const {
|
||||
return MakeMatcher(
|
||||
new Impl<FloatType>(expected_, nan_eq_nan_, max_abs_error_));
|
||||
|
@ -696,6 +696,11 @@ TEST(OptionalTest, DescribesSelf) {
|
||||
EXPECT_EQ("value is equal to 1", Describe(m));
|
||||
}
|
||||
|
||||
TEST(OptionalTest, WorksWithConstDouble) {
|
||||
const SampleOptional<const double> opt(3.14159);
|
||||
EXPECT_THAT(opt, Optional(DoubleEq(3.14159)));
|
||||
}
|
||||
|
||||
TEST(OptionalTest, ExplainsSelf) {
|
||||
const Matcher<SampleOptional<int>> m = Optional(Eq(1));
|
||||
EXPECT_EQ("whose value 1 matches", Explain(m, SampleOptional<int>(1)));
|
||||
|
Loading…
Reference in New Issue
Block a user