Fix formatting of C++ files
PiperOrigin-RevId: 504325204 Change-Id: Iaa1d6d0ab1dccaaeef26f9cb109d530835499240
This commit is contained in:
parent
408471e20c
commit
2491710524
@ -1420,19 +1420,19 @@ struct WithArgsAction {
|
|||||||
// providing a call operator because even with a particular set of arguments
|
// providing a call operator because even with a particular set of arguments
|
||||||
// they don't have a fixed return type.
|
// they don't have a fixed return type.
|
||||||
|
|
||||||
template <typename R, typename... Args,
|
template <
|
||||||
typename std::enable_if<
|
typename R, typename... Args,
|
||||||
std::is_convertible<
|
typename std::enable_if<
|
||||||
InnerAction,
|
std::is_convertible<InnerAction,
|
||||||
// Unfortunately we can't use the InnerSignature alias here;
|
// Unfortunately we can't use the InnerSignature
|
||||||
// MSVC complains about the I parameter pack not being
|
// alias here; MSVC complains about the I
|
||||||
// expanded (error C3520) despite it being expanded in the
|
// parameter pack not being expanded (error C3520)
|
||||||
// type alias.
|
// despite it being expanded in the type alias.
|
||||||
// TupleElement is also an MSVC workaround.
|
// TupleElement is also an MSVC workaround.
|
||||||
// See its definition for details.
|
// See its definition for details.
|
||||||
OnceAction<R(internal::TupleElement<
|
OnceAction<R(internal::TupleElement<
|
||||||
I, std::tuple<Args...>>...)>>::value,
|
I, std::tuple<Args...>>...)>>::value,
|
||||||
int>::type = 0>
|
int>::type = 0>
|
||||||
operator OnceAction<R(Args...)>() && { // NOLINT
|
operator OnceAction<R(Args...)>() && { // NOLINT
|
||||||
struct OA {
|
struct OA {
|
||||||
OnceAction<InnerSignature<R, Args...>> inner_action;
|
OnceAction<InnerSignature<R, Args...>> inner_action;
|
||||||
@ -1447,19 +1447,19 @@ struct WithArgsAction {
|
|||||||
return OA{std::move(inner_action)};
|
return OA{std::move(inner_action)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename R, typename... Args,
|
template <
|
||||||
typename std::enable_if<
|
typename R, typename... Args,
|
||||||
std::is_convertible<
|
typename std::enable_if<
|
||||||
const InnerAction&,
|
std::is_convertible<const InnerAction&,
|
||||||
// Unfortunately we can't use the InnerSignature alias here;
|
// Unfortunately we can't use the InnerSignature
|
||||||
// MSVC complains about the I parameter pack not being
|
// alias here; MSVC complains about the I
|
||||||
// expanded (error C3520) despite it being expanded in the
|
// parameter pack not being expanded (error C3520)
|
||||||
// type alias.
|
// despite it being expanded in the type alias.
|
||||||
// TupleElement is also an MSVC workaround.
|
// TupleElement is also an MSVC workaround.
|
||||||
// See its definition for details.
|
// See its definition for details.
|
||||||
Action<R(internal::TupleElement<
|
Action<R(internal::TupleElement<
|
||||||
I, std::tuple<Args...>>...)>>::value,
|
I, std::tuple<Args...>>...)>>::value,
|
||||||
int>::type = 0>
|
int>::type = 0>
|
||||||
operator Action<R(Args...)>() const { // NOLINT
|
operator Action<R(Args...)>() const { // NOLINT
|
||||||
Action<InnerSignature<R, Args...>> converted(inner_action);
|
Action<InnerSignature<R, Args...>> converted(inner_action);
|
||||||
|
|
||||||
|
@ -180,8 +180,9 @@ using internal::FunctionMocker;
|
|||||||
_Signature)>::Result \
|
_Signature)>::Result \
|
||||||
GMOCK_INTERNAL_EXPAND(_CallType) \
|
GMOCK_INTERNAL_EXPAND(_CallType) \
|
||||||
_MethodName(GMOCK_PP_REPEAT(GMOCK_INTERNAL_PARAMETER, _Signature, _N)) \
|
_MethodName(GMOCK_PP_REPEAT(GMOCK_INTERNAL_PARAMETER, _Signature, _N)) \
|
||||||
GMOCK_PP_IF(_Constness, const, ) _RefSpec _NoexceptSpec \
|
GMOCK_PP_IF(_Constness, const, ) \
|
||||||
GMOCK_PP_IF(_Override, override, ) GMOCK_PP_IF(_Final, final, ) { \
|
_RefSpec _NoexceptSpec GMOCK_PP_IF(_Override, override, ) \
|
||||||
|
GMOCK_PP_IF(_Final, final, ) { \
|
||||||
GMOCK_MOCKER_(_N, _Constness, _MethodName) \
|
GMOCK_MOCKER_(_N, _Constness, _MethodName) \
|
||||||
.SetOwnerAndName(this, #_MethodName); \
|
.SetOwnerAndName(this, #_MethodName); \
|
||||||
return GMOCK_MOCKER_(_N, _Constness, _MethodName) \
|
return GMOCK_MOCKER_(_N, _Constness, _MethodName) \
|
||||||
|
@ -3317,8 +3317,8 @@ class FieldsAreMatcherImpl<Struct, IndexSequence<I...>>
|
|||||||
std::vector<StringMatchResultListener> inner_listener(sizeof...(I));
|
std::vector<StringMatchResultListener> inner_listener(sizeof...(I));
|
||||||
|
|
||||||
VariadicExpand(
|
VariadicExpand(
|
||||||
{failed_pos == ~size_t{}&& !std::get<I>(matchers_).MatchAndExplain(
|
{failed_pos == ~size_t{} && !std::get<I>(matchers_).MatchAndExplain(
|
||||||
std::get<I>(tuple), &inner_listener[I])
|
std::get<I>(tuple), &inner_listener[I])
|
||||||
? failed_pos = I
|
? failed_pos = I
|
||||||
: 0 ...});
|
: 0 ...});
|
||||||
if (failed_pos != ~size_t{}) {
|
if (failed_pos != ~size_t{}) {
|
||||||
@ -5474,8 +5474,7 @@ PolymorphicMatcher<internal::ExceptionMatcherImpl<Err>> ThrowsMessage(
|
|||||||
inline name##Matcher GMOCK_INTERNAL_WARNING_PUSH() \
|
inline name##Matcher GMOCK_INTERNAL_WARNING_PUSH() \
|
||||||
GMOCK_INTERNAL_WARNING_CLANG(ignored, "-Wunused-function") \
|
GMOCK_INTERNAL_WARNING_CLANG(ignored, "-Wunused-function") \
|
||||||
GMOCK_INTERNAL_WARNING_CLANG(ignored, "-Wunused-member-function") \
|
GMOCK_INTERNAL_WARNING_CLANG(ignored, "-Wunused-member-function") \
|
||||||
name \
|
name GMOCK_INTERNAL_WARNING_POP()() { \
|
||||||
GMOCK_INTERNAL_WARNING_POP()() { \
|
|
||||||
return {}; \
|
return {}; \
|
||||||
} \
|
} \
|
||||||
template <typename arg_type> \
|
template <typename arg_type> \
|
||||||
|
@ -526,9 +526,10 @@
|
|||||||
GMOCK_INTERNAL_LIST_##value_params)){}) \
|
GMOCK_INTERNAL_LIST_##value_params)){}) \
|
||||||
GMOCK_ACTION_CLASS_(name, value_params)(const GMOCK_ACTION_CLASS_( \
|
GMOCK_ACTION_CLASS_(name, value_params)(const GMOCK_ACTION_CLASS_( \
|
||||||
name, value_params) &) noexcept GMOCK_INTERNAL_DEFN_COPY_ \
|
name, value_params) &) noexcept GMOCK_INTERNAL_DEFN_COPY_ \
|
||||||
##value_params GMOCK_ACTION_CLASS_(name, value_params)( \
|
##value_params \
|
||||||
GMOCK_ACTION_CLASS_(name, value_params) &&) noexcept \
|
GMOCK_ACTION_CLASS_(name, value_params)(GMOCK_ACTION_CLASS_( \
|
||||||
GMOCK_INTERNAL_DEFN_COPY_##value_params template <typename F> \
|
name, value_params) &&) noexcept GMOCK_INTERNAL_DEFN_COPY_ \
|
||||||
|
##value_params template <typename F> \
|
||||||
operator ::testing::Action<F>() const { \
|
operator ::testing::Action<F>() const { \
|
||||||
return GMOCK_PP_IF( \
|
return GMOCK_PP_IF( \
|
||||||
GMOCK_PP_IS_EMPTY(GMOCK_INTERNAL_COUNT_##value_params), \
|
GMOCK_PP_IS_EMPTY(GMOCK_INTERNAL_COUNT_##value_params), \
|
||||||
@ -602,13 +603,13 @@ template <std::size_t index, typename... Params>
|
|||||||
struct InvokeArgumentAction {
|
struct InvokeArgumentAction {
|
||||||
template <typename... Args,
|
template <typename... Args,
|
||||||
typename = typename std::enable_if<(index < sizeof...(Args))>::type>
|
typename = typename std::enable_if<(index < sizeof...(Args))>::type>
|
||||||
auto operator()(Args&&... args) const -> decltype(internal::InvokeArgument(
|
auto operator()(Args &&...args) const -> decltype(internal::InvokeArgument(
|
||||||
std::get<index>(std::forward_as_tuple(std::forward<Args>(args)...)),
|
std::get<index>(std::forward_as_tuple(std::forward<Args>(args)...)),
|
||||||
std::declval<const Params&>()...)) {
|
std::declval<const Params &>()...)) {
|
||||||
internal::FlatTuple<Args&&...> args_tuple(FlatTupleConstructTag{},
|
internal::FlatTuple<Args &&...> args_tuple(FlatTupleConstructTag{},
|
||||||
std::forward<Args>(args)...);
|
std::forward<Args>(args)...);
|
||||||
return params.Apply([&](const Params&... unpacked_params) {
|
return params.Apply([&](const Params &...unpacked_params) {
|
||||||
auto&& callable = args_tuple.template Get<index>();
|
auto &&callable = args_tuple.template Get<index>();
|
||||||
return internal::InvokeArgument(
|
return internal::InvokeArgument(
|
||||||
std::forward<decltype(callable)>(callable), unpacked_params...);
|
std::forward<decltype(callable)>(callable), unpacked_params...);
|
||||||
});
|
});
|
||||||
@ -648,7 +649,7 @@ struct InvokeArgumentAction {
|
|||||||
// later.
|
// later.
|
||||||
template <std::size_t index, typename... Params>
|
template <std::size_t index, typename... Params>
|
||||||
internal::InvokeArgumentAction<index, typename std::decay<Params>::type...>
|
internal::InvokeArgumentAction<index, typename std::decay<Params>::type...>
|
||||||
InvokeArgument(Params&&... params) {
|
InvokeArgument(Params &&...params) {
|
||||||
return {internal::FlatTuple<typename std::decay<Params>::type...>(
|
return {internal::FlatTuple<typename std::decay<Params>::type...>(
|
||||||
internal::FlatTupleConstructTag{}, std::forward<Params>(params)...)};
|
internal::FlatTupleConstructTag{}, std::forward<Params>(params)...)};
|
||||||
}
|
}
|
||||||
|
@ -1410,7 +1410,7 @@ TEST(DoAll, ProvidesLvalueReferencesToInitialActions) {
|
|||||||
void operator()(Obj&&) const { FAIL() << "Unexpected call"; }
|
void operator()(Obj&&) const { FAIL() << "Unexpected call"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
MockFunction<void(Obj &&)> mock;
|
MockFunction<void(Obj&&)> mock;
|
||||||
EXPECT_CALL(mock, Call)
|
EXPECT_CALL(mock, Call)
|
||||||
.WillOnce(DoAll(InitialAction{}, InitialAction{}, [](Obj&&) {}))
|
.WillOnce(DoAll(InitialAction{}, InitialAction{}, [](Obj&&) {}))
|
||||||
.WillRepeatedly(DoAll(InitialAction{}, InitialAction{}, [](Obj&&) {}));
|
.WillRepeatedly(DoAll(InitialAction{}, InitialAction{}, [](Obj&&) {}));
|
||||||
@ -1438,7 +1438,7 @@ TEST(DoAll, ProvidesLvalueReferencesToInitialActions) {
|
|||||||
void operator()(Obj&) && {}
|
void operator()(Obj&) && {}
|
||||||
};
|
};
|
||||||
|
|
||||||
MockFunction<void(Obj &&)> mock;
|
MockFunction<void(Obj&&)> mock;
|
||||||
EXPECT_CALL(mock, Call)
|
EXPECT_CALL(mock, Call)
|
||||||
.WillOnce(DoAll(InitialAction{}, InitialAction{}, [](Obj&&) {}));
|
.WillOnce(DoAll(InitialAction{}, InitialAction{}, [](Obj&&) {}));
|
||||||
|
|
||||||
|
@ -1792,8 +1792,8 @@ TEST(ThrowsPredicateCompilesTest, ExceptionMatcherAcceptsBroadType) {
|
|||||||
{
|
{
|
||||||
Matcher<uint64_t> inner = Eq(10);
|
Matcher<uint64_t> inner = Eq(10);
|
||||||
Matcher<std::function<void()>> matcher = Throws<uint32_t>(inner);
|
Matcher<std::function<void()>> matcher = Throws<uint32_t>(inner);
|
||||||
EXPECT_TRUE(matcher.Matches([]() { throw(uint32_t) 10; }));
|
EXPECT_TRUE(matcher.Matches([]() { throw (uint32_t)10; }));
|
||||||
EXPECT_FALSE(matcher.Matches([]() { throw(uint32_t) 11; }));
|
EXPECT_FALSE(matcher.Matches([]() { throw (uint32_t)11; }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,9 +148,9 @@ class GreaterThanMatcher : public MatcherInterface<T> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Names and instantiates a new instance of GTestMatcherTestP.
|
// Names and instantiates a new instance of GTestMatcherTestP.
|
||||||
#define INSTANTIATE_GTEST_MATCHER_TEST_P(TestSuite) \
|
#define INSTANTIATE_GTEST_MATCHER_TEST_P(TestSuite) \
|
||||||
using TestSuite##P = GTestMatcherTestP; \
|
using TestSuite##P = GTestMatcherTestP; \
|
||||||
INSTANTIATE_TEST_SUITE_P(MatcherInterface, TestSuite##P, Values(false)); \
|
INSTANTIATE_TEST_SUITE_P(MatcherInterface, TestSuite##P, Values(false)); \
|
||||||
INSTANTIATE_TEST_SUITE_P(GtestMatcher, TestSuite##P, Values(true))
|
INSTANTIATE_TEST_SUITE_P(GtestMatcher, TestSuite##P, Values(true))
|
||||||
|
|
||||||
class GTestMatcherTestP : public testing::TestWithParam<bool> {
|
class GTestMatcherTestP : public testing::TestWithParam<bool> {
|
||||||
|
@ -449,7 +449,8 @@ internal::ParamConverterGenerator<T> ConvertGenerator(
|
|||||||
|
|
||||||
#define TEST_P(test_suite_name, test_name) \
|
#define TEST_P(test_suite_name, test_name) \
|
||||||
class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
|
class GTEST_TEST_CLASS_NAME_(test_suite_name, test_name) \
|
||||||
: public test_suite_name, private ::testing::internal::GTestNonCopyable {\
|
: public test_suite_name, \
|
||||||
|
private ::testing::internal::GTestNonCopyable { \
|
||||||
public: \
|
public: \
|
||||||
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \
|
GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)() {} \
|
||||||
void TestBody() override; \
|
void TestBody() override; \
|
||||||
|
@ -267,28 +267,28 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
|
|||||||
TYPED_TEST_SUITE_P
|
TYPED_TEST_SUITE_P
|
||||||
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
|
||||||
|
|
||||||
#define TYPED_TEST_P(SuiteName, TestName) \
|
#define TYPED_TEST_P(SuiteName, TestName) \
|
||||||
namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \
|
namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \
|
||||||
template <typename gtest_TypeParam_> \
|
template <typename gtest_TypeParam_> \
|
||||||
class TestName : public SuiteName<gtest_TypeParam_> { \
|
class TestName : public SuiteName<gtest_TypeParam_> { \
|
||||||
private: \
|
private: \
|
||||||
typedef SuiteName<gtest_TypeParam_> TestFixture; \
|
typedef SuiteName<gtest_TypeParam_> TestFixture; \
|
||||||
typedef gtest_TypeParam_ TypeParam; \
|
typedef gtest_TypeParam_ TypeParam; \
|
||||||
void TestBody() override; \
|
void TestBody() override; \
|
||||||
}; \
|
}; \
|
||||||
static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \
|
static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \
|
||||||
GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).AddTestName( \
|
GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).AddTestName( \
|
||||||
__FILE__, __LINE__, GTEST_STRINGIFY_(SuiteName), \
|
__FILE__, __LINE__, GTEST_STRINGIFY_(SuiteName), \
|
||||||
GTEST_STRINGIFY_(TestName)); \
|
GTEST_STRINGIFY_(TestName)); \
|
||||||
} \
|
} \
|
||||||
template <typename gtest_TypeParam_> \
|
template <typename gtest_TypeParam_> \
|
||||||
void GTEST_SUITE_NAMESPACE_( \
|
void GTEST_SUITE_NAMESPACE_( \
|
||||||
SuiteName)::TestName<gtest_TypeParam_>::TestBody()
|
SuiteName)::TestName<gtest_TypeParam_>::TestBody()
|
||||||
|
|
||||||
// Note: this won't work correctly if the trailing arguments are macros.
|
// Note: this won't work correctly if the trailing arguments are macros.
|
||||||
#define REGISTER_TYPED_TEST_SUITE_P(SuiteName, ...) \
|
#define REGISTER_TYPED_TEST_SUITE_P(SuiteName, ...) \
|
||||||
namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \
|
namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \
|
||||||
typedef ::testing::internal::Templates<__VA_ARGS__> gtest_AllTests_; \
|
typedef ::testing::internal::Templates<__VA_ARGS__> gtest_AllTests_; \
|
||||||
} \
|
} \
|
||||||
static const char* const GTEST_REGISTERED_TEST_NAMES_( \
|
static const char* const GTEST_REGISTERED_TEST_NAMES_( \
|
||||||
SuiteName) GTEST_ATTRIBUTE_UNUSED_ = \
|
SuiteName) GTEST_ATTRIBUTE_UNUSED_ = \
|
||||||
|
@ -201,8 +201,8 @@ std::set<std::string>* GetIgnoredParameterizedTestSuites();
|
|||||||
class GTestNonCopyable {
|
class GTestNonCopyable {
|
||||||
public:
|
public:
|
||||||
GTestNonCopyable() = default;
|
GTestNonCopyable() = default;
|
||||||
GTestNonCopyable(const GTestNonCopyable &) = delete;
|
GTestNonCopyable(const GTestNonCopyable&) = delete;
|
||||||
GTestNonCopyable &operator=(const GTestNonCopyable &) = delete;
|
GTestNonCopyable& operator=(const GTestNonCopyable&) = delete;
|
||||||
~GTestNonCopyable() = default;
|
~GTestNonCopyable() = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -956,7 +956,7 @@ class CartesianProductHolder {
|
|||||||
template <typename From, typename To>
|
template <typename From, typename To>
|
||||||
class ParamGeneratorConverter : public ParamGeneratorInterface<To> {
|
class ParamGeneratorConverter : public ParamGeneratorInterface<To> {
|
||||||
public:
|
public:
|
||||||
ParamGeneratorConverter(ParamGenerator<From> gen) // NOLINT
|
ParamGeneratorConverter(ParamGenerator<From> gen) // NOLINT
|
||||||
: generator_(std::move(gen)) {}
|
: generator_(std::move(gen)) {}
|
||||||
|
|
||||||
ParamIteratorInterface<To>* Begin() const override {
|
ParamIteratorInterface<To>* Begin() const override {
|
||||||
|
@ -712,7 +712,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
|
|||||||
#define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \
|
#define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \
|
||||||
__attribute__((format(__MINGW_PRINTF_FORMAT, string_index, first_to_check)))
|
__attribute__((format(__MINGW_PRINTF_FORMAT, string_index, first_to_check)))
|
||||||
#elif GTEST_HAVE_ATTRIBUTE_(format)
|
#elif GTEST_HAVE_ATTRIBUTE_(format)
|
||||||
#define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \
|
#define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check) \
|
||||||
__attribute__((format(printf, string_index, first_to_check)))
|
__attribute__((format(printf, string_index, first_to_check)))
|
||||||
#else
|
#else
|
||||||
#define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check)
|
#define GTEST_ATTRIBUTE_PRINTF_(string_index, first_to_check)
|
||||||
|
@ -148,20 +148,19 @@ const char* FilePath::FindLastPathSeparator() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t FilePath::CalculateRootLength() const {
|
size_t FilePath::CalculateRootLength() const {
|
||||||
const auto &path = pathname_;
|
const auto& path = pathname_;
|
||||||
auto s = path.begin();
|
auto s = path.begin();
|
||||||
auto end = path.end();
|
auto end = path.end();
|
||||||
#if GTEST_OS_WINDOWS
|
#if GTEST_OS_WINDOWS
|
||||||
if (end - s >= 2 && s[1] == ':' &&
|
if (end - s >= 2 && s[1] == ':' && (end - s == 2 || IsPathSeparator(s[2])) &&
|
||||||
(end - s == 2 || IsPathSeparator(s[2])) &&
|
|
||||||
(('A' <= s[0] && s[0] <= 'Z') || ('a' <= s[0] && s[0] <= 'z'))) {
|
(('A' <= s[0] && s[0] <= 'Z') || ('a' <= s[0] && s[0] <= 'z'))) {
|
||||||
// A typical absolute path like "C:\Windows" or "D:"
|
// A typical absolute path like "C:\Windows" or "D:"
|
||||||
s += 2;
|
s += 2;
|
||||||
if (s != end) {
|
if (s != end) {
|
||||||
++s;
|
++s;
|
||||||
}
|
}
|
||||||
} else if (end - s >= 3 && IsPathSeparator(*s) && IsPathSeparator(*(s + 1))
|
} else if (end - s >= 3 && IsPathSeparator(*s) && IsPathSeparator(*(s + 1)) &&
|
||||||
&& !IsPathSeparator(*(s + 2))) {
|
!IsPathSeparator(*(s + 2))) {
|
||||||
// Move past the "\\" prefix in a UNC path like "\\Server\Share\Folder"
|
// Move past the "\\" prefix in a UNC path like "\\Server\Share\Folder"
|
||||||
s += 2;
|
s += 2;
|
||||||
// Skip 2 components and their following separators ("Server\" and "Share\")
|
// Skip 2 components and their following separators ("Server\" and "Share\")
|
||||||
@ -295,9 +294,7 @@ bool FilePath::IsRootDirectory() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns true if pathname describes an absolute path.
|
// Returns true if pathname describes an absolute path.
|
||||||
bool FilePath::IsAbsolutePath() const {
|
bool FilePath::IsAbsolutePath() const { return CalculateRootLength() > 0; }
|
||||||
return CalculateRootLength() > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns a pathname for a file that does not currently exist. The pathname
|
// Returns a pathname for a file that does not currently exist. The pathname
|
||||||
// will be directory/base_name.extension or
|
// will be directory/base_name.extension or
|
||||||
|
@ -1134,8 +1134,8 @@ class Timer {
|
|||||||
|
|
||||||
// Return time elapsed in milliseconds since the timer was created.
|
// Return time elapsed in milliseconds since the timer was created.
|
||||||
TimeInMillis Elapsed() {
|
TimeInMillis Elapsed() {
|
||||||
return std::chrono::duration_cast<std::chrono::milliseconds>(
|
return std::chrono::duration_cast<std::chrono::milliseconds>(clock::now() -
|
||||||
clock::now() - start_)
|
start_)
|
||||||
.count();
|
.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6172,7 +6172,7 @@ void UnitTestImpl::ListTestsMatchingFilter() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#if GTEST_HAS_FILE_SYSTEM
|
#if GTEST_HAS_FILE_SYSTEM
|
||||||
const std::string& output_format = UnitTestOptions::GetOutputFormat();
|
const std::string& output_format = UnitTestOptions::GetOutputFormat();
|
||||||
if (output_format == "xml" || output_format == "json") {
|
if (output_format == "xml" || output_format == "json") {
|
||||||
FILE* fileout = OpenFileForWriting(
|
FILE* fileout = OpenFileForWriting(
|
||||||
|
@ -461,10 +461,10 @@ TEST(PrintBuiltInTypeTest, FloatingPoints) {
|
|||||||
// float (32-bit precision)
|
// float (32-bit precision)
|
||||||
EXPECT_EQ("1.5", Print(1.5f));
|
EXPECT_EQ("1.5", Print(1.5f));
|
||||||
|
|
||||||
EXPECT_EQ("1.0999999", Print(1.09999990f));
|
EXPECT_EQ("1.0999999", Print(1.09999990f));
|
||||||
EXPECT_EQ("1.1", Print(1.10000002f));
|
EXPECT_EQ("1.1", Print(1.10000002f));
|
||||||
EXPECT_EQ("1.10000014", Print(1.10000014f));
|
EXPECT_EQ("1.10000014", Print(1.10000014f));
|
||||||
EXPECT_EQ("9e+09", Print(9e9f));
|
EXPECT_EQ("9e+09", Print(9e9f));
|
||||||
|
|
||||||
// double
|
// double
|
||||||
EXPECT_EQ("-2.5", Print(-2.5)); // double
|
EXPECT_EQ("-2.5", Print(-2.5)); // double
|
||||||
|
Loading…
Reference in New Issue
Block a user