mirror of
https://github.com/google/googletest.git
synced 2026-10-28 18:07:18 +08:00
Automated Code Change
PiperOrigin-RevId: 990940938 Change-Id: I052d1ea54207708646fbf8608a13185d76225df2
This commit is contained in:
parent
5a4a3c968b
commit
3ca3771f9c
@ -175,7 +175,7 @@ struct BuiltInDefaultValueGetter {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
struct BuiltInDefaultValueGetter<T, false> {
|
struct BuiltInDefaultValueGetter<T, false> {
|
||||||
static T Get() {
|
static T Get() {
|
||||||
Assert(/*condition=*/false, __FILE__, __LINE__,
|
Assert(false, __FILE__, __LINE__,
|
||||||
"Default action undefined for the function return type.");
|
"Default action undefined for the function return type.");
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
__builtin_unreachable();
|
__builtin_unreachable();
|
||||||
|
|||||||
@ -1908,12 +1908,12 @@ class [[nodiscard]] FloatingEqMatcher {
|
|||||||
template <typename FloatType>
|
template <typename FloatType>
|
||||||
class [[nodiscard]] FloatingEq2Matcher {
|
class [[nodiscard]] FloatingEq2Matcher {
|
||||||
public:
|
public:
|
||||||
FloatingEq2Matcher() { Init(-1, /*nan_eq_nan_val=*/false); }
|
FloatingEq2Matcher() { Init(-1, false); }
|
||||||
|
|
||||||
explicit FloatingEq2Matcher(bool nan_eq_nan) { Init(-1, nan_eq_nan); }
|
explicit FloatingEq2Matcher(bool nan_eq_nan) { Init(-1, nan_eq_nan); }
|
||||||
|
|
||||||
explicit FloatingEq2Matcher(FloatType max_abs_error) {
|
explicit FloatingEq2Matcher(FloatType max_abs_error) {
|
||||||
Init(max_abs_error, /*nan_eq_nan_val=*/false);
|
Init(max_abs_error, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
FloatingEq2Matcher(FloatType max_abs_error, bool nan_eq_nan) {
|
FloatingEq2Matcher(FloatType max_abs_error, bool nan_eq_nan) {
|
||||||
@ -2942,8 +2942,7 @@ class [[nodiscard]] ContainsMatcherImpl
|
|||||||
|
|
||||||
bool MatchAndExplain(Container container,
|
bool MatchAndExplain(Container container,
|
||||||
MatchResultListener* listener) const override {
|
MatchResultListener* listener) const override {
|
||||||
return this->MatchAndExplainImpl(/*all_elements_should_match=*/false,
|
return this->MatchAndExplainImpl(false, container, listener);
|
||||||
container, listener);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -4741,13 +4740,13 @@ inline PolymorphicMatcher<internal::IsNanMatcher> IsNan() {
|
|||||||
// Creates a matcher that matches any double argument approximately
|
// Creates a matcher that matches any double argument approximately
|
||||||
// equal to rhs, where two NANs are considered unequal.
|
// equal to rhs, where two NANs are considered unequal.
|
||||||
inline internal::FloatingEqMatcher<double> DoubleEq(double rhs) {
|
inline internal::FloatingEqMatcher<double> DoubleEq(double rhs) {
|
||||||
return internal::FloatingEqMatcher<double>(rhs, /*nan_eq_nan=*/false);
|
return internal::FloatingEqMatcher<double>(rhs, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a matcher that matches any double argument approximately
|
// Creates a matcher that matches any double argument approximately
|
||||||
// equal to rhs, including NaN values when rhs is NaN.
|
// equal to rhs, including NaN values when rhs is NaN.
|
||||||
inline internal::FloatingEqMatcher<double> NanSensitiveDoubleEq(double rhs) {
|
inline internal::FloatingEqMatcher<double> NanSensitiveDoubleEq(double rhs) {
|
||||||
return internal::FloatingEqMatcher<double>(rhs, /*nan_eq_nan=*/true);
|
return internal::FloatingEqMatcher<double>(rhs, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a matcher that matches any double argument approximately equal to
|
// Creates a matcher that matches any double argument approximately equal to
|
||||||
@ -4755,8 +4754,7 @@ inline internal::FloatingEqMatcher<double> NanSensitiveDoubleEq(double rhs) {
|
|||||||
// considered unequal. The max absolute error bound must be non-negative.
|
// considered unequal. The max absolute error bound must be non-negative.
|
||||||
inline internal::FloatingEqMatcher<double> DoubleNear(double rhs,
|
inline internal::FloatingEqMatcher<double> DoubleNear(double rhs,
|
||||||
double max_abs_error) {
|
double max_abs_error) {
|
||||||
return internal::FloatingEqMatcher<double>(rhs, /*nan_eq_nan=*/false,
|
return internal::FloatingEqMatcher<double>(rhs, false, max_abs_error);
|
||||||
max_abs_error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The DistanceFrom(target, get_distance, m) and DistanceFrom(target, m)
|
// The DistanceFrom(target, get_distance, m) and DistanceFrom(target, m)
|
||||||
@ -4800,20 +4798,19 @@ DistanceFrom(T target, DistanceMatcher distance_matcher) {
|
|||||||
// rhs is NaN. The max absolute error bound must be non-negative.
|
// rhs is NaN. The max absolute error bound must be non-negative.
|
||||||
inline internal::FloatingEqMatcher<double> NanSensitiveDoubleNear(
|
inline internal::FloatingEqMatcher<double> NanSensitiveDoubleNear(
|
||||||
double rhs, double max_abs_error) {
|
double rhs, double max_abs_error) {
|
||||||
return internal::FloatingEqMatcher<double>(rhs, /*nan_eq_nan=*/true,
|
return internal::FloatingEqMatcher<double>(rhs, true, max_abs_error);
|
||||||
max_abs_error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a matcher that matches any float argument approximately
|
// Creates a matcher that matches any float argument approximately
|
||||||
// equal to rhs, where two NANs are considered unequal.
|
// equal to rhs, where two NANs are considered unequal.
|
||||||
inline internal::FloatingEqMatcher<float> FloatEq(float rhs) {
|
inline internal::FloatingEqMatcher<float> FloatEq(float rhs) {
|
||||||
return internal::FloatingEqMatcher<float>(rhs, /*nan_eq_nan=*/false);
|
return internal::FloatingEqMatcher<float>(rhs, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a matcher that matches any float argument approximately
|
// Creates a matcher that matches any float argument approximately
|
||||||
// equal to rhs, including NaN values when rhs is NaN.
|
// equal to rhs, including NaN values when rhs is NaN.
|
||||||
inline internal::FloatingEqMatcher<float> NanSensitiveFloatEq(float rhs) {
|
inline internal::FloatingEqMatcher<float> NanSensitiveFloatEq(float rhs) {
|
||||||
return internal::FloatingEqMatcher<float>(rhs, /*nan_eq_nan=*/true);
|
return internal::FloatingEqMatcher<float>(rhs, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a matcher that matches any float argument approximately equal to
|
// Creates a matcher that matches any float argument approximately equal to
|
||||||
@ -4821,8 +4818,7 @@ inline internal::FloatingEqMatcher<float> NanSensitiveFloatEq(float rhs) {
|
|||||||
// considered unequal. The max absolute error bound must be non-negative.
|
// considered unequal. The max absolute error bound must be non-negative.
|
||||||
inline internal::FloatingEqMatcher<float> FloatNear(float rhs,
|
inline internal::FloatingEqMatcher<float> FloatNear(float rhs,
|
||||||
float max_abs_error) {
|
float max_abs_error) {
|
||||||
return internal::FloatingEqMatcher<float>(rhs, /*nan_eq_nan=*/false,
|
return internal::FloatingEqMatcher<float>(rhs, false, max_abs_error);
|
||||||
max_abs_error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a matcher that matches any float argument approximately equal to
|
// Creates a matcher that matches any float argument approximately equal to
|
||||||
@ -4830,8 +4826,7 @@ inline internal::FloatingEqMatcher<float> FloatNear(float rhs,
|
|||||||
// rhs is NaN. The max absolute error bound must be non-negative.
|
// rhs is NaN. The max absolute error bound must be non-negative.
|
||||||
inline internal::FloatingEqMatcher<float> NanSensitiveFloatNear(
|
inline internal::FloatingEqMatcher<float> NanSensitiveFloatNear(
|
||||||
float rhs, float max_abs_error) {
|
float rhs, float max_abs_error) {
|
||||||
return internal::FloatingEqMatcher<float>(rhs, /*nan_eq_nan=*/true,
|
return internal::FloatingEqMatcher<float>(rhs, true, max_abs_error);
|
||||||
max_abs_error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a matcher that matches a pointer (raw or smart) that points
|
// Creates a matcher that matches a pointer (raw or smart) that points
|
||||||
@ -5074,13 +5069,13 @@ inline internal::FloatingEq2Matcher<double> DoubleEq() {
|
|||||||
// Creates a polymorphic matcher that matches a 2-tuple where
|
// Creates a polymorphic matcher that matches a 2-tuple where
|
||||||
// FloatEq(first field) matches the second field with NaN equality.
|
// FloatEq(first field) matches the second field with NaN equality.
|
||||||
inline internal::FloatingEq2Matcher<float> NanSensitiveFloatEq() {
|
inline internal::FloatingEq2Matcher<float> NanSensitiveFloatEq() {
|
||||||
return internal::FloatingEq2Matcher<float>(/*nan_eq_nan=*/true);
|
return internal::FloatingEq2Matcher<float>(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a polymorphic matcher that matches a 2-tuple where
|
// Creates a polymorphic matcher that matches a 2-tuple where
|
||||||
// DoubleEq(first field) matches the second field with NaN equality.
|
// DoubleEq(first field) matches the second field with NaN equality.
|
||||||
inline internal::FloatingEq2Matcher<double> NanSensitiveDoubleEq() {
|
inline internal::FloatingEq2Matcher<double> NanSensitiveDoubleEq() {
|
||||||
return internal::FloatingEq2Matcher<double>(/*nan_eq_nan=*/true);
|
return internal::FloatingEq2Matcher<double>(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a polymorphic matcher that matches a 2-tuple where
|
// Creates a polymorphic matcher that matches a 2-tuple where
|
||||||
@ -5100,8 +5095,7 @@ inline internal::FloatingEq2Matcher<double> DoubleNear(double max_abs_error) {
|
|||||||
// equality.
|
// equality.
|
||||||
inline internal::FloatingEq2Matcher<float> NanSensitiveFloatNear(
|
inline internal::FloatingEq2Matcher<float> NanSensitiveFloatNear(
|
||||||
float max_abs_error) {
|
float max_abs_error) {
|
||||||
return internal::FloatingEq2Matcher<float>(max_abs_error,
|
return internal::FloatingEq2Matcher<float>(max_abs_error, true);
|
||||||
/*nan_eq_nan=*/true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a polymorphic matcher that matches a 2-tuple where
|
// Creates a polymorphic matcher that matches a 2-tuple where
|
||||||
@ -5109,8 +5103,7 @@ inline internal::FloatingEq2Matcher<float> NanSensitiveFloatNear(
|
|||||||
// equality.
|
// equality.
|
||||||
inline internal::FloatingEq2Matcher<double> NanSensitiveDoubleNear(
|
inline internal::FloatingEq2Matcher<double> NanSensitiveDoubleNear(
|
||||||
double max_abs_error) {
|
double max_abs_error) {
|
||||||
return internal::FloatingEq2Matcher<double>(max_abs_error,
|
return internal::FloatingEq2Matcher<double>(max_abs_error, true);
|
||||||
/*nan_eq_nan=*/true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a matcher that matches any value of type T that m doesn't
|
// Creates a matcher that matches any value of type T that m doesn't
|
||||||
|
|||||||
@ -909,7 +909,7 @@ class TypedExpectation<R(Args...)> : public ExpectationBase {
|
|||||||
// Implements the .With() clause.
|
// Implements the .With() clause.
|
||||||
TypedExpectation& With(const Matcher<const ArgumentTuple&>& m) {
|
TypedExpectation& With(const Matcher<const ArgumentTuple&>& m) {
|
||||||
if (last_clause_ == kWith) {
|
if (last_clause_ == kWith) {
|
||||||
ExpectSpecProperty(/*property=*/false,
|
ExpectSpecProperty(false,
|
||||||
".With() cannot appear "
|
".With() cannot appear "
|
||||||
"more than once in an EXPECT_CALL().");
|
"more than once in an EXPECT_CALL().");
|
||||||
} else {
|
} else {
|
||||||
@ -1032,7 +1032,7 @@ class TypedExpectation<R(Args...)> : public ExpectationBase {
|
|||||||
// Implements the .WillRepeatedly() clause.
|
// Implements the .WillRepeatedly() clause.
|
||||||
TypedExpectation& WillRepeatedly(const Action<F>& action) {
|
TypedExpectation& WillRepeatedly(const Action<F>& action) {
|
||||||
if (last_clause_ == kWillRepeatedly) {
|
if (last_clause_ == kWillRepeatedly) {
|
||||||
ExpectSpecProperty(/*property=*/false,
|
ExpectSpecProperty(false,
|
||||||
".WillRepeatedly() cannot appear "
|
".WillRepeatedly() cannot appear "
|
||||||
"more than once in an EXPECT_CALL().");
|
"more than once in an EXPECT_CALL().");
|
||||||
} else {
|
} else {
|
||||||
@ -1421,11 +1421,11 @@ struct UntypedFunctionMockerBase::FailureCleanupHandler {
|
|||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
// No expectation matches this call - reports a failure.
|
// No expectation matches this call - reports a failure.
|
||||||
Expect(/*condition=*/false, /*file=*/nullptr, -1, ss.str());
|
Expect(false, nullptr, -1, ss.str());
|
||||||
} else if (is_excessive) {
|
} else if (is_excessive) {
|
||||||
// We had an upper-bound violation and the failure message is in ss.
|
// We had an upper-bound violation and the failure message is in ss.
|
||||||
Expect(/*condition=*/false, untyped_expectation->file(),
|
Expect(false, untyped_expectation->file(), untyped_expectation->line(),
|
||||||
untyped_expectation->line(), ss.str());
|
ss.str());
|
||||||
} else {
|
} else {
|
||||||
// We had an expected call and the matching expectation is
|
// We had an expected call and the matching expectation is
|
||||||
// described in ss.
|
// described in ss.
|
||||||
@ -1841,8 +1841,7 @@ R FunctionMocker<R(Args...)>::InvokeWith(ArgumentTuple&& args)
|
|||||||
const UninterestingCallCleanupHandler report_uninteresting_call = {reaction,
|
const UninterestingCallCleanupHandler report_uninteresting_call = {reaction,
|
||||||
ss};
|
ss};
|
||||||
|
|
||||||
return PerformActionAndPrintResult(/*untyped_action=*/nullptr,
|
return PerformActionAndPrintResult(nullptr, std::move(args), ss.str(), ss);
|
||||||
std::move(args), ss.str(), ss);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_excessive = false;
|
bool is_excessive = false;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user