Indents preprocessor directives.
This commit is contained in:
parent
0980b4bd66
commit
ffeb11d14a
@ -154,24 +154,24 @@ GTEST_DECLARE_string_(death_test_style);
|
|||||||
// Asserts that a given statement causes the program to exit, with an
|
// Asserts that a given statement causes the program to exit, with an
|
||||||
// integer exit status that satisfies predicate, and emitting error output
|
// integer exit status that satisfies predicate, and emitting error output
|
||||||
// that matches regex.
|
// that matches regex.
|
||||||
#define ASSERT_EXIT(statement, predicate, regex) \
|
# define ASSERT_EXIT(statement, predicate, regex) \
|
||||||
GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)
|
GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_FATAL_FAILURE_)
|
||||||
|
|
||||||
// Like ASSERT_EXIT, but continues on to successive tests in the
|
// Like ASSERT_EXIT, but continues on to successive tests in the
|
||||||
// test case, if any:
|
// test case, if any:
|
||||||
#define EXPECT_EXIT(statement, predicate, regex) \
|
# define EXPECT_EXIT(statement, predicate, regex) \
|
||||||
GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_)
|
GTEST_DEATH_TEST_(statement, predicate, regex, GTEST_NONFATAL_FAILURE_)
|
||||||
|
|
||||||
// Asserts that a given statement causes the program to exit, either by
|
// Asserts that a given statement causes the program to exit, either by
|
||||||
// explicitly exiting with a nonzero exit code or being killed by a
|
// explicitly exiting with a nonzero exit code or being killed by a
|
||||||
// signal, and emitting error output that matches regex.
|
// signal, and emitting error output that matches regex.
|
||||||
#define ASSERT_DEATH(statement, regex) \
|
# define ASSERT_DEATH(statement, regex) \
|
||||||
ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
|
ASSERT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
|
||||||
|
|
||||||
// Like ASSERT_DEATH, but continues on to successive tests in the
|
// Like ASSERT_DEATH, but continues on to successive tests in the
|
||||||
// test case, if any:
|
// test case, if any:
|
||||||
#define EXPECT_DEATH(statement, regex) \
|
# define EXPECT_DEATH(statement, regex) \
|
||||||
EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
|
EXPECT_EXIT(statement, ::testing::internal::ExitedUnsuccessfully, regex)
|
||||||
|
|
||||||
// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
|
// Two predicate classes that can be used in {ASSERT,EXPECT}_EXIT*:
|
||||||
|
|
||||||
@ -187,7 +187,7 @@ class GTEST_API_ ExitedWithCode {
|
|||||||
const int exit_code_;
|
const int exit_code_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if !GTEST_OS_WINDOWS
|
# if !GTEST_OS_WINDOWS
|
||||||
// Tests that an exit code describes an exit due to termination by a
|
// Tests that an exit code describes an exit due to termination by a
|
||||||
// given signal.
|
// given signal.
|
||||||
class GTEST_API_ KilledBySignal {
|
class GTEST_API_ KilledBySignal {
|
||||||
@ -197,7 +197,7 @@ class GTEST_API_ KilledBySignal {
|
|||||||
private:
|
private:
|
||||||
const int signum_;
|
const int signum_;
|
||||||
};
|
};
|
||||||
#endif // !GTEST_OS_WINDOWS
|
# endif // !GTEST_OS_WINDOWS
|
||||||
|
|
||||||
// EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.
|
// EXPECT_DEBUG_DEATH asserts that the given statements die in debug mode.
|
||||||
// The death testing framework causes this to have interesting semantics,
|
// The death testing framework causes this to have interesting semantics,
|
||||||
@ -242,23 +242,23 @@ class GTEST_API_ KilledBySignal {
|
|||||||
// EXPECT_EQ(12, DieInDebugOr12(&sideeffect));
|
// EXPECT_EQ(12, DieInDebugOr12(&sideeffect));
|
||||||
// }, "death");
|
// }, "death");
|
||||||
//
|
//
|
||||||
#ifdef NDEBUG
|
# ifdef NDEBUG
|
||||||
|
|
||||||
#define EXPECT_DEBUG_DEATH(statement, regex) \
|
# define EXPECT_DEBUG_DEATH(statement, regex) \
|
||||||
do { statement; } while (::testing::internal::AlwaysFalse())
|
do { statement; } while (::testing::internal::AlwaysFalse())
|
||||||
|
|
||||||
#define ASSERT_DEBUG_DEATH(statement, regex) \
|
# define ASSERT_DEBUG_DEATH(statement, regex) \
|
||||||
do { statement; } while (::testing::internal::AlwaysFalse())
|
do { statement; } while (::testing::internal::AlwaysFalse())
|
||||||
|
|
||||||
#else
|
# else
|
||||||
|
|
||||||
#define EXPECT_DEBUG_DEATH(statement, regex) \
|
# define EXPECT_DEBUG_DEATH(statement, regex) \
|
||||||
EXPECT_DEATH(statement, regex)
|
EXPECT_DEATH(statement, regex)
|
||||||
|
|
||||||
#define ASSERT_DEBUG_DEATH(statement, regex) \
|
# define ASSERT_DEBUG_DEATH(statement, regex) \
|
||||||
ASSERT_DEATH(statement, regex)
|
ASSERT_DEATH(statement, regex)
|
||||||
|
|
||||||
#endif // NDEBUG for EXPECT_DEBUG_DEATH
|
# endif // NDEBUG for EXPECT_DEBUG_DEATH
|
||||||
#endif // GTEST_HAS_DEATH_TEST
|
#endif // GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
|
// EXPECT_DEATH_IF_SUPPORTED(statement, regex) and
|
||||||
@ -267,14 +267,14 @@ class GTEST_API_ KilledBySignal {
|
|||||||
// useful when you are combining death test assertions with normal test
|
// useful when you are combining death test assertions with normal test
|
||||||
// assertions in one test.
|
// assertions in one test.
|
||||||
#if GTEST_HAS_DEATH_TEST
|
#if GTEST_HAS_DEATH_TEST
|
||||||
#define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
|
# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
|
||||||
EXPECT_DEATH(statement, regex)
|
EXPECT_DEATH(statement, regex)
|
||||||
#define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
|
# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
|
||||||
ASSERT_DEATH(statement, regex)
|
ASSERT_DEATH(statement, regex)
|
||||||
#else
|
#else
|
||||||
#define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
|
# define EXPECT_DEATH_IF_SUPPORTED(statement, regex) \
|
||||||
GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, )
|
GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, )
|
||||||
#define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
|
# define ASSERT_DEATH_IF_SUPPORTED(statement, regex) \
|
||||||
GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return)
|
GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, return)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -192,6 +192,7 @@ class GTEST_API_ Message {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
#if GTEST_OS_SYMBIAN
|
#if GTEST_OS_SYMBIAN
|
||||||
// These are needed as the Nokia Symbian Compiler cannot decide between
|
// These are needed as the Nokia Symbian Compiler cannot decide between
|
||||||
// const T& and const T* in a function template. The Nokia compiler _can_
|
// const T& and const T* in a function template. The Nokia compiler _can_
|
||||||
|
@ -182,7 +182,7 @@ TEST_P(DerivedTest, DoesBlah) {
|
|||||||
#include "gtest/internal/gtest-port.h"
|
#include "gtest/internal/gtest-port.h"
|
||||||
|
|
||||||
#if !GTEST_OS_SYMBIAN
|
#if !GTEST_OS_SYMBIAN
|
||||||
#include <utility>
|
# include <utility>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// scripts/fuse_gtest.py depends on gtest's own header being #included
|
// scripts/fuse_gtest.py depends on gtest's own header being #included
|
||||||
@ -1222,7 +1222,7 @@ inline internal::ParamGenerator<bool> Bool() {
|
|||||||
return Values(false, true);
|
return Values(false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_HAS_COMBINE
|
# if GTEST_HAS_COMBINE
|
||||||
// Combine() allows the user to combine two or more sequences to produce
|
// Combine() allows the user to combine two or more sequences to produce
|
||||||
// values of a Cartesian product of those sequences' elements.
|
// values of a Cartesian product of those sequences' elements.
|
||||||
//
|
//
|
||||||
@ -1374,11 +1374,11 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
|
|||||||
Generator10>(
|
Generator10>(
|
||||||
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10);
|
g1, g2, g3, g4, g5, g6, g7, g8, g9, g10);
|
||||||
}
|
}
|
||||||
#endif // GTEST_HAS_COMBINE
|
# endif // GTEST_HAS_COMBINE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define TEST_P(test_case_name, test_name) \
|
# define TEST_P(test_case_name, test_name) \
|
||||||
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
|
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
|
||||||
: public test_case_name { \
|
: public test_case_name { \
|
||||||
public: \
|
public: \
|
||||||
@ -1404,7 +1404,7 @@ internal::CartesianProductHolder10<Generator1, Generator2, Generator3,
|
|||||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
|
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
|
||||||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
|
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
|
||||||
|
|
||||||
#define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \
|
# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \
|
||||||
::testing::internal::ParamGenerator<test_case_name::ParamType> \
|
::testing::internal::ParamGenerator<test_case_name::ParamType> \
|
||||||
gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
|
gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
|
||||||
int gtest_##prefix##test_case_name##_dummy_ = \
|
int gtest_##prefix##test_case_name##_dummy_ = \
|
||||||
|
@ -181,7 +181,7 @@ TEST_P(DerivedTest, DoesBlah) {
|
|||||||
#include "gtest/internal/gtest-port.h"
|
#include "gtest/internal/gtest-port.h"
|
||||||
|
|
||||||
#if !GTEST_OS_SYMBIAN
|
#if !GTEST_OS_SYMBIAN
|
||||||
#include <utility>
|
# include <utility>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// scripts/fuse_gtest.py depends on gtest's own header being #included
|
// scripts/fuse_gtest.py depends on gtest's own header being #included
|
||||||
@ -379,7 +379,7 @@ inline internal::ParamGenerator<bool> Bool() {
|
|||||||
return Values(false, true);
|
return Values(false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_HAS_COMBINE
|
# if GTEST_HAS_COMBINE
|
||||||
// Combine() allows the user to combine two or more sequences to produce
|
// Combine() allows the user to combine two or more sequences to produce
|
||||||
// values of a Cartesian product of those sequences' elements.
|
// values of a Cartesian product of those sequences' elements.
|
||||||
//
|
//
|
||||||
@ -440,11 +440,11 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
|
|||||||
}
|
}
|
||||||
|
|
||||||
]]
|
]]
|
||||||
#endif // GTEST_HAS_COMBINE
|
# endif // GTEST_HAS_COMBINE
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define TEST_P(test_case_name, test_name) \
|
# define TEST_P(test_case_name, test_name) \
|
||||||
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
|
class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \
|
||||||
: public test_case_name { \
|
: public test_case_name { \
|
||||||
public: \
|
public: \
|
||||||
@ -470,7 +470,7 @@ internal::CartesianProductHolder$i<$for j, [[Generator$j]]> Combine(
|
|||||||
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
|
GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::AddToRegistry(); \
|
||||||
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
|
void GTEST_TEST_CLASS_NAME_(test_case_name, test_name)::TestBody()
|
||||||
|
|
||||||
#define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \
|
# define INSTANTIATE_TEST_CASE_P(prefix, test_case_name, generator) \
|
||||||
::testing::internal::ParamGenerator<test_case_name::ParamType> \
|
::testing::internal::ParamGenerator<test_case_name::ParamType> \
|
||||||
gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
|
gtest_##prefix##test_case_name##_EvalGenerator_() { return generator; } \
|
||||||
int gtest_##prefix##test_case_name##_dummy_ = \
|
int gtest_##prefix##test_case_name##_dummy_ = \
|
||||||
|
@ -578,8 +578,8 @@ class UniversalPrinter {
|
|||||||
// MSVC warns about adding const to a function type, so we want to
|
// MSVC warns about adding const to a function type, so we want to
|
||||||
// disable the warning.
|
// disable the warning.
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push) // Saves the current warning state.
|
# pragma warning(push) // Saves the current warning state.
|
||||||
#pragma warning(disable:4180) // Temporarily disables warning 4180.
|
# pragma warning(disable:4180) // Temporarily disables warning 4180.
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
|
||||||
// Note: we deliberately don't call this PrintTo(), as that name
|
// Note: we deliberately don't call this PrintTo(), as that name
|
||||||
@ -598,7 +598,7 @@ class UniversalPrinter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(pop) // Restores the warning state.
|
# pragma warning(pop) // Restores the warning state.
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -649,8 +649,8 @@ class UniversalPrinter<T&> {
|
|||||||
// MSVC warns about adding const to a function type, so we want to
|
// MSVC warns about adding const to a function type, so we want to
|
||||||
// disable the warning.
|
// disable the warning.
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push) // Saves the current warning state.
|
# pragma warning(push) // Saves the current warning state.
|
||||||
#pragma warning(disable:4180) // Temporarily disables warning 4180.
|
# pragma warning(disable:4180) // Temporarily disables warning 4180.
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
|
||||||
static void Print(const T& value, ::std::ostream* os) {
|
static void Print(const T& value, ::std::ostream* os) {
|
||||||
@ -663,7 +663,7 @@ class UniversalPrinter<T&> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(pop) // Restores the warning state.
|
# pragma warning(pop) // Restores the warning state.
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -157,16 +157,16 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
|
|||||||
//
|
//
|
||||||
// Expands to the name of the typedef for the type parameters of the
|
// Expands to the name of the typedef for the type parameters of the
|
||||||
// given test case.
|
// given test case.
|
||||||
#define GTEST_TYPE_PARAMS_(TestCaseName) gtest_type_params_##TestCaseName##_
|
# define GTEST_TYPE_PARAMS_(TestCaseName) gtest_type_params_##TestCaseName##_
|
||||||
|
|
||||||
// The 'Types' template argument below must have spaces around it
|
// The 'Types' template argument below must have spaces around it
|
||||||
// since some compilers may choke on '>>' when passing a template
|
// since some compilers may choke on '>>' when passing a template
|
||||||
// instance (e.g. Types<int>)
|
// instance (e.g. Types<int>)
|
||||||
#define TYPED_TEST_CASE(CaseName, Types) \
|
# define TYPED_TEST_CASE(CaseName, Types) \
|
||||||
typedef ::testing::internal::TypeList< Types >::type \
|
typedef ::testing::internal::TypeList< Types >::type \
|
||||||
GTEST_TYPE_PARAMS_(CaseName)
|
GTEST_TYPE_PARAMS_(CaseName)
|
||||||
|
|
||||||
#define TYPED_TEST(CaseName, TestName) \
|
# define TYPED_TEST(CaseName, TestName) \
|
||||||
template <typename gtest_TypeParam_> \
|
template <typename gtest_TypeParam_> \
|
||||||
class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \
|
class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \
|
||||||
: public CaseName<gtest_TypeParam_> { \
|
: public CaseName<gtest_TypeParam_> { \
|
||||||
@ -196,31 +196,31 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
|
|||||||
// Expands to the namespace name that the type-parameterized tests for
|
// Expands to the namespace name that the type-parameterized tests for
|
||||||
// the given type-parameterized test case are defined in. The exact
|
// the given type-parameterized test case are defined in. The exact
|
||||||
// name of the namespace is subject to change without notice.
|
// name of the namespace is subject to change without notice.
|
||||||
#define GTEST_CASE_NAMESPACE_(TestCaseName) \
|
# define GTEST_CASE_NAMESPACE_(TestCaseName) \
|
||||||
gtest_case_##TestCaseName##_
|
gtest_case_##TestCaseName##_
|
||||||
|
|
||||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
||||||
//
|
//
|
||||||
// Expands to the name of the variable used to remember the names of
|
// Expands to the name of the variable used to remember the names of
|
||||||
// the defined tests in the given test case.
|
// the defined tests in the given test case.
|
||||||
#define GTEST_TYPED_TEST_CASE_P_STATE_(TestCaseName) \
|
# define GTEST_TYPED_TEST_CASE_P_STATE_(TestCaseName) \
|
||||||
gtest_typed_test_case_p_state_##TestCaseName##_
|
gtest_typed_test_case_p_state_##TestCaseName##_
|
||||||
|
|
||||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY.
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE DIRECTLY.
|
||||||
//
|
//
|
||||||
// Expands to the name of the variable used to remember the names of
|
// Expands to the name of the variable used to remember the names of
|
||||||
// the registered tests in the given test case.
|
// the registered tests in the given test case.
|
||||||
#define GTEST_REGISTERED_TEST_NAMES_(TestCaseName) \
|
# define GTEST_REGISTERED_TEST_NAMES_(TestCaseName) \
|
||||||
gtest_registered_test_names_##TestCaseName##_
|
gtest_registered_test_names_##TestCaseName##_
|
||||||
|
|
||||||
// The variables defined in the type-parameterized test macros are
|
// The variables defined in the type-parameterized test macros are
|
||||||
// static as typically these macros are used in a .h file that can be
|
// static as typically these macros are used in a .h file that can be
|
||||||
// #included in multiple translation units linked together.
|
// #included in multiple translation units linked together.
|
||||||
#define TYPED_TEST_CASE_P(CaseName) \
|
# define TYPED_TEST_CASE_P(CaseName) \
|
||||||
static ::testing::internal::TypedTestCasePState \
|
static ::testing::internal::TypedTestCasePState \
|
||||||
GTEST_TYPED_TEST_CASE_P_STATE_(CaseName)
|
GTEST_TYPED_TEST_CASE_P_STATE_(CaseName)
|
||||||
|
|
||||||
#define TYPED_TEST_P(CaseName, TestName) \
|
# define TYPED_TEST_P(CaseName, TestName) \
|
||||||
namespace GTEST_CASE_NAMESPACE_(CaseName) { \
|
namespace GTEST_CASE_NAMESPACE_(CaseName) { \
|
||||||
template <typename gtest_TypeParam_> \
|
template <typename gtest_TypeParam_> \
|
||||||
class TestName : public CaseName<gtest_TypeParam_> { \
|
class TestName : public CaseName<gtest_TypeParam_> { \
|
||||||
@ -236,7 +236,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
|
|||||||
template <typename gtest_TypeParam_> \
|
template <typename gtest_TypeParam_> \
|
||||||
void GTEST_CASE_NAMESPACE_(CaseName)::TestName<gtest_TypeParam_>::TestBody()
|
void GTEST_CASE_NAMESPACE_(CaseName)::TestName<gtest_TypeParam_>::TestBody()
|
||||||
|
|
||||||
#define REGISTER_TYPED_TEST_CASE_P(CaseName, ...) \
|
# define REGISTER_TYPED_TEST_CASE_P(CaseName, ...) \
|
||||||
namespace GTEST_CASE_NAMESPACE_(CaseName) { \
|
namespace GTEST_CASE_NAMESPACE_(CaseName) { \
|
||||||
typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \
|
typedef ::testing::internal::Templates<__VA_ARGS__>::type gtest_AllTests_; \
|
||||||
} \
|
} \
|
||||||
@ -247,7 +247,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
|
|||||||
// The 'Types' template argument below must have spaces around it
|
// The 'Types' template argument below must have spaces around it
|
||||||
// since some compilers may choke on '>>' when passing a template
|
// since some compilers may choke on '>>' when passing a template
|
||||||
// instance (e.g. Types<int>)
|
// instance (e.g. Types<int>)
|
||||||
#define INSTANTIATE_TYPED_TEST_CASE_P(Prefix, CaseName, Types) \
|
# define INSTANTIATE_TYPED_TEST_CASE_P(Prefix, CaseName, Types) \
|
||||||
bool gtest_##Prefix##_##CaseName GTEST_ATTRIBUTE_UNUSED_ = \
|
bool gtest_##Prefix##_##CaseName GTEST_ATTRIBUTE_UNUSED_ = \
|
||||||
::testing::internal::TypeParameterizedTestCase<CaseName, \
|
::testing::internal::TypeParameterizedTestCase<CaseName, \
|
||||||
GTEST_CASE_NAMESPACE_(CaseName)::gtest_AllTests_, \
|
GTEST_CASE_NAMESPACE_(CaseName)::gtest_AllTests_, \
|
||||||
|
@ -672,6 +672,7 @@ class GTEST_API_ TestInfo {
|
|||||||
const TestResult* result() const { return &result_; }
|
const TestResult* result() const { return &result_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
#if GTEST_HAS_DEATH_TEST
|
#if GTEST_HAS_DEATH_TEST
|
||||||
friend class internal::DefaultDeathTestFactory;
|
friend class internal::DefaultDeathTestFactory;
|
||||||
#endif // GTEST_HAS_DEATH_TEST
|
#endif // GTEST_HAS_DEATH_TEST
|
||||||
@ -1305,8 +1306,8 @@ AssertionResult CmpHelperEQ(const char* expected_expression,
|
|||||||
const T1& expected,
|
const T1& expected,
|
||||||
const T2& actual) {
|
const T2& actual) {
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push) // Saves the current warning state.
|
# pragma warning(push) // Saves the current warning state.
|
||||||
#pragma warning(disable:4389) // Temporarily disables warning on
|
# pragma warning(disable:4389) // Temporarily disables warning on
|
||||||
// signed/unsigned mismatch.
|
// signed/unsigned mismatch.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1315,7 +1316,7 @@ AssertionResult CmpHelperEQ(const char* expected_expression,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(pop) // Restores the warning state.
|
# pragma warning(pop) // Restores the warning state.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return EqFailure(expected_expression,
|
return EqFailure(expected_expression,
|
||||||
@ -1740,7 +1741,7 @@ class TestWithParam : public Test, public WithParamInterface<T> {
|
|||||||
// Define this macro to 1 to omit the definition of FAIL(), which is a
|
// Define this macro to 1 to omit the definition of FAIL(), which is a
|
||||||
// generic name and clashes with some other libraries.
|
// generic name and clashes with some other libraries.
|
||||||
#if !GTEST_DONT_DEFINE_FAIL
|
#if !GTEST_DONT_DEFINE_FAIL
|
||||||
#define FAIL() GTEST_FAIL()
|
# define FAIL() GTEST_FAIL()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Generates a success with a generic message.
|
// Generates a success with a generic message.
|
||||||
@ -1749,7 +1750,7 @@ class TestWithParam : public Test, public WithParamInterface<T> {
|
|||||||
// Define this macro to 1 to omit the definition of SUCCEED(), which
|
// Define this macro to 1 to omit the definition of SUCCEED(), which
|
||||||
// is a generic name and clashes with some other libraries.
|
// is a generic name and clashes with some other libraries.
|
||||||
#if !GTEST_DONT_DEFINE_SUCCEED
|
#if !GTEST_DONT_DEFINE_SUCCEED
|
||||||
#define SUCCEED() GTEST_SUCCEED()
|
# define SUCCEED() GTEST_SUCCEED()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Macros for testing exceptions.
|
// Macros for testing exceptions.
|
||||||
@ -1874,27 +1875,27 @@ class TestWithParam : public Test, public WithParamInterface<T> {
|
|||||||
// ASSERT_XY(), which clashes with some users' own code.
|
// ASSERT_XY(), which clashes with some users' own code.
|
||||||
|
|
||||||
#if !GTEST_DONT_DEFINE_ASSERT_EQ
|
#if !GTEST_DONT_DEFINE_ASSERT_EQ
|
||||||
#define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
|
# define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !GTEST_DONT_DEFINE_ASSERT_NE
|
#if !GTEST_DONT_DEFINE_ASSERT_NE
|
||||||
#define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
|
# define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !GTEST_DONT_DEFINE_ASSERT_LE
|
#if !GTEST_DONT_DEFINE_ASSERT_LE
|
||||||
#define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
|
# define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !GTEST_DONT_DEFINE_ASSERT_LT
|
#if !GTEST_DONT_DEFINE_ASSERT_LT
|
||||||
#define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
|
# define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !GTEST_DONT_DEFINE_ASSERT_GE
|
#if !GTEST_DONT_DEFINE_ASSERT_GE
|
||||||
#define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
|
# define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !GTEST_DONT_DEFINE_ASSERT_GT
|
#if !GTEST_DONT_DEFINE_ASSERT_GT
|
||||||
#define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
|
# define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// C String Comparisons. All tests treat NULL and any non-NULL string
|
// C String Comparisons. All tests treat NULL and any non-NULL string
|
||||||
@ -1993,16 +1994,16 @@ GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
|
|||||||
// expected result and the actual result with both a human-readable
|
// expected result and the actual result with both a human-readable
|
||||||
// string representation of the error, if available, as well as the
|
// string representation of the error, if available, as well as the
|
||||||
// hex result code.
|
// hex result code.
|
||||||
#define EXPECT_HRESULT_SUCCEEDED(expr) \
|
# define EXPECT_HRESULT_SUCCEEDED(expr) \
|
||||||
EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
|
EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
|
||||||
|
|
||||||
#define ASSERT_HRESULT_SUCCEEDED(expr) \
|
# define ASSERT_HRESULT_SUCCEEDED(expr) \
|
||||||
ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
|
ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
|
||||||
|
|
||||||
#define EXPECT_HRESULT_FAILED(expr) \
|
# define EXPECT_HRESULT_FAILED(expr) \
|
||||||
EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
|
EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
|
||||||
|
|
||||||
#define ASSERT_HRESULT_FAILED(expr) \
|
# define ASSERT_HRESULT_FAILED(expr) \
|
||||||
ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
|
ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
|
||||||
|
|
||||||
#endif // GTEST_OS_WINDOWS
|
#endif // GTEST_OS_WINDOWS
|
||||||
@ -2105,7 +2106,7 @@ bool StaticAssertTypeEq() {
|
|||||||
// Define this macro to 1 to omit the definition of TEST(), which
|
// Define this macro to 1 to omit the definition of TEST(), which
|
||||||
// is a generic name and clashes with some other libraries.
|
// is a generic name and clashes with some other libraries.
|
||||||
#if !GTEST_DONT_DEFINE_TEST
|
#if !GTEST_DONT_DEFINE_TEST
|
||||||
#define TEST(test_case_name, test_name) GTEST_TEST(test_case_name, test_name)
|
# define TEST(test_case_name, test_name) GTEST_TEST(test_case_name, test_name)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Defines a test that uses a test fixture.
|
// Defines a test that uses a test fixture.
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
// Makes sure this header is not included before gtest.h.
|
// Makes sure this header is not included before gtest.h.
|
||||||
#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
|
#ifndef GTEST_INCLUDE_GTEST_GTEST_H_
|
||||||
#error Do not include gtest_pred_impl.h directly. Include gtest.h instead.
|
# error Do not include gtest_pred_impl.h directly. Include gtest.h instead.
|
||||||
#endif // GTEST_INCLUDE_GTEST_GTEST_H_
|
#endif // GTEST_INCLUDE_GTEST_GTEST_H_
|
||||||
|
|
||||||
// This header implements a family of generic predicate assertion
|
// This header implements a family of generic predicate assertion
|
||||||
|
@ -157,8 +157,8 @@ GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
|
|||||||
|
|
||||||
// Traps C++ exceptions escaping statement and reports them as test
|
// Traps C++ exceptions escaping statement and reports them as test
|
||||||
// failures. Note that trapping SEH exceptions is not implemented here.
|
// failures. Note that trapping SEH exceptions is not implemented here.
|
||||||
#if GTEST_HAS_EXCEPTIONS
|
# if GTEST_HAS_EXCEPTIONS
|
||||||
#define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
|
# define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
|
||||||
try { \
|
try { \
|
||||||
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
|
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
|
||||||
} catch (const ::std::exception& gtest_exception) { \
|
} catch (const ::std::exception& gtest_exception) { \
|
||||||
@ -173,14 +173,16 @@ GTEST_API_ bool ExitedUnsuccessfully(int exit_status);
|
|||||||
} catch (...) { \
|
} catch (...) { \
|
||||||
death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
|
death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
#define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
|
# else
|
||||||
|
# define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
|
||||||
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
|
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
|
||||||
#endif
|
|
||||||
|
# endif
|
||||||
|
|
||||||
// This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
|
// This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,
|
||||||
// ASSERT_EXIT*, and EXPECT_EXIT*.
|
// ASSERT_EXIT*, and EXPECT_EXIT*.
|
||||||
#define GTEST_DEATH_TEST_(statement, predicate, regex, fail) \
|
# define GTEST_DEATH_TEST_(statement, predicate, regex, fail) \
|
||||||
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||||
if (::testing::internal::AlwaysTrue()) { \
|
if (::testing::internal::AlwaysTrue()) { \
|
||||||
const ::testing::internal::RE& gtest_regex = (regex); \
|
const ::testing::internal::RE& gtest_regex = (regex); \
|
||||||
@ -285,7 +287,7 @@ InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag();
|
|||||||
// statement unconditionally returns or throws. The Message constructor at
|
// statement unconditionally returns or throws. The Message constructor at
|
||||||
// the end allows the syntax of streaming additional messages into the
|
// the end allows the syntax of streaming additional messages into the
|
||||||
// macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
|
// macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH.
|
||||||
#define GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, terminator) \
|
# define GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, terminator) \
|
||||||
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
|
||||||
if (::testing::internal::AlwaysTrue()) { \
|
if (::testing::internal::AlwaysTrue()) { \
|
||||||
GTEST_LOG_(WARNING) \
|
GTEST_LOG_(WARNING) \
|
||||||
|
@ -40,10 +40,10 @@
|
|||||||
#include "gtest/internal/gtest-port.h"
|
#include "gtest/internal/gtest-port.h"
|
||||||
|
|
||||||
#if GTEST_OS_LINUX
|
#if GTEST_OS_LINUX
|
||||||
#include <stdlib.h>
|
# include <stdlib.h>
|
||||||
#include <sys/types.h>
|
# include <sys/types.h>
|
||||||
#include <sys/wait.h>
|
# include <sys/wait.h>
|
||||||
#include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif // GTEST_OS_LINUX
|
#endif // GTEST_OS_LINUX
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@ -156,9 +156,9 @@ char (&IsNullLiteralHelper(...))[2]; // NOLINT
|
|||||||
#ifdef GTEST_ELLIPSIS_NEEDS_POD_
|
#ifdef GTEST_ELLIPSIS_NEEDS_POD_
|
||||||
// We lose support for NULL detection where the compiler doesn't like
|
// We lose support for NULL detection where the compiler doesn't like
|
||||||
// passing non-POD classes through ellipsis (...).
|
// passing non-POD classes through ellipsis (...).
|
||||||
#define GTEST_IS_NULL_LITERAL_(x) false
|
# define GTEST_IS_NULL_LITERAL_(x) false
|
||||||
#else
|
#else
|
||||||
#define GTEST_IS_NULL_LITERAL_(x) \
|
# define GTEST_IS_NULL_LITERAL_(x) \
|
||||||
(sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)
|
(sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)
|
||||||
#endif // GTEST_ELLIPSIS_NEEDS_POD_
|
#endif // GTEST_ELLIPSIS_NEEDS_POD_
|
||||||
|
|
||||||
@ -867,11 +867,12 @@ class ImplicitlyConvertible {
|
|||||||
// possible loss of data, so we need to temporarily disable the
|
// possible loss of data, so we need to temporarily disable the
|
||||||
// warning.
|
// warning.
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push) // Saves the current warning state.
|
# pragma warning(push) // Saves the current warning state.
|
||||||
#pragma warning(disable:4244) // Temporarily disables warning 4244.
|
# pragma warning(disable:4244) // Temporarily disables warning 4244.
|
||||||
|
|
||||||
static const bool value =
|
static const bool value =
|
||||||
sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
|
sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
|
||||||
#pragma warning(pop) // Restores the warning state.
|
# pragma warning(pop) // Restores the warning state.
|
||||||
#else
|
#else
|
||||||
static const bool value =
|
static const bool value =
|
||||||
sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
|
sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
|
||||||
|
@ -2826,7 +2826,7 @@ class ValueArray50 {
|
|||||||
const T50 v50_;
|
const T50 v50_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if GTEST_HAS_COMBINE
|
# if GTEST_HAS_COMBINE
|
||||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
||||||
//
|
//
|
||||||
// Generates values from the Cartesian product of values produced
|
// Generates values from the Cartesian product of values produced
|
||||||
@ -4810,7 +4810,7 @@ CartesianProductHolder10(const Generator1& g1, const Generator2& g2,
|
|||||||
const Generator10 g10_;
|
const Generator10 g10_;
|
||||||
}; // class CartesianProductHolder10
|
}; // class CartesianProductHolder10
|
||||||
|
|
||||||
#endif // GTEST_HAS_COMBINE
|
# endif // GTEST_HAS_COMBINE
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
@ -115,7 +115,7 @@ $for j [[
|
|||||||
|
|
||||||
]]
|
]]
|
||||||
|
|
||||||
#if GTEST_HAS_COMBINE
|
# if GTEST_HAS_COMBINE
|
||||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
||||||
//
|
//
|
||||||
// Generates values from the Cartesian product of values produced
|
// Generates values from the Cartesian product of values produced
|
||||||
@ -291,7 +291,7 @@ $for j [[
|
|||||||
|
|
||||||
]]
|
]]
|
||||||
|
|
||||||
#endif // GTEST_HAS_COMBINE
|
# endif // GTEST_HAS_COMBINE
|
||||||
|
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
} // namespace testing
|
} // namespace testing
|
||||||
|
@ -185,8 +185,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifndef _WIN32_WCE
|
#ifndef _WIN32_WCE
|
||||||
#include <sys/types.h>
|
# include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
# include <sys/stat.h>
|
||||||
#endif // !_WIN32_WCE
|
#endif // !_WIN32_WCE
|
||||||
|
|
||||||
#include <iostream> // NOLINT
|
#include <iostream> // NOLINT
|
||||||
@ -203,36 +203,36 @@
|
|||||||
// Determines the version of gcc that is used to compile this.
|
// Determines the version of gcc that is used to compile this.
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
// 40302 means version 4.3.2.
|
// 40302 means version 4.3.2.
|
||||||
#define GTEST_GCC_VER_ \
|
# define GTEST_GCC_VER_ \
|
||||||
(__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
|
(__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__)
|
||||||
#endif // __GNUC__
|
#endif // __GNUC__
|
||||||
|
|
||||||
// Determines the platform on which Google Test is compiled.
|
// Determines the platform on which Google Test is compiled.
|
||||||
#ifdef __CYGWIN__
|
#ifdef __CYGWIN__
|
||||||
#define GTEST_OS_CYGWIN 1
|
# define GTEST_OS_CYGWIN 1
|
||||||
#elif defined __SYMBIAN32__
|
#elif defined __SYMBIAN32__
|
||||||
#define GTEST_OS_SYMBIAN 1
|
# define GTEST_OS_SYMBIAN 1
|
||||||
#elif defined _WIN32
|
#elif defined _WIN32
|
||||||
#define GTEST_OS_WINDOWS 1
|
# define GTEST_OS_WINDOWS 1
|
||||||
#ifdef _WIN32_WCE
|
# ifdef _WIN32_WCE
|
||||||
#define GTEST_OS_WINDOWS_MOBILE 1
|
# define GTEST_OS_WINDOWS_MOBILE 1
|
||||||
#elif defined(__MINGW__) || defined(__MINGW32__)
|
# elif defined(__MINGW__) || defined(__MINGW32__)
|
||||||
#define GTEST_OS_WINDOWS_MINGW 1
|
# define GTEST_OS_WINDOWS_MINGW 1
|
||||||
#else
|
# else
|
||||||
#define GTEST_OS_WINDOWS_DESKTOP 1
|
# define GTEST_OS_WINDOWS_DESKTOP 1
|
||||||
#endif // _WIN32_WCE
|
# endif // _WIN32_WCE
|
||||||
#elif defined __APPLE__
|
#elif defined __APPLE__
|
||||||
#define GTEST_OS_MAC 1
|
# define GTEST_OS_MAC 1
|
||||||
#elif defined __linux__
|
#elif defined __linux__
|
||||||
#define GTEST_OS_LINUX 1
|
# define GTEST_OS_LINUX 1
|
||||||
#elif defined __MVS__
|
#elif defined __MVS__
|
||||||
#define GTEST_OS_ZOS 1
|
# define GTEST_OS_ZOS 1
|
||||||
#elif defined(__sun) && defined(__SVR4)
|
#elif defined(__sun) && defined(__SVR4)
|
||||||
#define GTEST_OS_SOLARIS 1
|
# define GTEST_OS_SOLARIS 1
|
||||||
#elif defined(_AIX)
|
#elif defined(_AIX)
|
||||||
#define GTEST_OS_AIX 1
|
# define GTEST_OS_AIX 1
|
||||||
#elif defined __native_client__
|
#elif defined __native_client__
|
||||||
#define GTEST_OS_NACL 1
|
# define GTEST_OS_NACL 1
|
||||||
#endif // __CYGWIN__
|
#endif // __CYGWIN__
|
||||||
|
|
||||||
// Brings in definitions for functions used in the testing::internal::posix
|
// Brings in definitions for functions used in the testing::internal::posix
|
||||||
@ -242,21 +242,21 @@
|
|||||||
// This assumes that non-Windows OSes provide unistd.h. For OSes where this
|
// This assumes that non-Windows OSes provide unistd.h. For OSes where this
|
||||||
// is not the case, we need to include headers that provide the functions
|
// is not the case, we need to include headers that provide the functions
|
||||||
// mentioned above.
|
// mentioned above.
|
||||||
#include <unistd.h>
|
# include <unistd.h>
|
||||||
#if !GTEST_OS_NACL
|
# if !GTEST_OS_NACL
|
||||||
// TODO(vladl@google.com): Remove this condition when Native Client SDK adds
|
// TODO(vladl@google.com): Remove this condition when Native Client SDK adds
|
||||||
// strings.h (tracked in
|
// strings.h (tracked in
|
||||||
// http://code.google.com/p/nativeclient/issues/detail?id=1175).
|
// http://code.google.com/p/nativeclient/issues/detail?id=1175).
|
||||||
#include <strings.h> // Native Client doesn't provide strings.h.
|
# include <strings.h> // Native Client doesn't provide strings.h.
|
||||||
#endif
|
# endif
|
||||||
#elif !GTEST_OS_WINDOWS_MOBILE
|
#elif !GTEST_OS_WINDOWS_MOBILE
|
||||||
#include <direct.h>
|
# include <direct.h>
|
||||||
#include <io.h>
|
# include <io.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Defines this to true iff Google Test can use POSIX regular expressions.
|
// Defines this to true iff Google Test can use POSIX regular expressions.
|
||||||
#ifndef GTEST_HAS_POSIX_RE
|
#ifndef GTEST_HAS_POSIX_RE
|
||||||
#define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS)
|
# define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GTEST_HAS_POSIX_RE
|
#if GTEST_HAS_POSIX_RE
|
||||||
@ -265,67 +265,67 @@
|
|||||||
// won't compile otherwise. We can #include it here as we already
|
// won't compile otherwise. We can #include it here as we already
|
||||||
// included <stdlib.h>, which is guaranteed to define size_t through
|
// included <stdlib.h>, which is guaranteed to define size_t through
|
||||||
// <stddef.h>.
|
// <stddef.h>.
|
||||||
#include <regex.h> // NOLINT
|
# include <regex.h> // NOLINT
|
||||||
|
|
||||||
#define GTEST_USES_POSIX_RE 1
|
# define GTEST_USES_POSIX_RE 1
|
||||||
|
|
||||||
#elif GTEST_OS_WINDOWS
|
#elif GTEST_OS_WINDOWS
|
||||||
|
|
||||||
// <regex.h> is not available on Windows. Use our own simple regex
|
// <regex.h> is not available on Windows. Use our own simple regex
|
||||||
// implementation instead.
|
// implementation instead.
|
||||||
#define GTEST_USES_SIMPLE_RE 1
|
# define GTEST_USES_SIMPLE_RE 1
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// <regex.h> may not be available on this platform. Use our own
|
// <regex.h> may not be available on this platform. Use our own
|
||||||
// simple regex implementation instead.
|
// simple regex implementation instead.
|
||||||
#define GTEST_USES_SIMPLE_RE 1
|
# define GTEST_USES_SIMPLE_RE 1
|
||||||
|
|
||||||
#endif // GTEST_HAS_POSIX_RE
|
#endif // GTEST_HAS_POSIX_RE
|
||||||
|
|
||||||
#ifndef GTEST_HAS_EXCEPTIONS
|
#ifndef GTEST_HAS_EXCEPTIONS
|
||||||
// The user didn't tell us whether exceptions are enabled, so we need
|
// The user didn't tell us whether exceptions are enabled, so we need
|
||||||
// to figure it out.
|
// to figure it out.
|
||||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
# if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||||
// MSVC's and C++Builder's implementations of the STL use the _HAS_EXCEPTIONS
|
// MSVC's and C++Builder's implementations of the STL use the _HAS_EXCEPTIONS
|
||||||
// macro to enable exceptions, so we'll do the same.
|
// macro to enable exceptions, so we'll do the same.
|
||||||
// Assumes that exceptions are enabled by default.
|
// Assumes that exceptions are enabled by default.
|
||||||
#ifndef _HAS_EXCEPTIONS
|
# ifndef _HAS_EXCEPTIONS
|
||||||
#define _HAS_EXCEPTIONS 1
|
# define _HAS_EXCEPTIONS 1
|
||||||
#endif // _HAS_EXCEPTIONS
|
# endif // _HAS_EXCEPTIONS
|
||||||
#define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
|
# define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS
|
||||||
#elif defined(__GNUC__) && __EXCEPTIONS
|
# elif defined(__GNUC__) && __EXCEPTIONS
|
||||||
// gcc defines __EXCEPTIONS to 1 iff exceptions are enabled.
|
// gcc defines __EXCEPTIONS to 1 iff exceptions are enabled.
|
||||||
#define GTEST_HAS_EXCEPTIONS 1
|
# define GTEST_HAS_EXCEPTIONS 1
|
||||||
#elif defined(__SUNPRO_CC)
|
# elif defined(__SUNPRO_CC)
|
||||||
// Sun Pro CC supports exceptions. However, there is no compile-time way of
|
// Sun Pro CC supports exceptions. However, there is no compile-time way of
|
||||||
// detecting whether they are enabled or not. Therefore, we assume that
|
// detecting whether they are enabled or not. Therefore, we assume that
|
||||||
// they are enabled unless the user tells us otherwise.
|
// they are enabled unless the user tells us otherwise.
|
||||||
#define GTEST_HAS_EXCEPTIONS 1
|
# define GTEST_HAS_EXCEPTIONS 1
|
||||||
#elif defined(__IBMCPP__) && __EXCEPTIONS
|
# elif defined(__IBMCPP__) && __EXCEPTIONS
|
||||||
// xlC defines __EXCEPTIONS to 1 iff exceptions are enabled.
|
// xlC defines __EXCEPTIONS to 1 iff exceptions are enabled.
|
||||||
#define GTEST_HAS_EXCEPTIONS 1
|
# define GTEST_HAS_EXCEPTIONS 1
|
||||||
#else
|
# else
|
||||||
// For other compilers, we assume exceptions are disabled to be
|
// For other compilers, we assume exceptions are disabled to be
|
||||||
// conservative.
|
// conservative.
|
||||||
#define GTEST_HAS_EXCEPTIONS 0
|
# define GTEST_HAS_EXCEPTIONS 0
|
||||||
#endif // defined(_MSC_VER) || defined(__BORLANDC__)
|
# endif // defined(_MSC_VER) || defined(__BORLANDC__)
|
||||||
#endif // GTEST_HAS_EXCEPTIONS
|
#endif // GTEST_HAS_EXCEPTIONS
|
||||||
|
|
||||||
#if !defined(GTEST_HAS_STD_STRING)
|
#if !defined(GTEST_HAS_STD_STRING)
|
||||||
// Even though we don't use this macro any longer, we keep it in case
|
// Even though we don't use this macro any longer, we keep it in case
|
||||||
// some clients still depend on it.
|
// some clients still depend on it.
|
||||||
#define GTEST_HAS_STD_STRING 1
|
# define GTEST_HAS_STD_STRING 1
|
||||||
#elif !GTEST_HAS_STD_STRING
|
#elif !GTEST_HAS_STD_STRING
|
||||||
// The user told us that ::std::string isn't available.
|
// The user told us that ::std::string isn't available.
|
||||||
#error "Google Test cannot be used where ::std::string isn't available."
|
# error "Google Test cannot be used where ::std::string isn't available."
|
||||||
#endif // !defined(GTEST_HAS_STD_STRING)
|
#endif // !defined(GTEST_HAS_STD_STRING)
|
||||||
|
|
||||||
#ifndef GTEST_HAS_GLOBAL_STRING
|
#ifndef GTEST_HAS_GLOBAL_STRING
|
||||||
// The user didn't tell us whether ::string is available, so we need
|
// The user didn't tell us whether ::string is available, so we need
|
||||||
// to figure it out.
|
// to figure it out.
|
||||||
|
|
||||||
#define GTEST_HAS_GLOBAL_STRING 0
|
# define GTEST_HAS_GLOBAL_STRING 0
|
||||||
|
|
||||||
#endif // GTEST_HAS_GLOBAL_STRING
|
#endif // GTEST_HAS_GLOBAL_STRING
|
||||||
|
|
||||||
@ -337,14 +337,14 @@
|
|||||||
|
|
||||||
// Cygwin 1.7 and below doesn't support ::std::wstring.
|
// Cygwin 1.7 and below doesn't support ::std::wstring.
|
||||||
// Solaris' libc++ doesn't support it either.
|
// Solaris' libc++ doesn't support it either.
|
||||||
#define GTEST_HAS_STD_WSTRING (!(GTEST_OS_CYGWIN || GTEST_OS_SOLARIS))
|
# define GTEST_HAS_STD_WSTRING (!(GTEST_OS_CYGWIN || GTEST_OS_SOLARIS))
|
||||||
|
|
||||||
#endif // GTEST_HAS_STD_WSTRING
|
#endif // GTEST_HAS_STD_WSTRING
|
||||||
|
|
||||||
#ifndef GTEST_HAS_GLOBAL_WSTRING
|
#ifndef GTEST_HAS_GLOBAL_WSTRING
|
||||||
// The user didn't tell us whether ::wstring is available, so we need
|
// The user didn't tell us whether ::wstring is available, so we need
|
||||||
// to figure it out.
|
// to figure it out.
|
||||||
#define GTEST_HAS_GLOBAL_WSTRING \
|
# define GTEST_HAS_GLOBAL_WSTRING \
|
||||||
(GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING)
|
(GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING)
|
||||||
#endif // GTEST_HAS_GLOBAL_WSTRING
|
#endif // GTEST_HAS_GLOBAL_WSTRING
|
||||||
|
|
||||||
@ -353,46 +353,46 @@
|
|||||||
// The user didn't tell us whether RTTI is enabled, so we need to
|
// The user didn't tell us whether RTTI is enabled, so we need to
|
||||||
// figure it out.
|
// figure it out.
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
|
|
||||||
#ifdef _CPPRTTI // MSVC defines this macro iff RTTI is enabled.
|
# ifdef _CPPRTTI // MSVC defines this macro iff RTTI is enabled.
|
||||||
#define GTEST_HAS_RTTI 1
|
# define GTEST_HAS_RTTI 1
|
||||||
#else
|
# else
|
||||||
#define GTEST_HAS_RTTI 0
|
# define GTEST_HAS_RTTI 0
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
// Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled.
|
// Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled.
|
||||||
#elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302)
|
# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302)
|
||||||
|
|
||||||
#ifdef __GXX_RTTI
|
# ifdef __GXX_RTTI
|
||||||
#define GTEST_HAS_RTTI 1
|
# define GTEST_HAS_RTTI 1
|
||||||
#else
|
# else
|
||||||
#define GTEST_HAS_RTTI 0
|
# define GTEST_HAS_RTTI 0
|
||||||
#endif // __GXX_RTTI
|
# endif // __GXX_RTTI
|
||||||
|
|
||||||
// Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if
|
// Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if
|
||||||
// both the typeid and dynamic_cast features are present.
|
// both the typeid and dynamic_cast features are present.
|
||||||
#elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)
|
# elif defined(__IBMCPP__) && (__IBMCPP__ >= 900)
|
||||||
|
|
||||||
#ifdef __RTTI_ALL__
|
# ifdef __RTTI_ALL__
|
||||||
#define GTEST_HAS_RTTI 1
|
# define GTEST_HAS_RTTI 1
|
||||||
#else
|
# else
|
||||||
#define GTEST_HAS_RTTI 0
|
# define GTEST_HAS_RTTI 0
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#else
|
# else
|
||||||
|
|
||||||
// For all other compilers, we assume RTTI is enabled.
|
// For all other compilers, we assume RTTI is enabled.
|
||||||
#define GTEST_HAS_RTTI 1
|
# define GTEST_HAS_RTTI 1
|
||||||
|
|
||||||
#endif // _MSC_VER
|
# endif // _MSC_VER
|
||||||
|
|
||||||
#endif // GTEST_HAS_RTTI
|
#endif // GTEST_HAS_RTTI
|
||||||
|
|
||||||
// It's this header's responsibility to #include <typeinfo> when RTTI
|
// It's this header's responsibility to #include <typeinfo> when RTTI
|
||||||
// is enabled.
|
// is enabled.
|
||||||
#if GTEST_HAS_RTTI
|
#if GTEST_HAS_RTTI
|
||||||
#include <typeinfo>
|
# include <typeinfo>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Determines whether Google Test can use the pthreads library.
|
// Determines whether Google Test can use the pthreads library.
|
||||||
@ -402,16 +402,16 @@
|
|||||||
//
|
//
|
||||||
// To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
|
// To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
|
||||||
// to your compiler flags.
|
// to your compiler flags.
|
||||||
#define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC)
|
# define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC)
|
||||||
#endif // GTEST_HAS_PTHREAD
|
#endif // GTEST_HAS_PTHREAD
|
||||||
|
|
||||||
#if GTEST_HAS_PTHREAD
|
#if GTEST_HAS_PTHREAD
|
||||||
// gtest-port.h guarantees to #include <pthread.h> when GTEST_HAS_PTHREAD is
|
// gtest-port.h guarantees to #include <pthread.h> when GTEST_HAS_PTHREAD is
|
||||||
// true.
|
// true.
|
||||||
#include <pthread.h> // NOLINT
|
# include <pthread.h> // NOLINT
|
||||||
|
|
||||||
// For timespec and nanosleep, used below.
|
// For timespec and nanosleep, used below.
|
||||||
#include <time.h> // NOLINT
|
# include <time.h> // NOLINT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Determines whether Google Test can use tr1/tuple. You can define
|
// Determines whether Google Test can use tr1/tuple. You can define
|
||||||
@ -419,7 +419,7 @@
|
|||||||
// feature depending on tuple with be disabled in this mode).
|
// feature depending on tuple with be disabled in this mode).
|
||||||
#ifndef GTEST_HAS_TR1_TUPLE
|
#ifndef GTEST_HAS_TR1_TUPLE
|
||||||
// The user didn't tell us not to do it, so we assume it's OK.
|
// The user didn't tell us not to do it, so we assume it's OK.
|
||||||
#define GTEST_HAS_TR1_TUPLE 1
|
# define GTEST_HAS_TR1_TUPLE 1
|
||||||
#endif // GTEST_HAS_TR1_TUPLE
|
#endif // GTEST_HAS_TR1_TUPLE
|
||||||
|
|
||||||
// Determines whether Google Test's own tr1 tuple implementation
|
// Determines whether Google Test's own tr1 tuple implementation
|
||||||
@ -434,12 +434,12 @@
|
|||||||
// defining __GNUC__ and friends, but cannot compile GCC's tuple
|
// defining __GNUC__ and friends, but cannot compile GCC's tuple
|
||||||
// implementation. MSVC 2008 (9.0) provides TR1 tuple in a 323 MB
|
// implementation. MSVC 2008 (9.0) provides TR1 tuple in a 323 MB
|
||||||
// Feature Pack download, which we cannot assume the user has.
|
// Feature Pack download, which we cannot assume the user has.
|
||||||
#if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000)) \
|
# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000)) \
|
||||||
|| _MSC_VER >= 1600
|
|| _MSC_VER >= 1600
|
||||||
#define GTEST_USE_OWN_TR1_TUPLE 0
|
# define GTEST_USE_OWN_TR1_TUPLE 0
|
||||||
#else
|
# else
|
||||||
#define GTEST_USE_OWN_TR1_TUPLE 1
|
# define GTEST_USE_OWN_TR1_TUPLE 1
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#endif // GTEST_USE_OWN_TR1_TUPLE
|
#endif // GTEST_USE_OWN_TR1_TUPLE
|
||||||
|
|
||||||
@ -448,47 +448,47 @@
|
|||||||
// tr1/tuple.
|
// tr1/tuple.
|
||||||
#if GTEST_HAS_TR1_TUPLE
|
#if GTEST_HAS_TR1_TUPLE
|
||||||
|
|
||||||
#if GTEST_USE_OWN_TR1_TUPLE
|
# if GTEST_USE_OWN_TR1_TUPLE
|
||||||
#include "gtest/internal/gtest-tuple.h"
|
# include "gtest/internal/gtest-tuple.h"
|
||||||
#elif GTEST_OS_SYMBIAN
|
# elif GTEST_OS_SYMBIAN
|
||||||
|
|
||||||
// On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to
|
// On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to
|
||||||
// use STLport's tuple implementation, which unfortunately doesn't
|
// use STLport's tuple implementation, which unfortunately doesn't
|
||||||
// work as the copy of STLport distributed with Symbian is incomplete.
|
// work as the copy of STLport distributed with Symbian is incomplete.
|
||||||
// By making sure BOOST_HAS_TR1_TUPLE is undefined, we force Boost to
|
// By making sure BOOST_HAS_TR1_TUPLE is undefined, we force Boost to
|
||||||
// use its own tuple implementation.
|
// use its own tuple implementation.
|
||||||
#ifdef BOOST_HAS_TR1_TUPLE
|
# ifdef BOOST_HAS_TR1_TUPLE
|
||||||
#undef BOOST_HAS_TR1_TUPLE
|
# undef BOOST_HAS_TR1_TUPLE
|
||||||
#endif // BOOST_HAS_TR1_TUPLE
|
# endif // BOOST_HAS_TR1_TUPLE
|
||||||
|
|
||||||
// This prevents <boost/tr1/detail/config.hpp>, which defines
|
// This prevents <boost/tr1/detail/config.hpp>, which defines
|
||||||
// BOOST_HAS_TR1_TUPLE, from being #included by Boost's <tuple>.
|
// BOOST_HAS_TR1_TUPLE, from being #included by Boost's <tuple>.
|
||||||
#define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED
|
# define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED
|
||||||
#include <tuple>
|
# include <tuple>
|
||||||
|
|
||||||
#elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
|
# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
|
||||||
// GCC 4.0+ implements tr1/tuple in the <tr1/tuple> header. This does
|
// GCC 4.0+ implements tr1/tuple in the <tr1/tuple> header. This does
|
||||||
// not conform to the TR1 spec, which requires the header to be <tuple>.
|
// not conform to the TR1 spec, which requires the header to be <tuple>.
|
||||||
|
|
||||||
#if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
|
# if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
|
||||||
// Until version 4.3.2, gcc has a bug that causes <tr1/functional>,
|
// Until version 4.3.2, gcc has a bug that causes <tr1/functional>,
|
||||||
// which is #included by <tr1/tuple>, to not compile when RTTI is
|
// which is #included by <tr1/tuple>, to not compile when RTTI is
|
||||||
// disabled. _TR1_FUNCTIONAL is the header guard for
|
// disabled. _TR1_FUNCTIONAL is the header guard for
|
||||||
// <tr1/functional>. Hence the following #define is a hack to prevent
|
// <tr1/functional>. Hence the following #define is a hack to prevent
|
||||||
// <tr1/functional> from being included.
|
// <tr1/functional> from being included.
|
||||||
#define _TR1_FUNCTIONAL 1
|
# define _TR1_FUNCTIONAL 1
|
||||||
#include <tr1/tuple>
|
# include <tr1/tuple>
|
||||||
#undef _TR1_FUNCTIONAL // Allows the user to #include
|
# undef _TR1_FUNCTIONAL // Allows the user to #include
|
||||||
// <tr1/functional> if he chooses to.
|
// <tr1/functional> if he chooses to.
|
||||||
#else
|
# else
|
||||||
#include <tr1/tuple> // NOLINT
|
# include <tr1/tuple> // NOLINT
|
||||||
#endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
|
# endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
|
||||||
|
|
||||||
#else
|
# else
|
||||||
// If the compiler is not GCC 4.0+, we assume the user is using a
|
// If the compiler is not GCC 4.0+, we assume the user is using a
|
||||||
// spec-conforming TR1 implementation.
|
// spec-conforming TR1 implementation.
|
||||||
#include <tuple> // NOLINT
|
# include <tuple> // NOLINT
|
||||||
#endif // GTEST_USE_OWN_TR1_TUPLE
|
# endif // GTEST_USE_OWN_TR1_TUPLE
|
||||||
|
|
||||||
#endif // GTEST_HAS_TR1_TUPLE
|
#endif // GTEST_HAS_TR1_TUPLE
|
||||||
|
|
||||||
@ -499,11 +499,11 @@
|
|||||||
#ifndef GTEST_HAS_CLONE
|
#ifndef GTEST_HAS_CLONE
|
||||||
// The user didn't tell us, so we need to figure it out.
|
// The user didn't tell us, so we need to figure it out.
|
||||||
|
|
||||||
#if GTEST_OS_LINUX && !defined(__ia64__)
|
# if GTEST_OS_LINUX && !defined(__ia64__)
|
||||||
#define GTEST_HAS_CLONE 1
|
# define GTEST_HAS_CLONE 1
|
||||||
#else
|
# else
|
||||||
#define GTEST_HAS_CLONE 0
|
# define GTEST_HAS_CLONE 0
|
||||||
#endif // GTEST_OS_LINUX && !defined(__ia64__)
|
# endif // GTEST_OS_LINUX && !defined(__ia64__)
|
||||||
|
|
||||||
#endif // GTEST_HAS_CLONE
|
#endif // GTEST_HAS_CLONE
|
||||||
|
|
||||||
@ -512,11 +512,11 @@
|
|||||||
#ifndef GTEST_HAS_STREAM_REDIRECTION
|
#ifndef GTEST_HAS_STREAM_REDIRECTION
|
||||||
// By default, we assume that stream redirection is supported on all
|
// By default, we assume that stream redirection is supported on all
|
||||||
// platforms except known mobile ones.
|
// platforms except known mobile ones.
|
||||||
#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN
|
# if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN
|
||||||
#define GTEST_HAS_STREAM_REDIRECTION 0
|
# define GTEST_HAS_STREAM_REDIRECTION 0
|
||||||
#else
|
# else
|
||||||
#define GTEST_HAS_STREAM_REDIRECTION 1
|
# define GTEST_HAS_STREAM_REDIRECTION 1
|
||||||
#endif // !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_SYMBIAN
|
# endif // !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_SYMBIAN
|
||||||
#endif // GTEST_HAS_STREAM_REDIRECTION
|
#endif // GTEST_HAS_STREAM_REDIRECTION
|
||||||
|
|
||||||
// Determines whether to support death tests.
|
// Determines whether to support death tests.
|
||||||
@ -526,8 +526,8 @@
|
|||||||
#if (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
|
#if (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
|
||||||
(GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \
|
(GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \
|
||||||
GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX)
|
GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX)
|
||||||
#define GTEST_HAS_DEATH_TEST 1
|
# define GTEST_HAS_DEATH_TEST 1
|
||||||
#include <vector> // NOLINT
|
# include <vector> // NOLINT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// We don't support MSVC 7.1 with exceptions disabled now. Therefore
|
// We don't support MSVC 7.1 with exceptions disabled now. Therefore
|
||||||
@ -541,8 +541,8 @@
|
|||||||
// Sun Pro CC, and IBM Visual Age support.
|
// Sun Pro CC, and IBM Visual Age support.
|
||||||
#if defined(__GNUC__) || (_MSC_VER >= 1400) || defined(__SUNPRO_CC) || \
|
#if defined(__GNUC__) || (_MSC_VER >= 1400) || defined(__SUNPRO_CC) || \
|
||||||
defined(__IBMCPP__)
|
defined(__IBMCPP__)
|
||||||
#define GTEST_HAS_TYPED_TEST 1
|
# define GTEST_HAS_TYPED_TEST 1
|
||||||
#define GTEST_HAS_TYPED_TEST_P 1
|
# define GTEST_HAS_TYPED_TEST_P 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Determines whether to support Combine(). This only makes sense when
|
// Determines whether to support Combine(). This only makes sense when
|
||||||
@ -550,7 +550,7 @@
|
|||||||
// work on Sun Studio since it doesn't understand templated conversion
|
// work on Sun Studio since it doesn't understand templated conversion
|
||||||
// operators.
|
// operators.
|
||||||
#if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC)
|
#if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC)
|
||||||
#define GTEST_HAS_COMBINE 1
|
# define GTEST_HAS_COMBINE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Determines whether the system compiler uses UTF-16 for encoding wide strings.
|
// Determines whether the system compiler uses UTF-16 for encoding wide strings.
|
||||||
@ -559,7 +559,7 @@
|
|||||||
|
|
||||||
// Determines whether test results can be streamed to a socket.
|
// Determines whether test results can be streamed to a socket.
|
||||||
#if GTEST_OS_LINUX
|
#if GTEST_OS_LINUX
|
||||||
#define GTEST_CAN_STREAM_RESULTS_ 1
|
# define GTEST_CAN_STREAM_RESULTS_ 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Defines some utility macros.
|
// Defines some utility macros.
|
||||||
@ -573,9 +573,9 @@
|
|||||||
//
|
//
|
||||||
// The "switch (0) case 0:" idiom is used to suppress this.
|
// The "switch (0) case 0:" idiom is used to suppress this.
|
||||||
#ifdef __INTEL_COMPILER
|
#ifdef __INTEL_COMPILER
|
||||||
#define GTEST_AMBIGUOUS_ELSE_BLOCKER_
|
# define GTEST_AMBIGUOUS_ELSE_BLOCKER_
|
||||||
#else
|
#else
|
||||||
#define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default: // NOLINT
|
# define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default: // NOLINT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Use this annotation at the end of a struct/class definition to
|
// Use this annotation at the end of a struct/class definition to
|
||||||
@ -590,9 +590,9 @@
|
|||||||
// Also use it after a variable or parameter declaration to tell the
|
// Also use it after a variable or parameter declaration to tell the
|
||||||
// compiler the variable/parameter does not have to be used.
|
// compiler the variable/parameter does not have to be used.
|
||||||
#if defined(__GNUC__) && !defined(COMPILER_ICC)
|
#if defined(__GNUC__) && !defined(COMPILER_ICC)
|
||||||
#define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
|
# define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))
|
||||||
#else
|
#else
|
||||||
#define GTEST_ATTRIBUTE_UNUSED_
|
# define GTEST_ATTRIBUTE_UNUSED_
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// A macro to disallow operator=
|
// A macro to disallow operator=
|
||||||
@ -612,9 +612,9 @@
|
|||||||
//
|
//
|
||||||
// Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_;
|
// Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_;
|
||||||
#if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC)
|
#if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC)
|
||||||
#define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result))
|
# define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result))
|
||||||
#else
|
#else
|
||||||
#define GTEST_MUST_USE_RESULT_
|
# define GTEST_MUST_USE_RESULT_
|
||||||
#endif // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC
|
#endif // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC
|
||||||
|
|
||||||
// Determine whether the compiler supports Microsoft's Structured Exception
|
// Determine whether the compiler supports Microsoft's Structured Exception
|
||||||
@ -623,28 +623,28 @@
|
|||||||
#ifndef GTEST_HAS_SEH
|
#ifndef GTEST_HAS_SEH
|
||||||
// The user didn't tell us, so we need to figure it out.
|
// The user didn't tell us, so we need to figure it out.
|
||||||
|
|
||||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
# if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||||
// These two compilers are known to support SEH.
|
// These two compilers are known to support SEH.
|
||||||
#define GTEST_HAS_SEH 1
|
# define GTEST_HAS_SEH 1
|
||||||
#else
|
# else
|
||||||
// Assume no SEH.
|
// Assume no SEH.
|
||||||
#define GTEST_HAS_SEH 0
|
# define GTEST_HAS_SEH 0
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#endif // GTEST_HAS_SEH
|
#endif // GTEST_HAS_SEH
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
|
|
||||||
#if GTEST_LINKED_AS_SHARED_LIBRARY
|
# if GTEST_LINKED_AS_SHARED_LIBRARY
|
||||||
#define GTEST_API_ __declspec(dllimport)
|
# define GTEST_API_ __declspec(dllimport)
|
||||||
#elif GTEST_CREATE_SHARED_LIBRARY
|
# elif GTEST_CREATE_SHARED_LIBRARY
|
||||||
#define GTEST_API_ __declspec(dllexport)
|
# define GTEST_API_ __declspec(dllexport)
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
|
||||||
#ifndef GTEST_API_
|
#ifndef GTEST_API_
|
||||||
#define GTEST_API_
|
# define GTEST_API_
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
@ -794,7 +794,9 @@ class GTEST_API_ RE {
|
|||||||
RE(const ::std::string& regex) { Init(regex.c_str()); } // NOLINT
|
RE(const ::std::string& regex) { Init(regex.c_str()); } // NOLINT
|
||||||
|
|
||||||
#if GTEST_HAS_GLOBAL_STRING
|
#if GTEST_HAS_GLOBAL_STRING
|
||||||
|
|
||||||
RE(const ::string& regex) { Init(regex.c_str()); } // NOLINT
|
RE(const ::string& regex) { Init(regex.c_str()); } // NOLINT
|
||||||
|
|
||||||
#endif // GTEST_HAS_GLOBAL_STRING
|
#endif // GTEST_HAS_GLOBAL_STRING
|
||||||
|
|
||||||
RE(const char* regex) { Init(regex); } // NOLINT
|
RE(const char* regex) { Init(regex); } // NOLINT
|
||||||
@ -818,12 +820,14 @@ class GTEST_API_ RE {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_HAS_GLOBAL_STRING
|
#if GTEST_HAS_GLOBAL_STRING
|
||||||
|
|
||||||
static bool FullMatch(const ::string& str, const RE& re) {
|
static bool FullMatch(const ::string& str, const RE& re) {
|
||||||
return FullMatch(str.c_str(), re);
|
return FullMatch(str.c_str(), re);
|
||||||
}
|
}
|
||||||
static bool PartialMatch(const ::string& str, const RE& re) {
|
static bool PartialMatch(const ::string& str, const RE& re) {
|
||||||
return PartialMatch(str.c_str(), re);
|
return PartialMatch(str.c_str(), re);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // GTEST_HAS_GLOBAL_STRING
|
#endif // GTEST_HAS_GLOBAL_STRING
|
||||||
|
|
||||||
static bool FullMatch(const char* str, const RE& re);
|
static bool FullMatch(const char* str, const RE& re);
|
||||||
@ -838,11 +842,16 @@ class GTEST_API_ RE {
|
|||||||
// files.
|
// files.
|
||||||
const char* pattern_;
|
const char* pattern_;
|
||||||
bool is_valid_;
|
bool is_valid_;
|
||||||
|
|
||||||
#if GTEST_USES_POSIX_RE
|
#if GTEST_USES_POSIX_RE
|
||||||
|
|
||||||
regex_t full_regex_; // For FullMatch().
|
regex_t full_regex_; // For FullMatch().
|
||||||
regex_t partial_regex_; // For PartialMatch().
|
regex_t partial_regex_; // For PartialMatch().
|
||||||
|
|
||||||
#else // GTEST_USES_SIMPLE_RE
|
#else // GTEST_USES_SIMPLE_RE
|
||||||
|
|
||||||
const char* full_pattern_; // For FullMatch();
|
const char* full_pattern_; // For FullMatch();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GTEST_DISALLOW_ASSIGN_(RE);
|
GTEST_DISALLOW_ASSIGN_(RE);
|
||||||
@ -1205,11 +1214,11 @@ class MutexBase {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Forward-declares a static mutex.
|
// Forward-declares a static mutex.
|
||||||
#define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
|
# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
|
||||||
extern ::testing::internal::MutexBase mutex
|
extern ::testing::internal::MutexBase mutex
|
||||||
|
|
||||||
// Defines and statically (i.e. at link time) initializes a static mutex.
|
// Defines and statically (i.e. at link time) initializes a static mutex.
|
||||||
#define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
|
# define GTEST_DEFINE_STATIC_MUTEX_(mutex) \
|
||||||
::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, 0 }
|
::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, 0 }
|
||||||
|
|
||||||
// The Mutex class can only be used for mutexes created at runtime. It
|
// The Mutex class can only be used for mutexes created at runtime. It
|
||||||
@ -1356,7 +1365,7 @@ class ThreadLocal {
|
|||||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal);
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GTEST_IS_THREADSAFE 1
|
# define GTEST_IS_THREADSAFE 1
|
||||||
|
|
||||||
#else // GTEST_HAS_PTHREAD
|
#else // GTEST_HAS_PTHREAD
|
||||||
|
|
||||||
@ -1371,10 +1380,10 @@ class Mutex {
|
|||||||
void AssertHeld() const {}
|
void AssertHeld() const {}
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
|
# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \
|
||||||
extern ::testing::internal::Mutex mutex
|
extern ::testing::internal::Mutex mutex
|
||||||
|
|
||||||
#define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex
|
# define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex
|
||||||
|
|
||||||
class GTestMutexLock {
|
class GTestMutexLock {
|
||||||
public:
|
public:
|
||||||
@ -1398,7 +1407,7 @@ class ThreadLocal {
|
|||||||
|
|
||||||
// The above synchronization primitives have dummy implementations.
|
// The above synchronization primitives have dummy implementations.
|
||||||
// Therefore Google Test is not thread-safe.
|
// Therefore Google Test is not thread-safe.
|
||||||
#define GTEST_IS_THREADSAFE 0
|
# define GTEST_IS_THREADSAFE 0
|
||||||
|
|
||||||
#endif // GTEST_HAS_PTHREAD
|
#endif // GTEST_HAS_PTHREAD
|
||||||
|
|
||||||
@ -1415,9 +1424,9 @@ GTEST_API_ size_t GetThreadCount();
|
|||||||
#if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC)
|
#if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC)
|
||||||
// We lose support for NULL detection where the compiler doesn't like
|
// We lose support for NULL detection where the compiler doesn't like
|
||||||
// passing non-POD classes through ellipsis (...).
|
// passing non-POD classes through ellipsis (...).
|
||||||
#define GTEST_ELLIPSIS_NEEDS_POD_ 1
|
# define GTEST_ELLIPSIS_NEEDS_POD_ 1
|
||||||
#else
|
#else
|
||||||
#define GTEST_CAN_COMPARE_NULL 1
|
# define GTEST_CAN_COMPARE_NULL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// The Nokia Symbian and IBM XL C/C++ compilers cannot decide between
|
// The Nokia Symbian and IBM XL C/C++ compilers cannot decide between
|
||||||
@ -1425,7 +1434,7 @@ GTEST_API_ size_t GetThreadCount();
|
|||||||
// _can_ decide between class template specializations for T and T*,
|
// _can_ decide between class template specializations for T and T*,
|
||||||
// so a tr1::type_traits-like is_pointer works.
|
// so a tr1::type_traits-like is_pointer works.
|
||||||
#if defined(__SYMBIAN32__) || defined(__IBMCPP__)
|
#if defined(__SYMBIAN32__) || defined(__IBMCPP__)
|
||||||
#define GTEST_NEEDS_IS_POINTER_ 1
|
# define GTEST_NEEDS_IS_POINTER_ 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <bool bool_value>
|
template <bool bool_value>
|
||||||
@ -1445,13 +1454,13 @@ template <typename T>
|
|||||||
struct is_pointer<T*> : public true_type {};
|
struct is_pointer<T*> : public true_type {};
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS
|
#if GTEST_OS_WINDOWS
|
||||||
#define GTEST_PATH_SEP_ "\\"
|
# define GTEST_PATH_SEP_ "\\"
|
||||||
#define GTEST_HAS_ALT_PATH_SEP_ 1
|
# define GTEST_HAS_ALT_PATH_SEP_ 1
|
||||||
// The biggest signed integer type the compiler supports.
|
// The biggest signed integer type the compiler supports.
|
||||||
typedef __int64 BiggestInt;
|
typedef __int64 BiggestInt;
|
||||||
#else
|
#else
|
||||||
#define GTEST_PATH_SEP_ "/"
|
# define GTEST_PATH_SEP_ "/"
|
||||||
#define GTEST_HAS_ALT_PATH_SEP_ 0
|
# define GTEST_HAS_ALT_PATH_SEP_ 0
|
||||||
typedef long long BiggestInt; // NOLINT
|
typedef long long BiggestInt; // NOLINT
|
||||||
#endif // GTEST_OS_WINDOWS
|
#endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
@ -1505,36 +1514,36 @@ namespace posix {
|
|||||||
|
|
||||||
typedef struct _stat StatStruct;
|
typedef struct _stat StatStruct;
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
# ifdef __BORLANDC__
|
||||||
inline int IsATTY(int fd) { return isatty(fd); }
|
inline int IsATTY(int fd) { return isatty(fd); }
|
||||||
inline int StrCaseCmp(const char* s1, const char* s2) {
|
inline int StrCaseCmp(const char* s1, const char* s2) {
|
||||||
return stricmp(s1, s2);
|
return stricmp(s1, s2);
|
||||||
}
|
}
|
||||||
inline char* StrDup(const char* src) { return strdup(src); }
|
inline char* StrDup(const char* src) { return strdup(src); }
|
||||||
#else // !__BORLANDC__
|
# else // !__BORLANDC__
|
||||||
#if GTEST_OS_WINDOWS_MOBILE
|
# if GTEST_OS_WINDOWS_MOBILE
|
||||||
inline int IsATTY(int /* fd */) { return 0; }
|
inline int IsATTY(int /* fd */) { return 0; }
|
||||||
#else
|
# else
|
||||||
inline int IsATTY(int fd) { return _isatty(fd); }
|
inline int IsATTY(int fd) { return _isatty(fd); }
|
||||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
# endif // GTEST_OS_WINDOWS_MOBILE
|
||||||
inline int StrCaseCmp(const char* s1, const char* s2) {
|
inline int StrCaseCmp(const char* s1, const char* s2) {
|
||||||
return _stricmp(s1, s2);
|
return _stricmp(s1, s2);
|
||||||
}
|
}
|
||||||
inline char* StrDup(const char* src) { return _strdup(src); }
|
inline char* StrDup(const char* src) { return _strdup(src); }
|
||||||
#endif // __BORLANDC__
|
# endif // __BORLANDC__
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS_MOBILE
|
# if GTEST_OS_WINDOWS_MOBILE
|
||||||
inline int FileNo(FILE* file) { return reinterpret_cast<int>(_fileno(file)); }
|
inline int FileNo(FILE* file) { return reinterpret_cast<int>(_fileno(file)); }
|
||||||
// Stat(), RmDir(), and IsDir() are not needed on Windows CE at this
|
// Stat(), RmDir(), and IsDir() are not needed on Windows CE at this
|
||||||
// time and thus not defined there.
|
// time and thus not defined there.
|
||||||
#else
|
# else
|
||||||
inline int FileNo(FILE* file) { return _fileno(file); }
|
inline int FileNo(FILE* file) { return _fileno(file); }
|
||||||
inline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); }
|
inline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); }
|
||||||
inline int RmDir(const char* dir) { return _rmdir(dir); }
|
inline int RmDir(const char* dir) { return _rmdir(dir); }
|
||||||
inline bool IsDir(const StatStruct& st) {
|
inline bool IsDir(const StatStruct& st) {
|
||||||
return (_S_IFDIR & st.st_mode) != 0;
|
return (_S_IFDIR & st.st_mode) != 0;
|
||||||
}
|
}
|
||||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
# endif // GTEST_OS_WINDOWS_MOBILE
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@ -1556,8 +1565,8 @@ inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
|
|||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
// Temporarily disable warning 4996 (deprecated function).
|
// Temporarily disable warning 4996 (deprecated function).
|
||||||
#pragma warning(push)
|
# pragma warning(push)
|
||||||
#pragma warning(disable:4996)
|
# pragma warning(disable:4996)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline const char* StrNCpy(char* dest, const char* src, size_t n) {
|
inline const char* StrNCpy(char* dest, const char* src, size_t n) {
|
||||||
@ -1606,7 +1615,7 @@ inline const char* GetEnv(const char* name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(pop) // Restores the warning state.
|
# pragma warning(pop) // Restores the warning state.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS_MOBILE
|
#if GTEST_OS_WINDOWS_MOBILE
|
||||||
@ -1672,6 +1681,7 @@ class TypeWithSize<4> {
|
|||||||
template <>
|
template <>
|
||||||
class TypeWithSize<8> {
|
class TypeWithSize<8> {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS
|
#if GTEST_OS_WINDOWS
|
||||||
typedef __int64 Int;
|
typedef __int64 Int;
|
||||||
typedef unsigned __int64 UInt;
|
typedef unsigned __int64 UInt;
|
||||||
|
@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
// string.h is not guaranteed to provide strcpy on C++ Builder.
|
// string.h is not guaranteed to provide strcpy on C++ Builder.
|
||||||
#include <mem.h>
|
# include <mem.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -44,9 +44,9 @@
|
|||||||
// private as public.
|
// private as public.
|
||||||
// Sun Studio versions < 12 also have the above bug.
|
// Sun Studio versions < 12 also have the above bug.
|
||||||
#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
|
#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
|
||||||
#define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
|
# define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
|
||||||
#else
|
#else
|
||||||
#define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
|
# define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
|
||||||
template <GTEST_10_TYPENAMES_(U)> friend class tuple; \
|
template <GTEST_10_TYPENAMES_(U)> friend class tuple; \
|
||||||
private:
|
private:
|
||||||
#endif
|
#endif
|
||||||
|
@ -45,9 +45,9 @@ $$ This meta comment fixes auto-indentation in Emacs. }}
|
|||||||
// private as public.
|
// private as public.
|
||||||
// Sun Studio versions < 12 also have the above bug.
|
// Sun Studio versions < 12 also have the above bug.
|
||||||
#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
|
#if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590)
|
||||||
#define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
|
# define GTEST_DECLARE_TUPLE_AS_FRIEND_ public:
|
||||||
#else
|
#else
|
||||||
#define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
|
# define GTEST_DECLARE_TUPLE_AS_FRIEND_ \
|
||||||
template <GTEST_$(n)_TYPENAMES_(U)> friend class tuple; \
|
template <GTEST_$(n)_TYPENAMES_(U)> friend class tuple; \
|
||||||
private:
|
private:
|
||||||
#endif
|
#endif
|
||||||
|
@ -51,9 +51,9 @@
|
|||||||
|
|
||||||
// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
|
// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
|
||||||
// libstdc++ (which is where cxxabi.h comes from).
|
// libstdc++ (which is where cxxabi.h comes from).
|
||||||
#ifdef __GLIBCXX__
|
# ifdef __GLIBCXX__
|
||||||
#include <cxxabi.h>
|
# include <cxxabi.h>
|
||||||
#endif // __GLIBCXX__
|
# endif // __GLIBCXX__
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
@ -73,10 +73,10 @@ struct AssertTypeEq<T, T> {
|
|||||||
// GetTypeName<T>() returns a human-readable name of type T.
|
// GetTypeName<T>() returns a human-readable name of type T.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
String GetTypeName() {
|
String GetTypeName() {
|
||||||
#if GTEST_HAS_RTTI
|
# if GTEST_HAS_RTTI
|
||||||
|
|
||||||
const char* const name = typeid(T).name();
|
const char* const name = typeid(T).name();
|
||||||
#ifdef __GLIBCXX__
|
# ifdef __GLIBCXX__
|
||||||
int status = 0;
|
int status = 0;
|
||||||
// gcc's implementation of typeid(T).name() mangles the type name,
|
// gcc's implementation of typeid(T).name() mangles the type name,
|
||||||
// so we have to demangle it.
|
// so we have to demangle it.
|
||||||
@ -84,13 +84,15 @@ String GetTypeName() {
|
|||||||
const String name_str(status == 0 ? readable_name : name);
|
const String name_str(status == 0 ? readable_name : name);
|
||||||
free(readable_name);
|
free(readable_name);
|
||||||
return name_str;
|
return name_str;
|
||||||
#else
|
# else
|
||||||
return name;
|
return name;
|
||||||
#endif // __GLIBCXX__
|
# endif // __GLIBCXX__
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
#else
|
|
||||||
return "<type>";
|
return "<type>";
|
||||||
#endif // GTEST_HAS_RTTI
|
|
||||||
|
# endif // GTEST_HAS_RTTI
|
||||||
}
|
}
|
||||||
|
|
||||||
// A unique type used as the default value for the arguments of class
|
// A unique type used as the default value for the arguments of class
|
||||||
@ -1611,7 +1613,7 @@ struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15,
|
|||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
#define GTEST_TEMPLATE_ template <typename T> class
|
# define GTEST_TEMPLATE_ template <typename T> class
|
||||||
|
|
||||||
// The template "selector" struct TemplateSel<Tmpl> is used to
|
// The template "selector" struct TemplateSel<Tmpl> is used to
|
||||||
// represent Tmpl, which must be a class template with one type
|
// represent Tmpl, which must be a class template with one type
|
||||||
@ -1629,7 +1631,7 @@ struct TemplateSel {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GTEST_BIND_(TmplSel, T) \
|
# define GTEST_BIND_(TmplSel, T) \
|
||||||
TmplSel::template Bind<T>::type
|
TmplSel::template Bind<T>::type
|
||||||
|
|
||||||
// A unique struct template used as the default value for the
|
// A unique struct template used as the default value for the
|
||||||
|
@ -49,9 +49,9 @@ $var n = 50 $$ Maximum length of type lists we want to support.
|
|||||||
|
|
||||||
// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
|
// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
|
||||||
// libstdc++ (which is where cxxabi.h comes from).
|
// libstdc++ (which is where cxxabi.h comes from).
|
||||||
#ifdef __GLIBCXX__
|
# ifdef __GLIBCXX__
|
||||||
#include <cxxabi.h>
|
# include <cxxabi.h>
|
||||||
#endif // __GLIBCXX__
|
# endif // __GLIBCXX__
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
@ -71,10 +71,10 @@ struct AssertTypeEq<T, T> {
|
|||||||
// GetTypeName<T>() returns a human-readable name of type T.
|
// GetTypeName<T>() returns a human-readable name of type T.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
String GetTypeName() {
|
String GetTypeName() {
|
||||||
#if GTEST_HAS_RTTI
|
# if GTEST_HAS_RTTI
|
||||||
|
|
||||||
const char* const name = typeid(T).name();
|
const char* const name = typeid(T).name();
|
||||||
#ifdef __GLIBCXX__
|
# ifdef __GLIBCXX__
|
||||||
int status = 0;
|
int status = 0;
|
||||||
// gcc's implementation of typeid(T).name() mangles the type name,
|
// gcc's implementation of typeid(T).name() mangles the type name,
|
||||||
// so we have to demangle it.
|
// so we have to demangle it.
|
||||||
@ -82,13 +82,15 @@ String GetTypeName() {
|
|||||||
const String name_str(status == 0 ? readable_name : name);
|
const String name_str(status == 0 ? readable_name : name);
|
||||||
free(readable_name);
|
free(readable_name);
|
||||||
return name_str;
|
return name_str;
|
||||||
#else
|
# else
|
||||||
return name;
|
return name;
|
||||||
#endif // __GLIBCXX__
|
# endif // __GLIBCXX__
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
#else
|
|
||||||
return "<type>";
|
return "<type>";
|
||||||
#endif // GTEST_HAS_RTTI
|
|
||||||
|
# endif // GTEST_HAS_RTTI
|
||||||
}
|
}
|
||||||
|
|
||||||
// A unique type used as the default value for the arguments of class
|
// A unique type used as the default value for the arguments of class
|
||||||
@ -169,7 +171,7 @@ struct Types<$for j, [[T$j]]$for k[[, internal::None]]> {
|
|||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
#define GTEST_TEMPLATE_ template <typename T> class
|
# define GTEST_TEMPLATE_ template <typename T> class
|
||||||
|
|
||||||
// The template "selector" struct TemplateSel<Tmpl> is used to
|
// The template "selector" struct TemplateSel<Tmpl> is used to
|
||||||
// represent Tmpl, which must be a class template with one type
|
// represent Tmpl, which must be a class template with one type
|
||||||
@ -187,7 +189,7 @@ struct TemplateSel {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GTEST_BIND_(TmplSel, T) \
|
# define GTEST_BIND_(TmplSel, T) \
|
||||||
TmplSel::template Bind<T>::type
|
TmplSel::template Bind<T>::type
|
||||||
|
|
||||||
// A unique struct template used as the default value for the
|
// A unique struct template used as the default value for the
|
||||||
|
@ -36,21 +36,21 @@
|
|||||||
|
|
||||||
#if GTEST_HAS_DEATH_TEST
|
#if GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
#if GTEST_OS_MAC
|
# if GTEST_OS_MAC
|
||||||
#include <crt_externs.h>
|
# include <crt_externs.h>
|
||||||
#endif // GTEST_OS_MAC
|
# endif // GTEST_OS_MAC
|
||||||
|
|
||||||
#include <errno.h>
|
# include <errno.h>
|
||||||
#include <fcntl.h>
|
# include <fcntl.h>
|
||||||
#include <limits.h>
|
# include <limits.h>
|
||||||
#include <stdarg.h>
|
# include <stdarg.h>
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS
|
# if GTEST_OS_WINDOWS
|
||||||
#include <windows.h>
|
# include <windows.h>
|
||||||
#else
|
# else
|
||||||
#include <sys/mman.h>
|
# include <sys/mman.h>
|
||||||
#include <sys/wait.h>
|
# include <sys/wait.h>
|
||||||
#endif // GTEST_OS_WINDOWS
|
# endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
#endif // GTEST_HAS_DEATH_TEST
|
#endif // GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
@ -113,14 +113,18 @@ ExitedWithCode::ExitedWithCode(int exit_code) : exit_code_(exit_code) {
|
|||||||
|
|
||||||
// ExitedWithCode function-call operator.
|
// ExitedWithCode function-call operator.
|
||||||
bool ExitedWithCode::operator()(int exit_status) const {
|
bool ExitedWithCode::operator()(int exit_status) const {
|
||||||
#if GTEST_OS_WINDOWS
|
# if GTEST_OS_WINDOWS
|
||||||
|
|
||||||
return exit_status == exit_code_;
|
return exit_status == exit_code_;
|
||||||
#else
|
|
||||||
|
# else
|
||||||
|
|
||||||
return WIFEXITED(exit_status) && WEXITSTATUS(exit_status) == exit_code_;
|
return WIFEXITED(exit_status) && WEXITSTATUS(exit_status) == exit_code_;
|
||||||
#endif // GTEST_OS_WINDOWS
|
|
||||||
|
# endif // GTEST_OS_WINDOWS
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !GTEST_OS_WINDOWS
|
# if !GTEST_OS_WINDOWS
|
||||||
// KilledBySignal constructor.
|
// KilledBySignal constructor.
|
||||||
KilledBySignal::KilledBySignal(int signum) : signum_(signum) {
|
KilledBySignal::KilledBySignal(int signum) : signum_(signum) {
|
||||||
}
|
}
|
||||||
@ -129,7 +133,7 @@ KilledBySignal::KilledBySignal(int signum) : signum_(signum) {
|
|||||||
bool KilledBySignal::operator()(int exit_status) const {
|
bool KilledBySignal::operator()(int exit_status) const {
|
||||||
return WIFSIGNALED(exit_status) && WTERMSIG(exit_status) == signum_;
|
return WIFSIGNALED(exit_status) && WTERMSIG(exit_status) == signum_;
|
||||||
}
|
}
|
||||||
#endif // !GTEST_OS_WINDOWS
|
# endif // !GTEST_OS_WINDOWS
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
@ -139,20 +143,25 @@ namespace internal {
|
|||||||
// specified by wait(2).
|
// specified by wait(2).
|
||||||
static String ExitSummary(int exit_code) {
|
static String ExitSummary(int exit_code) {
|
||||||
Message m;
|
Message m;
|
||||||
#if GTEST_OS_WINDOWS
|
|
||||||
|
# if GTEST_OS_WINDOWS
|
||||||
|
|
||||||
m << "Exited with exit status " << exit_code;
|
m << "Exited with exit status " << exit_code;
|
||||||
#else
|
|
||||||
|
# else
|
||||||
|
|
||||||
if (WIFEXITED(exit_code)) {
|
if (WIFEXITED(exit_code)) {
|
||||||
m << "Exited with exit status " << WEXITSTATUS(exit_code);
|
m << "Exited with exit status " << WEXITSTATUS(exit_code);
|
||||||
} else if (WIFSIGNALED(exit_code)) {
|
} else if (WIFSIGNALED(exit_code)) {
|
||||||
m << "Terminated by signal " << WTERMSIG(exit_code);
|
m << "Terminated by signal " << WTERMSIG(exit_code);
|
||||||
}
|
}
|
||||||
#ifdef WCOREDUMP
|
# ifdef WCOREDUMP
|
||||||
if (WCOREDUMP(exit_code)) {
|
if (WCOREDUMP(exit_code)) {
|
||||||
m << " (core dumped)";
|
m << " (core dumped)";
|
||||||
}
|
}
|
||||||
#endif
|
# endif
|
||||||
#endif // GTEST_OS_WINDOWS
|
# endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
return m.GetString();
|
return m.GetString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +171,7 @@ bool ExitedUnsuccessfully(int exit_status) {
|
|||||||
return !ExitedWithCode(0)(exit_status);
|
return !ExitedWithCode(0)(exit_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !GTEST_OS_WINDOWS
|
# if !GTEST_OS_WINDOWS
|
||||||
// Generates a textual failure message when a death test finds more than
|
// Generates a textual failure message when a death test finds more than
|
||||||
// one thread running, or cannot determine the number of threads, prior
|
// one thread running, or cannot determine the number of threads, prior
|
||||||
// to executing the given statement. It is the responsibility of the
|
// to executing the given statement. It is the responsibility of the
|
||||||
@ -177,7 +186,7 @@ static String DeathTestThreadWarning(size_t thread_count) {
|
|||||||
msg << "detected " << thread_count << " threads.";
|
msg << "detected " << thread_count << " threads.";
|
||||||
return msg.GetString();
|
return msg.GetString();
|
||||||
}
|
}
|
||||||
#endif // !GTEST_OS_WINDOWS
|
# endif // !GTEST_OS_WINDOWS
|
||||||
|
|
||||||
// Flag characters for reporting a death test that did not die.
|
// Flag characters for reporting a death test that did not die.
|
||||||
static const char kDeathTestLived = 'L';
|
static const char kDeathTestLived = 'L';
|
||||||
@ -222,7 +231,7 @@ void DeathTestAbort(const String& message) {
|
|||||||
|
|
||||||
// A replacement for CHECK that calls DeathTestAbort if the assertion
|
// A replacement for CHECK that calls DeathTestAbort if the assertion
|
||||||
// fails.
|
// fails.
|
||||||
#define GTEST_DEATH_TEST_CHECK_(expression) \
|
# define GTEST_DEATH_TEST_CHECK_(expression) \
|
||||||
do { \
|
do { \
|
||||||
if (!::testing::internal::IsTrue(expression)) { \
|
if (!::testing::internal::IsTrue(expression)) { \
|
||||||
DeathTestAbort(::testing::internal::String::Format( \
|
DeathTestAbort(::testing::internal::String::Format( \
|
||||||
@ -238,7 +247,7 @@ void DeathTestAbort(const String& message) {
|
|||||||
// evaluates the expression as long as it evaluates to -1 and sets
|
// evaluates the expression as long as it evaluates to -1 and sets
|
||||||
// errno to EINTR. If the expression evaluates to -1 but errno is
|
// errno to EINTR. If the expression evaluates to -1 but errno is
|
||||||
// something other than EINTR, DeathTestAbort is called.
|
// something other than EINTR, DeathTestAbort is called.
|
||||||
#define GTEST_DEATH_TEST_CHECK_SYSCALL_(expression) \
|
# define GTEST_DEATH_TEST_CHECK_SYSCALL_(expression) \
|
||||||
do { \
|
do { \
|
||||||
int gtest_retval; \
|
int gtest_retval; \
|
||||||
do { \
|
do { \
|
||||||
@ -527,7 +536,7 @@ bool DeathTestImpl::Passed(bool status_ok) {
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS
|
# if GTEST_OS_WINDOWS
|
||||||
// WindowsDeathTest implements death tests on Windows. Due to the
|
// WindowsDeathTest implements death tests on Windows. Due to the
|
||||||
// specifics of starting new processes on Windows, death tests there are
|
// specifics of starting new processes on Windows, death tests there are
|
||||||
// always threadsafe, and Google Test considers the
|
// always threadsafe, and Google Test considers the
|
||||||
@ -723,7 +732,7 @@ DeathTest::TestRole WindowsDeathTest::AssumeRole() {
|
|||||||
set_spawned(true);
|
set_spawned(true);
|
||||||
return OVERSEE_TEST;
|
return OVERSEE_TEST;
|
||||||
}
|
}
|
||||||
#else // We are not on Windows.
|
# else // We are not on Windows.
|
||||||
|
|
||||||
// ForkingDeathTest provides implementations for most of the abstract
|
// ForkingDeathTest provides implementations for most of the abstract
|
||||||
// methods of the DeathTest interface. Only the AssumeRole method is
|
// methods of the DeathTest interface. Only the AssumeRole method is
|
||||||
@ -871,19 +880,19 @@ struct ExecDeathTestArgs {
|
|||||||
int close_fd; // File descriptor to close; the read end of a pipe
|
int close_fd; // File descriptor to close; the read end of a pipe
|
||||||
};
|
};
|
||||||
|
|
||||||
#if GTEST_OS_MAC
|
# if GTEST_OS_MAC
|
||||||
inline char** GetEnviron() {
|
inline char** GetEnviron() {
|
||||||
// When Google Test is built as a framework on MacOS X, the environ variable
|
// When Google Test is built as a framework on MacOS X, the environ variable
|
||||||
// is unavailable. Apple's documentation (man environ) recommends using
|
// is unavailable. Apple's documentation (man environ) recommends using
|
||||||
// _NSGetEnviron() instead.
|
// _NSGetEnviron() instead.
|
||||||
return *_NSGetEnviron();
|
return *_NSGetEnviron();
|
||||||
}
|
}
|
||||||
#else
|
# else
|
||||||
// Some POSIX platforms expect you to declare environ. extern "C" makes
|
// Some POSIX platforms expect you to declare environ. extern "C" makes
|
||||||
// it reside in the global namespace.
|
// it reside in the global namespace.
|
||||||
extern "C" char** environ;
|
extern "C" char** environ;
|
||||||
inline char** GetEnviron() { return environ; }
|
inline char** GetEnviron() { return environ; }
|
||||||
#endif // GTEST_OS_MAC
|
# endif // GTEST_OS_MAC
|
||||||
|
|
||||||
// The main function for a threadsafe-style death test child process.
|
// The main function for a threadsafe-style death test child process.
|
||||||
// This function is called in a clone()-ed process and thus must avoid
|
// This function is called in a clone()-ed process and thus must avoid
|
||||||
@ -940,7 +949,7 @@ static pid_t ExecDeathTestFork(char* const* argv, int close_fd) {
|
|||||||
ExecDeathTestArgs args = { argv, close_fd };
|
ExecDeathTestArgs args = { argv, close_fd };
|
||||||
pid_t child_pid = -1;
|
pid_t child_pid = -1;
|
||||||
|
|
||||||
#if GTEST_HAS_CLONE
|
# if GTEST_HAS_CLONE
|
||||||
const bool use_fork = GTEST_FLAG(death_test_use_fork);
|
const bool use_fork = GTEST_FLAG(death_test_use_fork);
|
||||||
|
|
||||||
if (!use_fork) {
|
if (!use_fork) {
|
||||||
@ -957,9 +966,9 @@ static pid_t ExecDeathTestFork(char* const* argv, int close_fd) {
|
|||||||
|
|
||||||
GTEST_DEATH_TEST_CHECK_(munmap(stack, stack_size) != -1);
|
GTEST_DEATH_TEST_CHECK_(munmap(stack, stack_size) != -1);
|
||||||
}
|
}
|
||||||
#else
|
# else
|
||||||
const bool use_fork = true;
|
const bool use_fork = true;
|
||||||
#endif // GTEST_HAS_CLONE
|
# endif // GTEST_HAS_CLONE
|
||||||
|
|
||||||
if (use_fork && (child_pid = fork()) == 0) {
|
if (use_fork && (child_pid = fork()) == 0) {
|
||||||
ExecDeathTestChildMain(&args);
|
ExecDeathTestChildMain(&args);
|
||||||
@ -1020,7 +1029,7 @@ DeathTest::TestRole ExecDeathTest::AssumeRole() {
|
|||||||
return OVERSEE_TEST;
|
return OVERSEE_TEST;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !GTEST_OS_WINDOWS
|
# endif // !GTEST_OS_WINDOWS
|
||||||
|
|
||||||
// Creates a concrete DeathTest-derived class that depends on the
|
// Creates a concrete DeathTest-derived class that depends on the
|
||||||
// --gtest_death_test_style flag, and sets the pointer pointed to
|
// --gtest_death_test_style flag, and sets the pointer pointed to
|
||||||
@ -1051,18 +1060,23 @@ bool DefaultDeathTestFactory::Create(const char* statement, const RE* regex,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS
|
# if GTEST_OS_WINDOWS
|
||||||
|
|
||||||
if (GTEST_FLAG(death_test_style) == "threadsafe" ||
|
if (GTEST_FLAG(death_test_style) == "threadsafe" ||
|
||||||
GTEST_FLAG(death_test_style) == "fast") {
|
GTEST_FLAG(death_test_style) == "fast") {
|
||||||
*test = new WindowsDeathTest(statement, regex, file, line);
|
*test = new WindowsDeathTest(statement, regex, file, line);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
|
# else
|
||||||
|
|
||||||
if (GTEST_FLAG(death_test_style) == "threadsafe") {
|
if (GTEST_FLAG(death_test_style) == "threadsafe") {
|
||||||
*test = new ExecDeathTest(statement, regex, file, line);
|
*test = new ExecDeathTest(statement, regex, file, line);
|
||||||
} else if (GTEST_FLAG(death_test_style) == "fast") {
|
} else if (GTEST_FLAG(death_test_style) == "fast") {
|
||||||
*test = new NoExecDeathTest(statement, regex);
|
*test = new NoExecDeathTest(statement, regex);
|
||||||
}
|
}
|
||||||
#endif // GTEST_OS_WINDOWS
|
|
||||||
|
# endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
else { // NOLINT - this is more readable than unbalanced brackets inside #if.
|
else { // NOLINT - this is more readable than unbalanced brackets inside #if.
|
||||||
DeathTest::set_last_death_test_message(String::Format(
|
DeathTest::set_last_death_test_message(String::Format(
|
||||||
"Unknown death test style \"%s\" encountered",
|
"Unknown death test style \"%s\" encountered",
|
||||||
@ -1093,7 +1107,7 @@ static void SplitString(const ::std::string& str, char delimiter,
|
|||||||
dest->swap(parsed);
|
dest->swap(parsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS
|
# if GTEST_OS_WINDOWS
|
||||||
// Recreates the pipe and event handles from the provided parameters,
|
// Recreates the pipe and event handles from the provided parameters,
|
||||||
// signals the event, and returns a file descriptor wrapped around the pipe
|
// signals the event, and returns a file descriptor wrapped around the pipe
|
||||||
// handle. This function is called in the child process only.
|
// handle. This function is called in the child process only.
|
||||||
@ -1157,7 +1171,7 @@ int GetStatusFileDescriptor(unsigned int parent_process_id,
|
|||||||
|
|
||||||
return write_fd;
|
return write_fd;
|
||||||
}
|
}
|
||||||
#endif // GTEST_OS_WINDOWS
|
# endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
// Returns a newly created InternalRunDeathTestFlag object with fields
|
// Returns a newly created InternalRunDeathTestFlag object with fields
|
||||||
// initialized from the GTEST_FLAG(internal_run_death_test) flag if
|
// initialized from the GTEST_FLAG(internal_run_death_test) flag if
|
||||||
@ -1173,7 +1187,8 @@ InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() {
|
|||||||
SplitString(GTEST_FLAG(internal_run_death_test).c_str(), '|', &fields);
|
SplitString(GTEST_FLAG(internal_run_death_test).c_str(), '|', &fields);
|
||||||
int write_fd = -1;
|
int write_fd = -1;
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS
|
# if GTEST_OS_WINDOWS
|
||||||
|
|
||||||
unsigned int parent_process_id = 0;
|
unsigned int parent_process_id = 0;
|
||||||
size_t write_handle_as_size_t = 0;
|
size_t write_handle_as_size_t = 0;
|
||||||
size_t event_handle_as_size_t = 0;
|
size_t event_handle_as_size_t = 0;
|
||||||
@ -1191,7 +1206,8 @@ InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() {
|
|||||||
write_fd = GetStatusFileDescriptor(parent_process_id,
|
write_fd = GetStatusFileDescriptor(parent_process_id,
|
||||||
write_handle_as_size_t,
|
write_handle_as_size_t,
|
||||||
event_handle_as_size_t);
|
event_handle_as_size_t);
|
||||||
#else
|
# else
|
||||||
|
|
||||||
if (fields.size() != 4
|
if (fields.size() != 4
|
||||||
|| !ParseNaturalNumber(fields[1], &line)
|
|| !ParseNaturalNumber(fields[1], &line)
|
||||||
|| !ParseNaturalNumber(fields[2], &index)
|
|| !ParseNaturalNumber(fields[2], &index)
|
||||||
@ -1200,7 +1216,9 @@ InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag() {
|
|||||||
"Bad --gtest_internal_run_death_test flag: %s",
|
"Bad --gtest_internal_run_death_test flag: %s",
|
||||||
GTEST_FLAG(internal_run_death_test).c_str()));
|
GTEST_FLAG(internal_run_death_test).c_str()));
|
||||||
}
|
}
|
||||||
#endif // GTEST_OS_WINDOWS
|
|
||||||
|
# endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
return new InternalRunDeathTestFlag(fields[0], line, index, write_fd);
|
return new InternalRunDeathTestFlag(fields[0], line, index, write_fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,26 +35,26 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS_MOBILE
|
#if GTEST_OS_WINDOWS_MOBILE
|
||||||
#include <windows.h>
|
# include <windows.h>
|
||||||
#elif GTEST_OS_WINDOWS
|
#elif GTEST_OS_WINDOWS
|
||||||
#include <direct.h>
|
# include <direct.h>
|
||||||
#include <io.h>
|
# include <io.h>
|
||||||
#elif GTEST_OS_SYMBIAN || GTEST_OS_NACL
|
#elif GTEST_OS_SYMBIAN || GTEST_OS_NACL
|
||||||
// Symbian OpenC and NaCl have PATH_MAX in sys/syslimits.h
|
// Symbian OpenC and NaCl have PATH_MAX in sys/syslimits.h
|
||||||
#include <sys/syslimits.h>
|
# include <sys/syslimits.h>
|
||||||
#else
|
#else
|
||||||
#include <limits.h>
|
# include <limits.h>
|
||||||
#include <climits> // Some Linux distributions define PATH_MAX here.
|
# include <climits> // Some Linux distributions define PATH_MAX here.
|
||||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
#endif // GTEST_OS_WINDOWS_MOBILE
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS
|
#if GTEST_OS_WINDOWS
|
||||||
#define GTEST_PATH_MAX_ _MAX_PATH
|
# define GTEST_PATH_MAX_ _MAX_PATH
|
||||||
#elif defined(PATH_MAX)
|
#elif defined(PATH_MAX)
|
||||||
#define GTEST_PATH_MAX_ PATH_MAX
|
# define GTEST_PATH_MAX_ PATH_MAX
|
||||||
#elif defined(_XOPEN_PATH_MAX)
|
#elif defined(_XOPEN_PATH_MAX)
|
||||||
#define GTEST_PATH_MAX_ _XOPEN_PATH_MAX
|
# define GTEST_PATH_MAX_ _XOPEN_PATH_MAX
|
||||||
#else
|
#else
|
||||||
#define GTEST_PATH_MAX_ _POSIX_PATH_MAX
|
# define GTEST_PATH_MAX_ _POSIX_PATH_MAX
|
||||||
#endif // GTEST_OS_WINDOWS
|
#endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
#include "gtest/internal/gtest-string.h"
|
#include "gtest/internal/gtest-string.h"
|
||||||
@ -71,16 +71,16 @@ const char kPathSeparator = '\\';
|
|||||||
const char kAlternatePathSeparator = '/';
|
const char kAlternatePathSeparator = '/';
|
||||||
const char kPathSeparatorString[] = "\\";
|
const char kPathSeparatorString[] = "\\";
|
||||||
const char kAlternatePathSeparatorString[] = "/";
|
const char kAlternatePathSeparatorString[] = "/";
|
||||||
#if GTEST_OS_WINDOWS_MOBILE
|
# if GTEST_OS_WINDOWS_MOBILE
|
||||||
// Windows CE doesn't have a current directory. You should not use
|
// Windows CE doesn't have a current directory. You should not use
|
||||||
// the current directory in tests on Windows CE, but this at least
|
// the current directory in tests on Windows CE, but this at least
|
||||||
// provides a reasonable fallback.
|
// provides a reasonable fallback.
|
||||||
const char kCurrentDirectoryString[] = "\\";
|
const char kCurrentDirectoryString[] = "\\";
|
||||||
// Windows CE doesn't define INVALID_FILE_ATTRIBUTES
|
// Windows CE doesn't define INVALID_FILE_ATTRIBUTES
|
||||||
const DWORD kInvalidFileAttributes = 0xffffffff;
|
const DWORD kInvalidFileAttributes = 0xffffffff;
|
||||||
#else
|
# else
|
||||||
const char kCurrentDirectoryString[] = ".\\";
|
const char kCurrentDirectoryString[] = ".\\";
|
||||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
# endif // GTEST_OS_WINDOWS_MOBILE
|
||||||
#else
|
#else
|
||||||
const char kPathSeparator = '/';
|
const char kPathSeparator = '/';
|
||||||
const char kPathSeparatorString[] = "/";
|
const char kPathSeparatorString[] = "/";
|
||||||
|
@ -41,12 +41,12 @@
|
|||||||
// part of Google Test's implementation; otherwise it's undefined.
|
// part of Google Test's implementation; otherwise it's undefined.
|
||||||
#if !GTEST_IMPLEMENTATION_
|
#if !GTEST_IMPLEMENTATION_
|
||||||
// A user is trying to include this from his code - just say no.
|
// A user is trying to include this from his code - just say no.
|
||||||
#error "gtest-internal-inl.h is part of Google Test's internal implementation."
|
# error "gtest-internal-inl.h is part of Google Test's internal implementation."
|
||||||
#error "It must not be included except by Google Test itself."
|
# error "It must not be included except by Google Test itself."
|
||||||
#endif // GTEST_IMPLEMENTATION_
|
#endif // GTEST_IMPLEMENTATION_
|
||||||
|
|
||||||
#ifndef _WIN32_WCE
|
#ifndef _WIN32_WCE
|
||||||
#include <errno.h>
|
# include <errno.h>
|
||||||
#endif // !_WIN32_WCE
|
#endif // !_WIN32_WCE
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdlib.h> // For strtoll/_strtoul64/malloc/free.
|
#include <stdlib.h> // For strtoll/_strtoul64/malloc/free.
|
||||||
@ -59,7 +59,7 @@
|
|||||||
#include "gtest/internal/gtest-port.h"
|
#include "gtest/internal/gtest-port.h"
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS
|
#if GTEST_OS_WINDOWS
|
||||||
#include <windows.h> // For DWORD.
|
# include <windows.h> // NOLINT
|
||||||
#endif // GTEST_OS_WINDOWS
|
#endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
#include "gtest/gtest.h" // NOLINT
|
#include "gtest/gtest.h" // NOLINT
|
||||||
@ -930,7 +930,7 @@ GTEST_API_ void ParseGoogleTestFlagsOnly(int* argc, wchar_t** argv);
|
|||||||
// platform.
|
// platform.
|
||||||
GTEST_API_ String GetLastErrnoDescription();
|
GTEST_API_ String GetLastErrnoDescription();
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS
|
# if GTEST_OS_WINDOWS
|
||||||
// Provides leak-safe Windows kernel handle ownership.
|
// Provides leak-safe Windows kernel handle ownership.
|
||||||
class AutoHandle {
|
class AutoHandle {
|
||||||
public:
|
public:
|
||||||
@ -954,7 +954,7 @@ class AutoHandle {
|
|||||||
|
|
||||||
GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle);
|
GTEST_DISALLOW_COPY_AND_ASSIGN_(AutoHandle);
|
||||||
};
|
};
|
||||||
#endif // GTEST_OS_WINDOWS
|
# endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
// Attempts to parse a string into a positive integer pointed to by the
|
// Attempts to parse a string into a positive integer pointed to by the
|
||||||
// number parameter. Returns true if that is possible.
|
// number parameter. Returns true if that is possible.
|
||||||
@ -973,14 +973,20 @@ bool ParseNaturalNumber(const ::std::string& str, Integer* number) {
|
|||||||
char* end;
|
char* end;
|
||||||
// BiggestConvertible is the largest integer type that system-provided
|
// BiggestConvertible is the largest integer type that system-provided
|
||||||
// string-to-number conversion routines can return.
|
// string-to-number conversion routines can return.
|
||||||
#if GTEST_OS_WINDOWS && !defined(__GNUC__)
|
|
||||||
|
# if GTEST_OS_WINDOWS && !defined(__GNUC__)
|
||||||
|
|
||||||
// MSVC and C++ Builder define __int64 instead of the standard long long.
|
// MSVC and C++ Builder define __int64 instead of the standard long long.
|
||||||
typedef unsigned __int64 BiggestConvertible;
|
typedef unsigned __int64 BiggestConvertible;
|
||||||
const BiggestConvertible parsed = _strtoui64(str.c_str(), &end, 10);
|
const BiggestConvertible parsed = _strtoui64(str.c_str(), &end, 10);
|
||||||
#else
|
|
||||||
|
# else
|
||||||
|
|
||||||
typedef unsigned long long BiggestConvertible; // NOLINT
|
typedef unsigned long long BiggestConvertible; // NOLINT
|
||||||
const BiggestConvertible parsed = strtoull(str.c_str(), &end, 10);
|
const BiggestConvertible parsed = strtoull(str.c_str(), &end, 10);
|
||||||
#endif // GTEST_OS_WINDOWS && !defined(__GNUC__)
|
|
||||||
|
# endif // GTEST_OS_WINDOWS && !defined(__GNUC__)
|
||||||
|
|
||||||
const bool parse_success = *end == '\0' && errno == 0;
|
const bool parse_success = *end == '\0' && errno == 0;
|
||||||
|
|
||||||
// TODO(vladl@google.com): Convert this to compile time assertion when it is
|
// TODO(vladl@google.com): Convert this to compile time assertion when it is
|
||||||
|
@ -37,18 +37,18 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS_MOBILE
|
#if GTEST_OS_WINDOWS_MOBILE
|
||||||
#include <windows.h> // For TerminateProcess()
|
# include <windows.h> // For TerminateProcess()
|
||||||
#elif GTEST_OS_WINDOWS
|
#elif GTEST_OS_WINDOWS
|
||||||
#include <io.h>
|
# include <io.h>
|
||||||
#include <sys/stat.h>
|
# include <sys/stat.h>
|
||||||
#else
|
#else
|
||||||
#include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
#endif // GTEST_OS_WINDOWS_MOBILE
|
||||||
|
|
||||||
#if GTEST_OS_MAC
|
#if GTEST_OS_MAC
|
||||||
#include <mach/mach_init.h>
|
# include <mach/mach_init.h>
|
||||||
#include <mach/task.h>
|
# include <mach/task.h>
|
||||||
#include <mach/vm_map.h>
|
# include <mach/vm_map.h>
|
||||||
#endif // GTEST_OS_MAC
|
#endif // GTEST_OS_MAC
|
||||||
|
|
||||||
#include "gtest/gtest-spi.h"
|
#include "gtest/gtest-spi.h"
|
||||||
@ -478,8 +478,8 @@ GTestLog::~GTestLog() {
|
|||||||
// Disable Microsoft deprecation warnings for POSIX functions called from
|
// Disable Microsoft deprecation warnings for POSIX functions called from
|
||||||
// this class (creat, dup, dup2, and close)
|
// this class (creat, dup, dup2, and close)
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
# pragma warning(push)
|
||||||
#pragma warning(disable: 4996)
|
# pragma warning(disable: 4996)
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
|
||||||
#if GTEST_HAS_STREAM_REDIRECTION
|
#if GTEST_HAS_STREAM_REDIRECTION
|
||||||
@ -489,7 +489,8 @@ class CapturedStream {
|
|||||||
public:
|
public:
|
||||||
// The ctor redirects the stream to a temporary file.
|
// The ctor redirects the stream to a temporary file.
|
||||||
CapturedStream(int fd) : fd_(fd), uncaptured_fd_(dup(fd)) {
|
CapturedStream(int fd) : fd_(fd), uncaptured_fd_(dup(fd)) {
|
||||||
#if GTEST_OS_WINDOWS
|
|
||||||
|
# if GTEST_OS_WINDOWS
|
||||||
char temp_dir_path[MAX_PATH + 1] = { '\0' }; // NOLINT
|
char temp_dir_path[MAX_PATH + 1] = { '\0' }; // NOLINT
|
||||||
char temp_file_path[MAX_PATH + 1] = { '\0' }; // NOLINT
|
char temp_file_path[MAX_PATH + 1] = { '\0' }; // NOLINT
|
||||||
|
|
||||||
@ -504,14 +505,14 @@ class CapturedStream {
|
|||||||
GTEST_CHECK_(captured_fd != -1) << "Unable to open temporary file "
|
GTEST_CHECK_(captured_fd != -1) << "Unable to open temporary file "
|
||||||
<< temp_file_path;
|
<< temp_file_path;
|
||||||
filename_ = temp_file_path;
|
filename_ = temp_file_path;
|
||||||
#else
|
# else
|
||||||
// There's no guarantee that a test has write access to the
|
// There's no guarantee that a test has write access to the
|
||||||
// current directory, so we create the temporary file in the /tmp
|
// current directory, so we create the temporary file in the /tmp
|
||||||
// directory instead.
|
// directory instead.
|
||||||
char name_template[] = "/tmp/captured_stream.XXXXXX";
|
char name_template[] = "/tmp/captured_stream.XXXXXX";
|
||||||
const int captured_fd = mkstemp(name_template);
|
const int captured_fd = mkstemp(name_template);
|
||||||
filename_ = name_template;
|
filename_ = name_template;
|
||||||
#endif // GTEST_OS_WINDOWS
|
# endif // GTEST_OS_WINDOWS
|
||||||
fflush(NULL);
|
fflush(NULL);
|
||||||
dup2(captured_fd, fd_);
|
dup2(captured_fd, fd_);
|
||||||
close(captured_fd);
|
close(captured_fd);
|
||||||
@ -580,9 +581,9 @@ String CapturedStream::ReadEntireFile(FILE* file) {
|
|||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
#pragma warning(pop)
|
# pragma warning(pop)
|
||||||
#endif // _MSC_VER
|
# endif // _MSC_VER
|
||||||
|
|
||||||
static CapturedStream* g_captured_stderr = NULL;
|
static CapturedStream* g_captured_stderr = NULL;
|
||||||
static CapturedStream* g_captured_stdout = NULL;
|
static CapturedStream* g_captured_stdout = NULL;
|
||||||
|
@ -56,11 +56,11 @@ namespace {
|
|||||||
using ::std::ostream;
|
using ::std::ostream;
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS_MOBILE // Windows CE does not define _snprintf_s.
|
#if GTEST_OS_WINDOWS_MOBILE // Windows CE does not define _snprintf_s.
|
||||||
#define snprintf _snprintf
|
# define snprintf _snprintf
|
||||||
#elif _MSC_VER >= 1400 // VC 8.0 and later deprecate snprintf and _snprintf.
|
#elif _MSC_VER >= 1400 // VC 8.0 and later deprecate snprintf and _snprintf.
|
||||||
#define snprintf _snprintf_s
|
# define snprintf _snprintf_s
|
||||||
#elif _MSC_VER
|
#elif _MSC_VER
|
||||||
#define snprintf _snprintf
|
# define snprintf _snprintf
|
||||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
#endif // GTEST_OS_WINDOWS_MOBILE
|
||||||
|
|
||||||
// Prints a segment of bytes in the given object.
|
// Prints a segment of bytes in the given object.
|
||||||
|
121
src/gtest.cc
121
src/gtest.cc
@ -51,76 +51,76 @@
|
|||||||
|
|
||||||
// TODO(kenton@google.com): Use autoconf to detect availability of
|
// TODO(kenton@google.com): Use autoconf to detect availability of
|
||||||
// gettimeofday().
|
// gettimeofday().
|
||||||
#define GTEST_HAS_GETTIMEOFDAY_ 1
|
# define GTEST_HAS_GETTIMEOFDAY_ 1
|
||||||
|
|
||||||
#include <fcntl.h> // NOLINT
|
# include <fcntl.h> // NOLINT
|
||||||
#include <limits.h> // NOLINT
|
# include <limits.h> // NOLINT
|
||||||
#include <sched.h> // NOLINT
|
# include <sched.h> // NOLINT
|
||||||
// Declares vsnprintf(). This header is not available on Windows.
|
// Declares vsnprintf(). This header is not available on Windows.
|
||||||
#include <strings.h> // NOLINT
|
# include <strings.h> // NOLINT
|
||||||
#include <sys/mman.h> // NOLINT
|
# include <sys/mman.h> // NOLINT
|
||||||
#include <sys/time.h> // NOLINT
|
# include <sys/time.h> // NOLINT
|
||||||
#include <unistd.h> // NOLINT
|
# include <unistd.h> // NOLINT
|
||||||
#include <string>
|
# include <string>
|
||||||
|
|
||||||
#elif GTEST_OS_SYMBIAN
|
#elif GTEST_OS_SYMBIAN
|
||||||
#define GTEST_HAS_GETTIMEOFDAY_ 1
|
# define GTEST_HAS_GETTIMEOFDAY_ 1
|
||||||
#include <sys/time.h> // NOLINT
|
# include <sys/time.h> // NOLINT
|
||||||
|
|
||||||
#elif GTEST_OS_ZOS
|
#elif GTEST_OS_ZOS
|
||||||
#define GTEST_HAS_GETTIMEOFDAY_ 1
|
# define GTEST_HAS_GETTIMEOFDAY_ 1
|
||||||
#include <sys/time.h> // NOLINT
|
# include <sys/time.h> // NOLINT
|
||||||
|
|
||||||
// On z/OS we additionally need strings.h for strcasecmp.
|
// On z/OS we additionally need strings.h for strcasecmp.
|
||||||
#include <strings.h> // NOLINT
|
# include <strings.h> // NOLINT
|
||||||
|
|
||||||
#elif GTEST_OS_WINDOWS_MOBILE // We are on Windows CE.
|
#elif GTEST_OS_WINDOWS_MOBILE // We are on Windows CE.
|
||||||
|
|
||||||
#include <windows.h> // NOLINT
|
# include <windows.h> // NOLINT
|
||||||
|
|
||||||
#elif GTEST_OS_WINDOWS // We are on Windows proper.
|
#elif GTEST_OS_WINDOWS // We are on Windows proper.
|
||||||
|
|
||||||
#include <io.h> // NOLINT
|
# include <io.h> // NOLINT
|
||||||
#include <sys/timeb.h> // NOLINT
|
# include <sys/timeb.h> // NOLINT
|
||||||
#include <sys/types.h> // NOLINT
|
# include <sys/types.h> // NOLINT
|
||||||
#include <sys/stat.h> // NOLINT
|
# include <sys/stat.h> // NOLINT
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS_MINGW
|
# if GTEST_OS_WINDOWS_MINGW
|
||||||
// MinGW has gettimeofday() but not _ftime64().
|
// MinGW has gettimeofday() but not _ftime64().
|
||||||
// TODO(kenton@google.com): Use autoconf to detect availability of
|
// TODO(kenton@google.com): Use autoconf to detect availability of
|
||||||
// gettimeofday().
|
// gettimeofday().
|
||||||
// TODO(kenton@google.com): There are other ways to get the time on
|
// TODO(kenton@google.com): There are other ways to get the time on
|
||||||
// Windows, like GetTickCount() or GetSystemTimeAsFileTime(). MinGW
|
// Windows, like GetTickCount() or GetSystemTimeAsFileTime(). MinGW
|
||||||
// supports these. consider using them instead.
|
// supports these. consider using them instead.
|
||||||
#define GTEST_HAS_GETTIMEOFDAY_ 1
|
# define GTEST_HAS_GETTIMEOFDAY_ 1
|
||||||
#include <sys/time.h> // NOLINT
|
# include <sys/time.h> // NOLINT
|
||||||
#endif // GTEST_OS_WINDOWS_MINGW
|
# endif // GTEST_OS_WINDOWS_MINGW
|
||||||
|
|
||||||
// cpplint thinks that the header is already included, so we want to
|
// cpplint thinks that the header is already included, so we want to
|
||||||
// silence it.
|
// silence it.
|
||||||
#include <windows.h> // NOLINT
|
# include <windows.h> // NOLINT
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
// Assume other platforms have gettimeofday().
|
// Assume other platforms have gettimeofday().
|
||||||
// TODO(kenton@google.com): Use autoconf to detect availability of
|
// TODO(kenton@google.com): Use autoconf to detect availability of
|
||||||
// gettimeofday().
|
// gettimeofday().
|
||||||
#define GTEST_HAS_GETTIMEOFDAY_ 1
|
# define GTEST_HAS_GETTIMEOFDAY_ 1
|
||||||
|
|
||||||
// cpplint thinks that the header is already included, so we want to
|
// cpplint thinks that the header is already included, so we want to
|
||||||
// silence it.
|
// silence it.
|
||||||
#include <sys/time.h> // NOLINT
|
# include <sys/time.h> // NOLINT
|
||||||
#include <unistd.h> // NOLINT
|
# include <unistd.h> // NOLINT
|
||||||
|
|
||||||
#endif // GTEST_OS_LINUX
|
#endif // GTEST_OS_LINUX
|
||||||
|
|
||||||
#if GTEST_HAS_EXCEPTIONS
|
#if GTEST_HAS_EXCEPTIONS
|
||||||
#include <stdexcept>
|
# include <stdexcept>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GTEST_CAN_STREAM_RESULTS_
|
#if GTEST_CAN_STREAM_RESULTS_
|
||||||
#include <arpa/inet.h> // NOLINT
|
# include <arpa/inet.h> // NOLINT
|
||||||
#include <netdb.h> // NOLINT
|
# include <netdb.h> // NOLINT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Indicates that this translation unit is part of Google Test's
|
// Indicates that this translation unit is part of Google Test's
|
||||||
@ -133,7 +133,7 @@
|
|||||||
#undef GTEST_IMPLEMENTATION_
|
#undef GTEST_IMPLEMENTATION_
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS
|
#if GTEST_OS_WINDOWS
|
||||||
#define vsnprintf _vsnprintf
|
# define vsnprintf _vsnprintf
|
||||||
#endif // GTEST_OS_WINDOWS
|
#endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
@ -786,25 +786,30 @@ TimeInMillis GetTimeInMillis() {
|
|||||||
return 0;
|
return 0;
|
||||||
#elif GTEST_OS_WINDOWS && !GTEST_HAS_GETTIMEOFDAY_
|
#elif GTEST_OS_WINDOWS && !GTEST_HAS_GETTIMEOFDAY_
|
||||||
__timeb64 now;
|
__timeb64 now;
|
||||||
#ifdef _MSC_VER
|
|
||||||
|
# ifdef _MSC_VER
|
||||||
|
|
||||||
// MSVC 8 deprecates _ftime64(), so we want to suppress warning 4996
|
// MSVC 8 deprecates _ftime64(), so we want to suppress warning 4996
|
||||||
// (deprecated function) there.
|
// (deprecated function) there.
|
||||||
// TODO(kenton@google.com): Use GetTickCount()? Or use
|
// TODO(kenton@google.com): Use GetTickCount()? Or use
|
||||||
// SystemTimeToFileTime()
|
// SystemTimeToFileTime()
|
||||||
#pragma warning(push) // Saves the current warning state.
|
# pragma warning(push) // Saves the current warning state.
|
||||||
#pragma warning(disable:4996) // Temporarily disables warning 4996.
|
# pragma warning(disable:4996) // Temporarily disables warning 4996.
|
||||||
_ftime64(&now);
|
_ftime64(&now);
|
||||||
#pragma warning(pop) // Restores the warning state.
|
# pragma warning(pop) // Restores the warning state.
|
||||||
#else
|
# else
|
||||||
|
|
||||||
_ftime64(&now);
|
_ftime64(&now);
|
||||||
#endif // _MSC_VER
|
|
||||||
|
# endif // _MSC_VER
|
||||||
|
|
||||||
return static_cast<TimeInMillis>(now.time) * 1000 + now.millitm;
|
return static_cast<TimeInMillis>(now.time) * 1000 + now.millitm;
|
||||||
#elif GTEST_HAS_GETTIMEOFDAY_
|
#elif GTEST_HAS_GETTIMEOFDAY_
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
gettimeofday(&now, NULL);
|
gettimeofday(&now, NULL);
|
||||||
return static_cast<TimeInMillis>(now.tv_sec) * 1000 + now.tv_usec / 1000;
|
return static_cast<TimeInMillis>(now.tv_sec) * 1000 + now.tv_usec / 1000;
|
||||||
#else
|
#else
|
||||||
#error "Don't know how to get the current time on your system."
|
# error "Don't know how to get the current time on your system."
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1332,10 +1337,13 @@ namespace {
|
|||||||
AssertionResult HRESULTFailureHelper(const char* expr,
|
AssertionResult HRESULTFailureHelper(const char* expr,
|
||||||
const char* expected,
|
const char* expected,
|
||||||
long hr) { // NOLINT
|
long hr) { // NOLINT
|
||||||
#if GTEST_OS_WINDOWS_MOBILE
|
# if GTEST_OS_WINDOWS_MOBILE
|
||||||
|
|
||||||
// Windows CE doesn't support FormatMessage.
|
// Windows CE doesn't support FormatMessage.
|
||||||
const char error_text[] = "";
|
const char error_text[] = "";
|
||||||
#else
|
|
||||||
|
# else
|
||||||
|
|
||||||
// Looks up the human-readable system message for the HRESULT code
|
// Looks up the human-readable system message for the HRESULT code
|
||||||
// and since we're not passing any params to FormatMessage, we don't
|
// and since we're not passing any params to FormatMessage, we don't
|
||||||
// want inserts expanded.
|
// want inserts expanded.
|
||||||
@ -1356,7 +1364,8 @@ AssertionResult HRESULTFailureHelper(const char* expr,
|
|||||||
--message_length) {
|
--message_length) {
|
||||||
error_text[message_length - 1] = '\0';
|
error_text[message_length - 1] = '\0';
|
||||||
}
|
}
|
||||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
|
||||||
|
# endif // GTEST_OS_WINDOWS_MOBILE
|
||||||
|
|
||||||
const String error_hex(String::Format("0x%08X ", hr));
|
const String error_hex(String::Format("0x%08X ", hr));
|
||||||
return ::testing::AssertionFailure()
|
return ::testing::AssertionFailure()
|
||||||
@ -1698,10 +1707,12 @@ String String::Format(const char * format, ...) {
|
|||||||
// MSVC 8 deprecates vsnprintf(), so we want to suppress warning
|
// MSVC 8 deprecates vsnprintf(), so we want to suppress warning
|
||||||
// 4996 (deprecated function) there.
|
// 4996 (deprecated function) there.
|
||||||
#ifdef _MSC_VER // We are using MSVC.
|
#ifdef _MSC_VER // We are using MSVC.
|
||||||
#pragma warning(push) // Saves the current warning state.
|
# pragma warning(push) // Saves the current warning state.
|
||||||
#pragma warning(disable:4996) // Temporarily disables warning 4996.
|
# pragma warning(disable:4996) // Temporarily disables warning 4996.
|
||||||
|
|
||||||
const int size = vsnprintf(buffer, kBufferSize, format, args);
|
const int size = vsnprintf(buffer, kBufferSize, format, args);
|
||||||
#pragma warning(pop) // Restores the warning state.
|
|
||||||
|
# pragma warning(pop) // Restores the warning state.
|
||||||
#else // We are not using MSVC.
|
#else // We are not using MSVC.
|
||||||
const int size = vsnprintf(buffer, kBufferSize, format, args);
|
const int size = vsnprintf(buffer, kBufferSize, format, args);
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
@ -3826,20 +3837,21 @@ int UnitTest::Run() {
|
|||||||
// process. In either case the user does not want to see pop-up dialogs
|
// process. In either case the user does not want to see pop-up dialogs
|
||||||
// about crashes - they are expected.
|
// about crashes - they are expected.
|
||||||
if (impl()->catch_exceptions() || in_death_test_child_process) {
|
if (impl()->catch_exceptions() || in_death_test_child_process) {
|
||||||
#if !GTEST_OS_WINDOWS_MOBILE
|
|
||||||
|
# if !GTEST_OS_WINDOWS_MOBILE
|
||||||
// SetErrorMode doesn't exist on CE.
|
// SetErrorMode doesn't exist on CE.
|
||||||
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT |
|
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOALIGNMENTFAULTEXCEPT |
|
||||||
SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);
|
SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX);
|
||||||
#endif // !GTEST_OS_WINDOWS_MOBILE
|
# endif // !GTEST_OS_WINDOWS_MOBILE
|
||||||
|
|
||||||
#if (defined(_MSC_VER) || GTEST_OS_WINDOWS_MINGW) && !GTEST_OS_WINDOWS_MOBILE
|
# if (defined(_MSC_VER) || GTEST_OS_WINDOWS_MINGW) && !GTEST_OS_WINDOWS_MOBILE
|
||||||
// Death test children can be terminated with _abort(). On Windows,
|
// Death test children can be terminated with _abort(). On Windows,
|
||||||
// _abort() can show a dialog with a warning message. This forces the
|
// _abort() can show a dialog with a warning message. This forces the
|
||||||
// abort message to go to stderr instead.
|
// abort message to go to stderr instead.
|
||||||
_set_error_mode(_OUT_TO_STDERR);
|
_set_error_mode(_OUT_TO_STDERR);
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE
|
# if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE
|
||||||
// In the debug version, Visual Studio pops up a separate dialog
|
// In the debug version, Visual Studio pops up a separate dialog
|
||||||
// offering a choice to debug the aborted program. We need to suppress
|
// offering a choice to debug the aborted program. We need to suppress
|
||||||
// this dialog or it will pop up for every EXPECT/ASSERT_DEATH statement
|
// this dialog or it will pop up for every EXPECT/ASSERT_DEATH statement
|
||||||
@ -3855,7 +3867,8 @@ int UnitTest::Run() {
|
|||||||
_set_abort_behavior(
|
_set_abort_behavior(
|
||||||
0x0, // Clear the following flags:
|
0x0, // Clear the following flags:
|
||||||
_WRITE_ABORT_MSG | _CALL_REPORTFAULT); // pop-up window, core dump.
|
_WRITE_ABORT_MSG | _CALL_REPORTFAULT); // pop-up window, core dump.
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif // GTEST_HAS_SEH
|
#endif // GTEST_HAS_SEH
|
||||||
|
|
||||||
@ -3930,12 +3943,12 @@ namespace internal {
|
|||||||
UnitTestImpl::UnitTestImpl(UnitTest* parent)
|
UnitTestImpl::UnitTestImpl(UnitTest* parent)
|
||||||
: parent_(parent),
|
: parent_(parent),
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push) // Saves the current warning state.
|
# pragma warning(push) // Saves the current warning state.
|
||||||
#pragma warning(disable:4355) // Temporarily disables warning 4355
|
# pragma warning(disable:4355) // Temporarily disables warning 4355
|
||||||
// (using this in initializer).
|
// (using this in initializer).
|
||||||
default_global_test_part_result_reporter_(this),
|
default_global_test_part_result_reporter_(this),
|
||||||
default_per_thread_test_part_result_reporter_(this),
|
default_per_thread_test_part_result_reporter_(this),
|
||||||
#pragma warning(pop) // Restores the warning state again.
|
# pragma warning(pop) // Restores the warning state again.
|
||||||
#else
|
#else
|
||||||
default_global_test_part_result_reporter_(this),
|
default_global_test_part_result_reporter_(this),
|
||||||
default_per_thread_test_part_result_reporter_(this),
|
default_per_thread_test_part_result_reporter_(this),
|
||||||
@ -4853,10 +4866,12 @@ void InitGoogleTestImpl(int* argc, CharType** argv) {
|
|||||||
internal::g_executable_path = internal::StreamableToString(argv[0]);
|
internal::g_executable_path = internal::StreamableToString(argv[0]);
|
||||||
|
|
||||||
#if GTEST_HAS_DEATH_TEST
|
#if GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
g_argvs.clear();
|
g_argvs.clear();
|
||||||
for (int i = 0; i != *argc; i++) {
|
for (int i = 0; i != *argc; i++) {
|
||||||
g_argvs.push_back(StreamableToString(argv[i]));
|
g_argvs.push_back(StreamableToString(argv[i]));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // GTEST_HAS_DEATH_TEST
|
#endif // GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
ParseGoogleTestFlagsOnly(argc, argv);
|
ParseGoogleTestFlagsOnly(argc, argv);
|
||||||
|
@ -36,15 +36,15 @@
|
|||||||
|
|
||||||
#if GTEST_HAS_DEATH_TEST
|
#if GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
#if GTEST_HAS_SEH
|
# if GTEST_HAS_SEH
|
||||||
#include <windows.h> // For RaiseException().
|
# include <windows.h> // For RaiseException().
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#include "gtest/gtest-spi.h"
|
# include "gtest/gtest-spi.h"
|
||||||
|
|
||||||
#if GTEST_HAS_EXCEPTIONS
|
# if GTEST_HAS_EXCEPTIONS
|
||||||
|
|
||||||
#include <exception> // For std::exception.
|
# include <exception> // For std::exception.
|
||||||
|
|
||||||
// Tests that death tests report thrown exceptions as failures and that the
|
// Tests that death tests report thrown exceptions as failures and that the
|
||||||
// exceptions do not escape death test macros.
|
// exceptions do not escape death test macros.
|
||||||
@ -71,9 +71,9 @@ TEST(CxxExceptionDeathTest, PrintsMessageForStdExceptions) {
|
|||||||
EXPECT_NONFATAL_FAILURE(EXPECT_DEATH(throw TestException(), ""),
|
EXPECT_NONFATAL_FAILURE(EXPECT_DEATH(throw TestException(), ""),
|
||||||
"gtest-death-test_ex_test.cc");
|
"gtest-death-test_ex_test.cc");
|
||||||
}
|
}
|
||||||
#endif // GTEST_HAS_EXCEPTIONS
|
# endif // GTEST_HAS_EXCEPTIONS
|
||||||
|
|
||||||
#if GTEST_HAS_SEH
|
# if GTEST_HAS_SEH
|
||||||
// Tests that enabling interception of SEH exceptions with the
|
// Tests that enabling interception of SEH exceptions with the
|
||||||
// catch_exceptions flag does not interfere with SEH exceptions being
|
// catch_exceptions flag does not interfere with SEH exceptions being
|
||||||
// treated as death by death tests.
|
// treated as death by death tests.
|
||||||
@ -82,7 +82,7 @@ TEST(SehExceptionDeasTest, CatchExceptionsDoesNotInterfere) {
|
|||||||
<< "with catch_exceptions "
|
<< "with catch_exceptions "
|
||||||
<< (testing::GTEST_FLAG(catch_exceptions) ? "enabled" : "disabled");
|
<< (testing::GTEST_FLAG(catch_exceptions) ? "enabled" : "disabled");
|
||||||
}
|
}
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#endif // GTEST_HAS_DEATH_TEST
|
#endif // GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
|
@ -40,28 +40,28 @@ using testing::internal::AlwaysTrue;
|
|||||||
|
|
||||||
#if GTEST_HAS_DEATH_TEST
|
#if GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS
|
# if GTEST_OS_WINDOWS
|
||||||
#include <direct.h> // For chdir().
|
# include <direct.h> // For chdir().
|
||||||
#else
|
# else
|
||||||
#include <unistd.h>
|
# include <unistd.h>
|
||||||
#include <sys/wait.h> // For waitpid.
|
# include <sys/wait.h> // For waitpid.
|
||||||
#include <limits> // For std::numeric_limits.
|
# include <limits> // For std::numeric_limits.
|
||||||
#endif // GTEST_OS_WINDOWS
|
# endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
#include <limits.h>
|
# include <limits.h>
|
||||||
#include <signal.h>
|
# include <signal.h>
|
||||||
#include <stdio.h>
|
# include <stdio.h>
|
||||||
|
|
||||||
#include "gtest/gtest-spi.h"
|
# include "gtest/gtest-spi.h"
|
||||||
|
|
||||||
// Indicates that this translation unit is part of Google Test's
|
// Indicates that this translation unit is part of Google Test's
|
||||||
// implementation. It must come before gtest-internal-inl.h is
|
// implementation. It must come before gtest-internal-inl.h is
|
||||||
// included, or there will be a compiler error. This trick is to
|
// included, or there will be a compiler error. This trick is to
|
||||||
// prevent a user from accidentally including gtest-internal-inl.h in
|
// prevent a user from accidentally including gtest-internal-inl.h in
|
||||||
// his code.
|
// his code.
|
||||||
#define GTEST_IMPLEMENTATION_ 1
|
# define GTEST_IMPLEMENTATION_ 1
|
||||||
#include "src/gtest-internal-inl.h"
|
# include "src/gtest-internal-inl.h"
|
||||||
#undef GTEST_IMPLEMENTATION_
|
# undef GTEST_IMPLEMENTATION_
|
||||||
|
|
||||||
namespace posix = ::testing::internal::posix;
|
namespace posix = ::testing::internal::posix;
|
||||||
|
|
||||||
@ -195,13 +195,17 @@ void DeathTestSubroutine() {
|
|||||||
// Death in dbg, not opt.
|
// Death in dbg, not opt.
|
||||||
int DieInDebugElse12(int* sideeffect) {
|
int DieInDebugElse12(int* sideeffect) {
|
||||||
if (sideeffect) *sideeffect = 12;
|
if (sideeffect) *sideeffect = 12;
|
||||||
#ifndef NDEBUG
|
|
||||||
|
# ifndef NDEBUG
|
||||||
|
|
||||||
DieInside("DieInDebugElse12");
|
DieInside("DieInDebugElse12");
|
||||||
#endif // NDEBUG
|
|
||||||
|
# endif // NDEBUG
|
||||||
|
|
||||||
return 12;
|
return 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS
|
# if GTEST_OS_WINDOWS
|
||||||
|
|
||||||
// Tests the ExitedWithCode predicate.
|
// Tests the ExitedWithCode predicate.
|
||||||
TEST(ExitStatusPredicateTest, ExitedWithCode) {
|
TEST(ExitStatusPredicateTest, ExitedWithCode) {
|
||||||
@ -214,7 +218,7 @@ TEST(ExitStatusPredicateTest, ExitedWithCode) {
|
|||||||
EXPECT_FALSE(testing::ExitedWithCode(1)(0));
|
EXPECT_FALSE(testing::ExitedWithCode(1)(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
# else
|
||||||
|
|
||||||
// Returns the exit status of a process that calls _exit(2) with a
|
// Returns the exit status of a process that calls _exit(2) with a
|
||||||
// given exit code. This is a helper function for the
|
// given exit code. This is a helper function for the
|
||||||
@ -273,7 +277,7 @@ TEST(ExitStatusPredicateTest, KilledBySignal) {
|
|||||||
EXPECT_FALSE(pred_kill(status_segv));
|
EXPECT_FALSE(pred_kill(status_segv));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // GTEST_OS_WINDOWS
|
# endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
// Tests that the death test macros expand to code which may or may not
|
// Tests that the death test macros expand to code which may or may not
|
||||||
// be followed by operator<<, and that in either case the complete text
|
// be followed by operator<<, and that in either case the complete text
|
||||||
@ -305,7 +309,7 @@ void DieWithEmbeddedNul() {
|
|||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_USES_PCRE
|
# if GTEST_USES_PCRE
|
||||||
// Tests that EXPECT_DEATH and ASSERT_DEATH work when the error
|
// Tests that EXPECT_DEATH and ASSERT_DEATH work when the error
|
||||||
// message has a NUL character in it.
|
// message has a NUL character in it.
|
||||||
TEST_F(TestForDeathTest, EmbeddedNulInMessage) {
|
TEST_F(TestForDeathTest, EmbeddedNulInMessage) {
|
||||||
@ -314,17 +318,17 @@ TEST_F(TestForDeathTest, EmbeddedNulInMessage) {
|
|||||||
EXPECT_DEATH(DieWithEmbeddedNul(), "my null world");
|
EXPECT_DEATH(DieWithEmbeddedNul(), "my null world");
|
||||||
ASSERT_DEATH(DieWithEmbeddedNul(), "my null world");
|
ASSERT_DEATH(DieWithEmbeddedNul(), "my null world");
|
||||||
}
|
}
|
||||||
#endif // GTEST_USES_PCRE
|
# endif // GTEST_USES_PCRE
|
||||||
|
|
||||||
// Tests that death test macros expand to code which interacts well with switch
|
// Tests that death test macros expand to code which interacts well with switch
|
||||||
// statements.
|
// statements.
|
||||||
TEST_F(TestForDeathTest, SwitchStatement) {
|
TEST_F(TestForDeathTest, SwitchStatement) {
|
||||||
// Microsoft compiler usually complains about switch statements without
|
// Microsoft compiler usually complains about switch statements without
|
||||||
// case labels. We suppress that warning for this test.
|
// case labels. We suppress that warning for this test.
|
||||||
#ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
# pragma warning(push)
|
||||||
#pragma warning(disable: 4065)
|
# pragma warning(disable: 4065)
|
||||||
#endif // _MSC_VER
|
# endif // _MSC_VER
|
||||||
|
|
||||||
switch (0)
|
switch (0)
|
||||||
default:
|
default:
|
||||||
@ -334,9 +338,9 @@ TEST_F(TestForDeathTest, SwitchStatement) {
|
|||||||
case 0:
|
case 0:
|
||||||
EXPECT_DEATH(_exit(1), "") << "exit in switch case";
|
EXPECT_DEATH(_exit(1), "") << "exit in switch case";
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
#pragma warning(pop)
|
# pragma warning(pop)
|
||||||
#endif // _MSC_VER
|
# endif // _MSC_VER
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that a static member function can be used in a "fast" style
|
// Tests that a static member function can be used in a "fast" style
|
||||||
@ -415,7 +419,7 @@ void SetPthreadFlag() {
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
#if GTEST_HAS_CLONE && GTEST_HAS_PTHREAD
|
# if GTEST_HAS_CLONE && GTEST_HAS_PTHREAD
|
||||||
|
|
||||||
TEST_F(TestForDeathTest, DoesNotExecuteAtforkHooks) {
|
TEST_F(TestForDeathTest, DoesNotExecuteAtforkHooks) {
|
||||||
if (!testing::GTEST_FLAG(death_test_use_fork)) {
|
if (!testing::GTEST_FLAG(death_test_use_fork)) {
|
||||||
@ -427,7 +431,7 @@ TEST_F(TestForDeathTest, DoesNotExecuteAtforkHooks) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // GTEST_HAS_CLONE && GTEST_HAS_PTHREAD
|
# endif // GTEST_HAS_CLONE && GTEST_HAS_PTHREAD
|
||||||
|
|
||||||
// Tests that a method of another class can be used in a death test.
|
// Tests that a method of another class can be used in a death test.
|
||||||
TEST_F(TestForDeathTest, MethodOfAnotherClass) {
|
TEST_F(TestForDeathTest, MethodOfAnotherClass) {
|
||||||
@ -449,10 +453,12 @@ TEST_F(TestForDeathTest, AcceptsAnythingConvertibleToRE) {
|
|||||||
const testing::internal::RE regex(regex_c_str);
|
const testing::internal::RE regex(regex_c_str);
|
||||||
EXPECT_DEATH(GlobalFunction(), regex);
|
EXPECT_DEATH(GlobalFunction(), regex);
|
||||||
|
|
||||||
#if GTEST_HAS_GLOBAL_STRING
|
# if GTEST_HAS_GLOBAL_STRING
|
||||||
|
|
||||||
const string regex_str(regex_c_str);
|
const string regex_str(regex_c_str);
|
||||||
EXPECT_DEATH(GlobalFunction(), regex_str);
|
EXPECT_DEATH(GlobalFunction(), regex_str);
|
||||||
#endif // GTEST_HAS_GLOBAL_STRING
|
|
||||||
|
# endif // GTEST_HAS_GLOBAL_STRING
|
||||||
|
|
||||||
const ::std::string regex_std_str(regex_c_str);
|
const ::std::string regex_std_str(regex_c_str);
|
||||||
EXPECT_DEATH(GlobalFunction(), regex_std_str);
|
EXPECT_DEATH(GlobalFunction(), regex_std_str);
|
||||||
@ -568,13 +574,17 @@ TEST_F(TestForDeathTest, TestExpectDebugDeath) {
|
|||||||
EXPECT_DEBUG_DEATH(DieInDebugElse12(&sideeffect),
|
EXPECT_DEBUG_DEATH(DieInDebugElse12(&sideeffect),
|
||||||
"death.*DieInDebugElse12");
|
"death.*DieInDebugElse12");
|
||||||
|
|
||||||
#ifdef NDEBUG
|
# ifdef NDEBUG
|
||||||
|
|
||||||
// Checks that the assignment occurs in opt mode (sideeffect).
|
// Checks that the assignment occurs in opt mode (sideeffect).
|
||||||
EXPECT_EQ(12, sideeffect);
|
EXPECT_EQ(12, sideeffect);
|
||||||
#else
|
|
||||||
|
# else
|
||||||
|
|
||||||
// Checks that the assignment does not occur in dbg mode (no sideeffect).
|
// Checks that the assignment does not occur in dbg mode (no sideeffect).
|
||||||
EXPECT_EQ(0, sideeffect);
|
EXPECT_EQ(0, sideeffect);
|
||||||
#endif
|
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that ASSERT_DEBUG_DEATH works as expected
|
// Tests that ASSERT_DEBUG_DEATH works as expected
|
||||||
@ -594,16 +604,20 @@ TEST_F(TestForDeathTest, TestAssertDebugDeath) {
|
|||||||
EXPECT_EQ(12, sideeffect);
|
EXPECT_EQ(12, sideeffect);
|
||||||
}, "death.*DieInDebugElse12");
|
}, "death.*DieInDebugElse12");
|
||||||
|
|
||||||
#ifdef NDEBUG
|
# ifdef NDEBUG
|
||||||
|
|
||||||
// Checks that the assignment occurs in opt mode (sideeffect).
|
// Checks that the assignment occurs in opt mode (sideeffect).
|
||||||
EXPECT_EQ(12, sideeffect);
|
EXPECT_EQ(12, sideeffect);
|
||||||
#else
|
|
||||||
|
# else
|
||||||
|
|
||||||
// Checks that the assignment does not occur in dbg mode (no sideeffect).
|
// Checks that the assignment does not occur in dbg mode (no sideeffect).
|
||||||
EXPECT_EQ(0, sideeffect);
|
EXPECT_EQ(0, sideeffect);
|
||||||
#endif
|
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NDEBUG
|
# ifndef NDEBUG
|
||||||
|
|
||||||
void ExpectDebugDeathHelper(bool* aborted) {
|
void ExpectDebugDeathHelper(bool* aborted) {
|
||||||
*aborted = true;
|
*aborted = true;
|
||||||
@ -611,7 +625,7 @@ void ExpectDebugDeathHelper(bool* aborted) {
|
|||||||
*aborted = false;
|
*aborted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS
|
# if GTEST_OS_WINDOWS
|
||||||
TEST(PopUpDeathTest, DoesNotShowPopUpOnAbort) {
|
TEST(PopUpDeathTest, DoesNotShowPopUpOnAbort) {
|
||||||
printf("This test should be considered failing if it shows "
|
printf("This test should be considered failing if it shows "
|
||||||
"any pop-up dialogs.\n");
|
"any pop-up dialogs.\n");
|
||||||
@ -622,7 +636,7 @@ TEST(PopUpDeathTest, DoesNotShowPopUpOnAbort) {
|
|||||||
abort();
|
abort();
|
||||||
}, "");
|
}, "");
|
||||||
}
|
}
|
||||||
#endif // GTEST_OS_WINDOWS
|
# endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
// Tests that EXPECT_DEBUG_DEATH in debug mode does not abort
|
// Tests that EXPECT_DEBUG_DEATH in debug mode does not abort
|
||||||
// the function.
|
// the function.
|
||||||
@ -647,19 +661,22 @@ TEST_F(TestForDeathTest, AssertDebugDeathAborts) {
|
|||||||
EXPECT_TRUE(aborted);
|
EXPECT_TRUE(aborted);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // _NDEBUG
|
# endif // _NDEBUG
|
||||||
|
|
||||||
// Tests the *_EXIT family of macros, using a variety of predicates.
|
// Tests the *_EXIT family of macros, using a variety of predicates.
|
||||||
static void TestExitMacros() {
|
static void TestExitMacros() {
|
||||||
EXPECT_EXIT(_exit(1), testing::ExitedWithCode(1), "");
|
EXPECT_EXIT(_exit(1), testing::ExitedWithCode(1), "");
|
||||||
ASSERT_EXIT(_exit(42), testing::ExitedWithCode(42), "");
|
ASSERT_EXIT(_exit(42), testing::ExitedWithCode(42), "");
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS
|
# if GTEST_OS_WINDOWS
|
||||||
|
|
||||||
// Of all signals effects on the process exit code, only those of SIGABRT
|
// Of all signals effects on the process exit code, only those of SIGABRT
|
||||||
// are documented on Windows.
|
// are documented on Windows.
|
||||||
// See http://msdn.microsoft.com/en-us/library/dwwzkt4c(VS.71).aspx.
|
// See http://msdn.microsoft.com/en-us/library/dwwzkt4c(VS.71).aspx.
|
||||||
EXPECT_EXIT(raise(SIGABRT), testing::ExitedWithCode(3), "");
|
EXPECT_EXIT(raise(SIGABRT), testing::ExitedWithCode(3), "");
|
||||||
#else
|
|
||||||
|
# else
|
||||||
|
|
||||||
EXPECT_EXIT(raise(SIGKILL), testing::KilledBySignal(SIGKILL), "") << "foo";
|
EXPECT_EXIT(raise(SIGKILL), testing::KilledBySignal(SIGKILL), "") << "foo";
|
||||||
ASSERT_EXIT(raise(SIGUSR2), testing::KilledBySignal(SIGUSR2), "") << "bar";
|
ASSERT_EXIT(raise(SIGUSR2), testing::KilledBySignal(SIGUSR2), "") << "bar";
|
||||||
|
|
||||||
@ -667,7 +684,8 @@ static void TestExitMacros() {
|
|||||||
ASSERT_EXIT(_exit(0), testing::KilledBySignal(SIGSEGV), "")
|
ASSERT_EXIT(_exit(0), testing::KilledBySignal(SIGSEGV), "")
|
||||||
<< "This failure is expected, too.";
|
<< "This failure is expected, too.";
|
||||||
}, "This failure is expected, too.");
|
}, "This failure is expected, too.");
|
||||||
#endif // GTEST_OS_WINDOWS
|
|
||||||
|
# endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
EXPECT_NONFATAL_FAILURE({ // NOLINT
|
EXPECT_NONFATAL_FAILURE({ // NOLINT
|
||||||
EXPECT_EXIT(raise(SIGSEGV), testing::ExitedWithCode(0), "")
|
EXPECT_EXIT(raise(SIGSEGV), testing::ExitedWithCode(0), "")
|
||||||
@ -1022,7 +1040,7 @@ TEST(GetLastErrnoDescription, GetLastErrnoDescriptionWorks) {
|
|||||||
EXPECT_STREQ("", GetLastErrnoDescription().c_str());
|
EXPECT_STREQ("", GetLastErrnoDescription().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS
|
# if GTEST_OS_WINDOWS
|
||||||
TEST(AutoHandleTest, AutoHandleWorks) {
|
TEST(AutoHandleTest, AutoHandleWorks) {
|
||||||
HANDLE handle = ::CreateEvent(NULL, FALSE, FALSE, NULL);
|
HANDLE handle = ::CreateEvent(NULL, FALSE, FALSE, NULL);
|
||||||
ASSERT_NE(INVALID_HANDLE_VALUE, handle);
|
ASSERT_NE(INVALID_HANDLE_VALUE, handle);
|
||||||
@ -1047,21 +1065,21 @@ TEST(AutoHandleTest, AutoHandleWorks) {
|
|||||||
testing::internal::AutoHandle auto_handle2;
|
testing::internal::AutoHandle auto_handle2;
|
||||||
EXPECT_EQ(INVALID_HANDLE_VALUE, auto_handle2.Get());
|
EXPECT_EQ(INVALID_HANDLE_VALUE, auto_handle2.Get());
|
||||||
}
|
}
|
||||||
#endif // GTEST_OS_WINDOWS
|
# endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS
|
# if GTEST_OS_WINDOWS
|
||||||
typedef unsigned __int64 BiggestParsable;
|
typedef unsigned __int64 BiggestParsable;
|
||||||
typedef signed __int64 BiggestSignedParsable;
|
typedef signed __int64 BiggestSignedParsable;
|
||||||
const BiggestParsable kBiggestParsableMax = ULLONG_MAX;
|
const BiggestParsable kBiggestParsableMax = ULLONG_MAX;
|
||||||
const BiggestSignedParsable kBiggestSignedParsableMax = LLONG_MAX;
|
const BiggestSignedParsable kBiggestSignedParsableMax = LLONG_MAX;
|
||||||
#else
|
# else
|
||||||
typedef unsigned long long BiggestParsable;
|
typedef unsigned long long BiggestParsable;
|
||||||
typedef signed long long BiggestSignedParsable;
|
typedef signed long long BiggestSignedParsable;
|
||||||
const BiggestParsable kBiggestParsableMax =
|
const BiggestParsable kBiggestParsableMax =
|
||||||
::std::numeric_limits<BiggestParsable>::max();
|
::std::numeric_limits<BiggestParsable>::max();
|
||||||
const BiggestSignedParsable kBiggestSignedParsableMax =
|
const BiggestSignedParsable kBiggestSignedParsableMax =
|
||||||
::std::numeric_limits<BiggestSignedParsable>::max();
|
::std::numeric_limits<BiggestSignedParsable>::max();
|
||||||
#endif // GTEST_OS_WINDOWS
|
# endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
TEST(ParseNaturalNumberTest, RejectsInvalidFormat) {
|
TEST(ParseNaturalNumberTest, RejectsInvalidFormat) {
|
||||||
BiggestParsable result = 0;
|
BiggestParsable result = 0;
|
||||||
@ -1147,14 +1165,14 @@ TEST(ParseNaturalNumberTest, WorksForShorterIntegers) {
|
|||||||
EXPECT_EQ(123, char_result);
|
EXPECT_EQ(123, char_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS
|
# if GTEST_OS_WINDOWS
|
||||||
TEST(EnvironmentTest, HandleFitsIntoSizeT) {
|
TEST(EnvironmentTest, HandleFitsIntoSizeT) {
|
||||||
// TODO(vladl@google.com): Remove this test after this condition is verified
|
// TODO(vladl@google.com): Remove this test after this condition is verified
|
||||||
// in a static assertion in gtest-death-test.cc in the function
|
// in a static assertion in gtest-death-test.cc in the function
|
||||||
// GetStatusFileDescriptor.
|
// GetStatusFileDescriptor.
|
||||||
ASSERT_TRUE(sizeof(HANDLE) <= sizeof(size_t));
|
ASSERT_TRUE(sizeof(HANDLE) <= sizeof(size_t));
|
||||||
}
|
}
|
||||||
#endif // GTEST_OS_WINDOWS
|
# endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
// Tests that EXPECT_DEATH_IF_SUPPORTED/ASSERT_DEATH_IF_SUPPORTED trigger
|
// Tests that EXPECT_DEATH_IF_SUPPORTED/ASSERT_DEATH_IF_SUPPORTED trigger
|
||||||
// failures when death tests are available on the system.
|
// failures when death tests are available on the system.
|
||||||
@ -1253,8 +1271,8 @@ TEST(ConditionalDeathMacrosSyntaxDeathTest, SwitchStatement) {
|
|||||||
// Microsoft compiler usually complains about switch statements without
|
// Microsoft compiler usually complains about switch statements without
|
||||||
// case labels. We suppress that warning for this test.
|
// case labels. We suppress that warning for this test.
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(push)
|
# pragma warning(push)
|
||||||
#pragma warning(disable: 4065)
|
# pragma warning(disable: 4065)
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
|
||||||
switch (0)
|
switch (0)
|
||||||
@ -1267,7 +1285,7 @@ TEST(ConditionalDeathMacrosSyntaxDeathTest, SwitchStatement) {
|
|||||||
EXPECT_DEATH_IF_SUPPORTED(_exit(1), "") << "exit in switch case";
|
EXPECT_DEATH_IF_SUPPORTED(_exit(1), "") << "exit in switch case";
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(pop)
|
# pragma warning(pop)
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,9 +51,9 @@
|
|||||||
#undef GTEST_IMPLEMENTATION_
|
#undef GTEST_IMPLEMENTATION_
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS_MOBILE
|
#if GTEST_OS_WINDOWS_MOBILE
|
||||||
#include <windows.h> // NOLINT
|
# include <windows.h> // NOLINT
|
||||||
#elif GTEST_OS_WINDOWS
|
#elif GTEST_OS_WINDOWS
|
||||||
#include <direct.h> // NOLINT
|
# include <direct.h> // NOLINT
|
||||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
#endif // GTEST_OS_WINDOWS_MOBILE
|
||||||
|
|
||||||
namespace testing {
|
namespace testing {
|
||||||
@ -91,14 +91,18 @@ TEST(GetCurrentDirTest, ReturnsCurrentDir) {
|
|||||||
const FilePath cwd = FilePath::GetCurrentDir();
|
const FilePath cwd = FilePath::GetCurrentDir();
|
||||||
posix::ChDir(original_dir.c_str());
|
posix::ChDir(original_dir.c_str());
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS
|
# if GTEST_OS_WINDOWS
|
||||||
|
|
||||||
// Skips the ":".
|
// Skips the ":".
|
||||||
const char* const cwd_without_drive = strchr(cwd.c_str(), ':');
|
const char* const cwd_without_drive = strchr(cwd.c_str(), ':');
|
||||||
ASSERT_TRUE(cwd_without_drive != NULL);
|
ASSERT_TRUE(cwd_without_drive != NULL);
|
||||||
EXPECT_STREQ(GTEST_PATH_SEP_, cwd_without_drive + 1);
|
EXPECT_STREQ(GTEST_PATH_SEP_, cwd_without_drive + 1);
|
||||||
#else
|
|
||||||
|
# else
|
||||||
|
|
||||||
EXPECT_STREQ(GTEST_PATH_SEP_, cwd.c_str());
|
EXPECT_STREQ(GTEST_PATH_SEP_, cwd.c_str());
|
||||||
#endif
|
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
#endif // GTEST_OS_WINDOWS_MOBILE
|
||||||
@ -415,10 +419,12 @@ TEST(DirectoryTest, EmptyPathDirectoryDoesNotExist) {
|
|||||||
|
|
||||||
TEST(DirectoryTest, CurrentDirectoryExists) {
|
TEST(DirectoryTest, CurrentDirectoryExists) {
|
||||||
#if GTEST_OS_WINDOWS // We are on Windows.
|
#if GTEST_OS_WINDOWS // We are on Windows.
|
||||||
#ifndef _WIN32_CE // Windows CE doesn't have a current directory.
|
# ifndef _WIN32_CE // Windows CE doesn't have a current directory.
|
||||||
|
|
||||||
EXPECT_TRUE(FilePath(".").DirectoryExists());
|
EXPECT_TRUE(FilePath(".").DirectoryExists());
|
||||||
EXPECT_TRUE(FilePath(".\\").DirectoryExists());
|
EXPECT_TRUE(FilePath(".\\").DirectoryExists());
|
||||||
#endif // _WIN32_CE
|
|
||||||
|
# endif // _WIN32_CE
|
||||||
#else
|
#else
|
||||||
EXPECT_TRUE(FilePath(".").DirectoryExists());
|
EXPECT_TRUE(FilePath(".").DirectoryExists());
|
||||||
EXPECT_TRUE(FilePath("./").DirectoryExists());
|
EXPECT_TRUE(FilePath("./").DirectoryExists());
|
||||||
|
@ -41,9 +41,9 @@
|
|||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS_MOBILE
|
#if GTEST_OS_WINDOWS_MOBILE
|
||||||
#include <windows.h>
|
# include <windows.h>
|
||||||
#elif GTEST_OS_WINDOWS
|
#elif GTEST_OS_WINDOWS
|
||||||
#include <direct.h>
|
# include <direct.h>
|
||||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
#endif // GTEST_OS_WINDOWS_MOBILE
|
||||||
|
|
||||||
// Indicates that this translation unit is part of Google Test's
|
// Indicates that this translation unit is part of Google Test's
|
||||||
|
@ -37,19 +37,19 @@
|
|||||||
|
|
||||||
#if GTEST_HAS_PARAM_TEST
|
#if GTEST_HAS_PARAM_TEST
|
||||||
|
|
||||||
#include <algorithm>
|
# include <algorithm>
|
||||||
#include <iostream>
|
# include <iostream>
|
||||||
#include <list>
|
# include <list>
|
||||||
#include <sstream>
|
# include <sstream>
|
||||||
#include <string>
|
# include <string>
|
||||||
#include <vector>
|
# include <vector>
|
||||||
|
|
||||||
// To include gtest-internal-inl.h.
|
// To include gtest-internal-inl.h.
|
||||||
#define GTEST_IMPLEMENTATION_ 1
|
# define GTEST_IMPLEMENTATION_ 1
|
||||||
#include "src/gtest-internal-inl.h" // for UnitTestOptions
|
# include "src/gtest-internal-inl.h" // for UnitTestOptions
|
||||||
#undef GTEST_IMPLEMENTATION_
|
# undef GTEST_IMPLEMENTATION_
|
||||||
|
|
||||||
#include "test/gtest-param-test_test.h"
|
# include "test/gtest-param-test_test.h"
|
||||||
|
|
||||||
using ::std::vector;
|
using ::std::vector;
|
||||||
using ::std::sort;
|
using ::std::sort;
|
||||||
@ -62,12 +62,12 @@ using ::testing::TestWithParam;
|
|||||||
using ::testing::Values;
|
using ::testing::Values;
|
||||||
using ::testing::ValuesIn;
|
using ::testing::ValuesIn;
|
||||||
|
|
||||||
#if GTEST_HAS_COMBINE
|
# if GTEST_HAS_COMBINE
|
||||||
using ::testing::Combine;
|
using ::testing::Combine;
|
||||||
using ::std::tr1::get;
|
using ::std::tr1::get;
|
||||||
using ::std::tr1::make_tuple;
|
using ::std::tr1::make_tuple;
|
||||||
using ::std::tr1::tuple;
|
using ::std::tr1::tuple;
|
||||||
#endif // GTEST_HAS_COMBINE
|
# endif // GTEST_HAS_COMBINE
|
||||||
|
|
||||||
using ::testing::internal::ParamGenerator;
|
using ::testing::internal::ParamGenerator;
|
||||||
using ::testing::internal::UnitTestOptions;
|
using ::testing::internal::UnitTestOptions;
|
||||||
@ -85,7 +85,7 @@ template <typename T>
|
|||||||
return stream.str();
|
return stream.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_HAS_COMBINE
|
# if GTEST_HAS_COMBINE
|
||||||
|
|
||||||
// These overloads allow printing tuples in our tests. We cannot
|
// These overloads allow printing tuples in our tests. We cannot
|
||||||
// define an operator<< for tuples, as that definition needs to be in
|
// define an operator<< for tuples, as that definition needs to be in
|
||||||
@ -121,7 +121,7 @@ template <typename T1, typename T2, typename T3, typename T4, typename T5,
|
|||||||
return stream.str();
|
return stream.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // GTEST_HAS_COMBINE
|
# endif // GTEST_HAS_COMBINE
|
||||||
|
|
||||||
// Verifies that a sequence generated by the generator and accessed
|
// Verifies that a sequence generated by the generator and accessed
|
||||||
// via the iterator object matches the expected one using Google Test
|
// via the iterator object matches the expected one using Google Test
|
||||||
@ -457,7 +457,7 @@ TEST(BoolTest, BoolWorks) {
|
|||||||
VerifyGenerator(gen, expected_values);
|
VerifyGenerator(gen, expected_values);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_HAS_COMBINE
|
# if GTEST_HAS_COMBINE
|
||||||
|
|
||||||
// Tests that Combine() with two parameters generates the expected sequence.
|
// Tests that Combine() with two parameters generates the expected sequence.
|
||||||
TEST(CombineTest, CombineWithTwoParameters) {
|
TEST(CombineTest, CombineWithTwoParameters) {
|
||||||
@ -542,7 +542,7 @@ TEST(CombineTest, CombineWithMaxNumberOfParameters) {
|
|||||||
VerifyGenerator(gen, expected_values);
|
VerifyGenerator(gen, expected_values);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // GTEST_HAS_COMBINE
|
# endif // GTEST_HAS_COMBINE
|
||||||
|
|
||||||
// Tests that an generator produces correct sequence after being
|
// Tests that an generator produces correct sequence after being
|
||||||
// assigned from another generator.
|
// assigned from another generator.
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#if GTEST_OS_MAC
|
#if GTEST_OS_MAC
|
||||||
#include <time.h>
|
# include <time.h>
|
||||||
#endif // GTEST_OS_MAC
|
#endif // GTEST_OS_MAC
|
||||||
|
|
||||||
#include <utility> // For std::pair and std::make_pair.
|
#include <utility> // For std::pair and std::make_pair.
|
||||||
@ -328,15 +328,19 @@ TEST(GtestCheckDeathTest, LivesSilentlyOnSuccess) {
|
|||||||
// For simplicity, we only cover the most important platforms here.
|
// For simplicity, we only cover the most important platforms here.
|
||||||
TEST(RegexEngineSelectionTest, SelectsCorrectRegexEngine) {
|
TEST(RegexEngineSelectionTest, SelectsCorrectRegexEngine) {
|
||||||
#if GTEST_HAS_POSIX_RE
|
#if GTEST_HAS_POSIX_RE
|
||||||
|
|
||||||
EXPECT_TRUE(GTEST_USES_POSIX_RE);
|
EXPECT_TRUE(GTEST_USES_POSIX_RE);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
EXPECT_TRUE(GTEST_USES_SIMPLE_RE);
|
EXPECT_TRUE(GTEST_USES_SIMPLE_RE);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_USES_POSIX_RE
|
#if GTEST_USES_POSIX_RE
|
||||||
|
|
||||||
#if GTEST_HAS_TYPED_TEST
|
# if GTEST_HAS_TYPED_TEST
|
||||||
|
|
||||||
template <typename Str>
|
template <typename Str>
|
||||||
class RETest : public ::testing::Test {};
|
class RETest : public ::testing::Test {};
|
||||||
@ -345,9 +349,9 @@ class RETest : public ::testing::Test {};
|
|||||||
// supports.
|
// supports.
|
||||||
typedef testing::Types<
|
typedef testing::Types<
|
||||||
::std::string,
|
::std::string,
|
||||||
#if GTEST_HAS_GLOBAL_STRING
|
# if GTEST_HAS_GLOBAL_STRING
|
||||||
::string,
|
::string,
|
||||||
#endif // GTEST_HAS_GLOBAL_STRING
|
# endif // GTEST_HAS_GLOBAL_STRING
|
||||||
const char*> StringTypes;
|
const char*> StringTypes;
|
||||||
|
|
||||||
TYPED_TEST_CASE(RETest, StringTypes);
|
TYPED_TEST_CASE(RETest, StringTypes);
|
||||||
@ -398,7 +402,7 @@ TYPED_TEST(RETest, PartialMatchWorks) {
|
|||||||
EXPECT_FALSE(RE::PartialMatch(TypeParam("zza"), re));
|
EXPECT_FALSE(RE::PartialMatch(TypeParam("zza"), re));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // GTEST_HAS_TYPED_TEST
|
# endif // GTEST_HAS_TYPED_TEST
|
||||||
|
|
||||||
#elif GTEST_USES_SIMPLE_RE
|
#elif GTEST_USES_SIMPLE_RE
|
||||||
|
|
||||||
|
@ -52,10 +52,10 @@
|
|||||||
|
|
||||||
// hash_map and hash_set are available under Visual C++.
|
// hash_map and hash_set are available under Visual C++.
|
||||||
#if _MSC_VER
|
#if _MSC_VER
|
||||||
#define GTEST_HAS_HASH_MAP_ 1 // Indicates that hash_map is available.
|
# define GTEST_HAS_HASH_MAP_ 1 // Indicates that hash_map is available.
|
||||||
#include <hash_map> // NOLINT
|
# include <hash_map> // NOLINT
|
||||||
#define GTEST_HAS_HASH_SET_ 1 // Indicates that hash_set is available.
|
# define GTEST_HAS_HASH_SET_ 1 // Indicates that hash_set is available.
|
||||||
#include <hash_set> // NOLINT
|
# include <hash_set> // NOLINT
|
||||||
#endif // GTEST_OS_WINDOWS
|
#endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
// Some user-defined types for testing the universal value printer.
|
// Some user-defined types for testing the universal value printer.
|
||||||
|
@ -42,8 +42,8 @@
|
|||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS
|
#if GTEST_OS_WINDOWS
|
||||||
#include <windows.h>
|
# include <windows.h>
|
||||||
#include <stdlib.h>
|
# include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -69,7 +69,8 @@ int main(int argc, char **argv) {
|
|||||||
// a general protection fault (segment violation).
|
// a general protection fault (segment violation).
|
||||||
SetErrorMode(SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS);
|
SetErrorMode(SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS);
|
||||||
|
|
||||||
#if GTEST_HAS_SEH && !GTEST_OS_WINDOWS_MOBILE
|
# if GTEST_HAS_SEH && !GTEST_OS_WINDOWS_MOBILE
|
||||||
|
|
||||||
// The default unhandled exception filter does not always exit
|
// The default unhandled exception filter does not always exit
|
||||||
// with the exception code as exit code - for example it exits with
|
// with the exception code as exit code - for example it exits with
|
||||||
// 0 for EXCEPTION_ACCESS_VIOLATION and 1 for EXCEPTION_BREAKPOINT
|
// 0 for EXCEPTION_ACCESS_VIOLATION and 1 for EXCEPTION_BREAKPOINT
|
||||||
@ -77,7 +78,8 @@ int main(int argc, char **argv) {
|
|||||||
// filter which always exits with the exception code for unhandled
|
// filter which always exits with the exception code for unhandled
|
||||||
// exceptions.
|
// exceptions.
|
||||||
SetUnhandledExceptionFilter(ExitWithExceptionCode);
|
SetUnhandledExceptionFilter(ExitWithExceptionCode);
|
||||||
#endif
|
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
testing::InitGoogleTest(&argc, argv);
|
testing::InitGoogleTest(&argc, argv);
|
||||||
|
@ -38,12 +38,12 @@
|
|||||||
#include <stdlib.h> // For exit().
|
#include <stdlib.h> // For exit().
|
||||||
|
|
||||||
#if GTEST_HAS_SEH
|
#if GTEST_HAS_SEH
|
||||||
#include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GTEST_HAS_EXCEPTIONS
|
#if GTEST_HAS_EXCEPTIONS
|
||||||
#include <exception> // For set_terminate().
|
# include <exception> // For set_terminate().
|
||||||
#include <stdexcept>
|
# include <stdexcept>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using testing::Test;
|
using testing::Test;
|
||||||
|
@ -788,7 +788,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(Unsigned, TypedTestP, UnsignedTypes);
|
|||||||
TEST(ADeathTest, ShouldRunFirst) {
|
TEST(ADeathTest, ShouldRunFirst) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_HAS_TYPED_TEST
|
# if GTEST_HAS_TYPED_TEST
|
||||||
|
|
||||||
// We rely on the golden file to verify that typed tests whose test
|
// We rely on the golden file to verify that typed tests whose test
|
||||||
// case name ends with DeathTest are run first.
|
// case name ends with DeathTest are run first.
|
||||||
@ -803,9 +803,9 @@ TYPED_TEST_CASE(ATypedDeathTest, NumericTypes);
|
|||||||
TYPED_TEST(ATypedDeathTest, ShouldRunFirst) {
|
TYPED_TEST(ATypedDeathTest, ShouldRunFirst) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // GTEST_HAS_TYPED_TEST
|
# endif // GTEST_HAS_TYPED_TEST
|
||||||
|
|
||||||
#if GTEST_HAS_TYPED_TEST_P
|
# if GTEST_HAS_TYPED_TEST_P
|
||||||
|
|
||||||
|
|
||||||
// We rely on the golden file to verify that type-parameterized tests
|
// We rely on the golden file to verify that type-parameterized tests
|
||||||
@ -824,7 +824,7 @@ REGISTER_TYPED_TEST_CASE_P(ATypeParamDeathTest, ShouldRunFirst);
|
|||||||
|
|
||||||
INSTANTIATE_TYPED_TEST_CASE_P(My, ATypeParamDeathTest, NumericTypes);
|
INSTANTIATE_TYPED_TEST_CASE_P(My, ATypeParamDeathTest, NumericTypes);
|
||||||
|
|
||||||
#endif // GTEST_HAS_TYPED_TEST_P
|
# endif // GTEST_HAS_TYPED_TEST_P
|
||||||
|
|
||||||
#endif // GTEST_HAS_DEATH_TEST
|
#endif // GTEST_HAS_DEATH_TEST
|
||||||
|
|
||||||
@ -998,11 +998,11 @@ int main(int argc, char **argv) {
|
|||||||
if (testing::internal::GTEST_FLAG(internal_run_death_test) != "") {
|
if (testing::internal::GTEST_FLAG(internal_run_death_test) != "") {
|
||||||
// Skip the usual output capturing if we're running as the child
|
// Skip the usual output capturing if we're running as the child
|
||||||
// process of an threadsafe-style death test.
|
// process of an threadsafe-style death test.
|
||||||
#if GTEST_OS_WINDOWS
|
# if GTEST_OS_WINDOWS
|
||||||
posix::FReopen("nul:", "w", stdout);
|
posix::FReopen("nul:", "w", stdout);
|
||||||
#else
|
# else
|
||||||
posix::FReopen("/dev/null", "w", stdout);
|
posix::FReopen("/dev/null", "w", stdout);
|
||||||
#endif // GTEST_OS_WINDOWS
|
# endif // GTEST_OS_WINDOWS
|
||||||
return RUN_ALL_TESTS();
|
return RUN_ALL_TESTS();
|
||||||
}
|
}
|
||||||
#endif // GTEST_HAS_DEATH_TEST
|
#endif // GTEST_HAS_DEATH_TEST
|
||||||
|
@ -310,10 +310,10 @@ TEST(FormatTimeInMillisAsSecondsTest, FormatsNegativeNumber) {
|
|||||||
|
|
||||||
#if GTEST_CAN_COMPARE_NULL
|
#if GTEST_CAN_COMPARE_NULL
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
# ifdef __BORLANDC__
|
||||||
// Silences warnings: "Condition is always true", "Unreachable code"
|
// Silences warnings: "Condition is always true", "Unreachable code"
|
||||||
#pragma option push -w-ccc -w-rch
|
# pragma option push -w-ccc -w-rch
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
// Tests that GTEST_IS_NULL_LITERAL_(x) is true when x is a null
|
// Tests that GTEST_IS_NULL_LITERAL_(x) is true when x is a null
|
||||||
// pointer literal.
|
// pointer literal.
|
||||||
@ -322,12 +322,15 @@ TEST(NullLiteralTest, IsTrueForNullLiterals) {
|
|||||||
EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0));
|
EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0));
|
||||||
EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0U));
|
EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0U));
|
||||||
EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0L));
|
EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(0L));
|
||||||
#ifndef __BORLANDC__
|
|
||||||
|
# ifndef __BORLANDC__
|
||||||
|
|
||||||
// Some compilers may fail to detect some null pointer literals;
|
// Some compilers may fail to detect some null pointer literals;
|
||||||
// as long as users of the framework don't use such literals, this
|
// as long as users of the framework don't use such literals, this
|
||||||
// is harmless.
|
// is harmless.
|
||||||
EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(1 - 1));
|
EXPECT_TRUE(GTEST_IS_NULL_LITERAL_(1 - 1));
|
||||||
#endif
|
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tests that GTEST_IS_NULL_LITERAL_(x) is false when x is not a null
|
// Tests that GTEST_IS_NULL_LITERAL_(x) is false when x is not a null
|
||||||
@ -339,10 +342,10 @@ TEST(NullLiteralTest, IsFalseForNonNullLiterals) {
|
|||||||
EXPECT_FALSE(GTEST_IS_NULL_LITERAL_(static_cast<void*>(NULL)));
|
EXPECT_FALSE(GTEST_IS_NULL_LITERAL_(static_cast<void*>(NULL)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
# ifdef __BORLANDC__
|
||||||
// Restores warnings after previous "#pragma option push" suppressed them.
|
// Restores warnings after previous "#pragma option push" suppressed them.
|
||||||
#pragma option pop
|
# pragma option pop
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
#endif // GTEST_CAN_COMPARE_NULL
|
#endif // GTEST_CAN_COMPARE_NULL
|
||||||
//
|
//
|
||||||
@ -1211,7 +1214,7 @@ TEST(StringTest, ShowWideCStringQuoted) {
|
|||||||
String::ShowWideCStringQuoted(L"foo").c_str());
|
String::ShowWideCStringQuoted(L"foo").c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GTEST_OS_WINDOWS_MOBILE
|
# if GTEST_OS_WINDOWS_MOBILE
|
||||||
TEST(StringTest, AnsiAndUtf16Null) {
|
TEST(StringTest, AnsiAndUtf16Null) {
|
||||||
EXPECT_EQ(NULL, String::AnsiToUtf16(NULL));
|
EXPECT_EQ(NULL, String::AnsiToUtf16(NULL));
|
||||||
EXPECT_EQ(NULL, String::Utf16ToAnsi(NULL));
|
EXPECT_EQ(NULL, String::Utf16ToAnsi(NULL));
|
||||||
@ -1234,7 +1237,7 @@ TEST(StringTest, AnsiAndUtf16ConvertPathChars) {
|
|||||||
EXPECT_EQ(0, wcsncmp(L".:\\ \"*?", utf16, 3));
|
EXPECT_EQ(0, wcsncmp(L".:\\ \"*?", utf16, 3));
|
||||||
delete [] utf16;
|
delete [] utf16;
|
||||||
}
|
}
|
||||||
#endif // GTEST_OS_WINDOWS_MOBILE
|
# endif // GTEST_OS_WINDOWS_MOBILE
|
||||||
|
|
||||||
#endif // GTEST_OS_WINDOWS
|
#endif // GTEST_OS_WINDOWS
|
||||||
|
|
||||||
@ -1368,7 +1371,7 @@ TEST_F(ExpectFatalFailureTest, CatchesFatalFailureOnAllThreads) {
|
|||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
// Silences warnings: "Condition is always true"
|
// Silences warnings: "Condition is always true"
|
||||||
#pragma option push -w-ccc
|
# pragma option push -w-ccc
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Tests that EXPECT_FATAL_FAILURE() can be used in a non-void
|
// Tests that EXPECT_FATAL_FAILURE() can be used in a non-void
|
||||||
@ -1396,7 +1399,7 @@ void DoesNotAbortHelper(bool* aborted) {
|
|||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
// Restores warnings after previous "#pragma option push" suppressed them.
|
// Restores warnings after previous "#pragma option push" suppressed them.
|
||||||
#pragma option pop
|
# pragma option pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TEST_F(ExpectFatalFailureTest, DoesNotAbort) {
|
TEST_F(ExpectFatalFailureTest, DoesNotAbort) {
|
||||||
@ -3534,7 +3537,7 @@ TEST(AssertionTest, AppendUserMessage) {
|
|||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
// Silences warnings: "Condition is always true", "Unreachable code"
|
// Silences warnings: "Condition is always true", "Unreachable code"
|
||||||
#pragma option push -w-ccc -w-rch
|
# pragma option push -w-ccc -w-rch
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Tests ASSERT_TRUE.
|
// Tests ASSERT_TRUE.
|
||||||
@ -3589,7 +3592,7 @@ TEST(AssertionTest, AssertFalseWithAssertionResult) {
|
|||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
// Restores warnings after previous "#pragma option push" supressed them
|
// Restores warnings after previous "#pragma option push" supressed them
|
||||||
#pragma option pop
|
# pragma option pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Tests using ASSERT_EQ on double values. The purpose is to make
|
// Tests using ASSERT_EQ on double values. The purpose is to make
|
||||||
@ -3692,13 +3695,14 @@ void ThrowNothing() {}
|
|||||||
TEST(AssertionTest, ASSERT_THROW) {
|
TEST(AssertionTest, ASSERT_THROW) {
|
||||||
ASSERT_THROW(ThrowAnInteger(), int);
|
ASSERT_THROW(ThrowAnInteger(), int);
|
||||||
|
|
||||||
#ifndef __BORLANDC__
|
# ifndef __BORLANDC__
|
||||||
|
|
||||||
// ICE's in C++Builder 2007 and 2009.
|
// ICE's in C++Builder 2007 and 2009.
|
||||||
EXPECT_FATAL_FAILURE(
|
EXPECT_FATAL_FAILURE(
|
||||||
ASSERT_THROW(ThrowAnInteger(), bool),
|
ASSERT_THROW(ThrowAnInteger(), bool),
|
||||||
"Expected: ThrowAnInteger() throws an exception of type bool.\n"
|
"Expected: ThrowAnInteger() throws an exception of type bool.\n"
|
||||||
" Actual: it throws a different type.");
|
" Actual: it throws a different type.");
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
EXPECT_FATAL_FAILURE(
|
EXPECT_FATAL_FAILURE(
|
||||||
ASSERT_THROW(ThrowNothing(), bool),
|
ASSERT_THROW(ThrowNothing(), bool),
|
||||||
@ -3826,7 +3830,9 @@ TEST(AssertionTest, NamedEnum) {
|
|||||||
// Tests using assertions with anonymous enums.
|
// Tests using assertions with anonymous enums.
|
||||||
enum {
|
enum {
|
||||||
kCaseA = -1,
|
kCaseA = -1,
|
||||||
#if GTEST_OS_LINUX
|
|
||||||
|
# if GTEST_OS_LINUX
|
||||||
|
|
||||||
// We want to test the case where the size of the anonymous enum is
|
// We want to test the case where the size of the anonymous enum is
|
||||||
// larger than sizeof(int), to make sure our implementation of the
|
// larger than sizeof(int), to make sure our implementation of the
|
||||||
// assertions doesn't truncate the enums. However, MSVC
|
// assertions doesn't truncate the enums. However, MSVC
|
||||||
@ -3837,16 +3843,22 @@ enum {
|
|||||||
// int size. We want to test whether this will confuse the
|
// int size. We want to test whether this will confuse the
|
||||||
// assertions.
|
// assertions.
|
||||||
kCaseB = testing::internal::kMaxBiggestInt,
|
kCaseB = testing::internal::kMaxBiggestInt,
|
||||||
#else
|
|
||||||
|
# else
|
||||||
|
|
||||||
kCaseB = INT_MAX,
|
kCaseB = INT_MAX,
|
||||||
#endif // GTEST_OS_LINUX
|
|
||||||
|
# endif // GTEST_OS_LINUX
|
||||||
|
|
||||||
kCaseC = 42,
|
kCaseC = 42,
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST(AssertionTest, AnonymousEnum) {
|
TEST(AssertionTest, AnonymousEnum) {
|
||||||
#if GTEST_OS_LINUX
|
# if GTEST_OS_LINUX
|
||||||
|
|
||||||
EXPECT_EQ(static_cast<int>(kCaseA), static_cast<int>(kCaseB));
|
EXPECT_EQ(static_cast<int>(kCaseA), static_cast<int>(kCaseB));
|
||||||
#endif // GTEST_OS_LINUX
|
|
||||||
|
# endif // GTEST_OS_LINUX
|
||||||
|
|
||||||
EXPECT_EQ(kCaseA, kCaseA);
|
EXPECT_EQ(kCaseA, kCaseA);
|
||||||
EXPECT_NE(kCaseA, kCaseB);
|
EXPECT_NE(kCaseA, kCaseB);
|
||||||
@ -3925,12 +3937,14 @@ TEST(HRESULTAssertionTest, EXPECT_HRESULT_FAILED) {
|
|||||||
TEST(HRESULTAssertionTest, ASSERT_HRESULT_FAILED) {
|
TEST(HRESULTAssertionTest, ASSERT_HRESULT_FAILED) {
|
||||||
ASSERT_HRESULT_FAILED(E_UNEXPECTED);
|
ASSERT_HRESULT_FAILED(E_UNEXPECTED);
|
||||||
|
|
||||||
#ifndef __BORLANDC__
|
# ifndef __BORLANDC__
|
||||||
|
|
||||||
// ICE's in C++Builder 2007 and 2009.
|
// ICE's in C++Builder 2007 and 2009.
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_HRESULT_FAILED(OkHRESULTSuccess()),
|
EXPECT_FATAL_FAILURE(ASSERT_HRESULT_FAILED(OkHRESULTSuccess()),
|
||||||
"Expected: (OkHRESULTSuccess()) fails.\n"
|
"Expected: (OkHRESULTSuccess()) fails.\n"
|
||||||
" Actual: 0x00000000");
|
" Actual: 0x00000000");
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
EXPECT_FATAL_FAILURE(ASSERT_HRESULT_FAILED(FalseHRESULTSuccess()),
|
EXPECT_FATAL_FAILURE(ASSERT_HRESULT_FAILED(FalseHRESULTSuccess()),
|
||||||
"Expected: (FalseHRESULTSuccess()) fails.\n"
|
"Expected: (FalseHRESULTSuccess()) fails.\n"
|
||||||
" Actual: 0x00000001");
|
" Actual: 0x00000001");
|
||||||
@ -3947,12 +3961,13 @@ TEST(HRESULTAssertionTest, Streaming) {
|
|||||||
EXPECT_HRESULT_SUCCEEDED(E_UNEXPECTED) << "expected failure",
|
EXPECT_HRESULT_SUCCEEDED(E_UNEXPECTED) << "expected failure",
|
||||||
"expected failure");
|
"expected failure");
|
||||||
|
|
||||||
#ifndef __BORLANDC__
|
# ifndef __BORLANDC__
|
||||||
|
|
||||||
// ICE's in C++Builder 2007 and 2009.
|
// ICE's in C++Builder 2007 and 2009.
|
||||||
EXPECT_FATAL_FAILURE(
|
EXPECT_FATAL_FAILURE(
|
||||||
ASSERT_HRESULT_SUCCEEDED(E_UNEXPECTED) << "expected failure",
|
ASSERT_HRESULT_SUCCEEDED(E_UNEXPECTED) << "expected failure",
|
||||||
"expected failure");
|
"expected failure");
|
||||||
#endif
|
# endif
|
||||||
|
|
||||||
EXPECT_NONFATAL_FAILURE(
|
EXPECT_NONFATAL_FAILURE(
|
||||||
EXPECT_HRESULT_FAILED(S_OK) << "expected failure",
|
EXPECT_HRESULT_FAILED(S_OK) << "expected failure",
|
||||||
@ -3967,7 +3982,7 @@ TEST(HRESULTAssertionTest, Streaming) {
|
|||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
// Silences warnings: "Condition is always true", "Unreachable code"
|
// Silences warnings: "Condition is always true", "Unreachable code"
|
||||||
#pragma option push -w-ccc -w-rch
|
# pragma option push -w-ccc -w-rch
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Tests that the assertion macros behave like single statements.
|
// Tests that the assertion macros behave like single statements.
|
||||||
@ -4188,7 +4203,7 @@ TEST(ExpectTest, ExpectFalseWithAssertionResult) {
|
|||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
// Restores warnings after previous "#pragma option push" supressed them
|
// Restores warnings after previous "#pragma option push" supressed them
|
||||||
#pragma option pop
|
# pragma option pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Tests EXPECT_EQ.
|
// Tests EXPECT_EQ.
|
||||||
@ -5426,6 +5441,7 @@ class InitGoogleTestTest : public Test {
|
|||||||
|
|
||||||
// This macro wraps TestParsingFlags s.t. the user doesn't need
|
// This macro wraps TestParsingFlags s.t. the user doesn't need
|
||||||
// to specify the array sizes.
|
// to specify the array sizes.
|
||||||
|
|
||||||
#define GTEST_TEST_PARSING_FLAGS_(argv1, argv2, expected, should_print_help) \
|
#define GTEST_TEST_PARSING_FLAGS_(argv1, argv2, expected, should_print_help) \
|
||||||
TestParsingFlags(sizeof(argv1)/sizeof(*argv1) - 1, argv1, \
|
TestParsingFlags(sizeof(argv1)/sizeof(*argv1) - 1, argv1, \
|
||||||
sizeof(argv2)/sizeof(*argv2) - 1, argv2, \
|
sizeof(argv2)/sizeof(*argv2) - 1, argv2, \
|
||||||
@ -6239,7 +6255,7 @@ TEST(StreamingAssertionsTest, Unconditional) {
|
|||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
// Silences warnings: "Condition is always true", "Unreachable code"
|
// Silences warnings: "Condition is always true", "Unreachable code"
|
||||||
#pragma option push -w-ccc -w-rch
|
# pragma option push -w-ccc -w-rch
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TEST(StreamingAssertionsTest, Truth) {
|
TEST(StreamingAssertionsTest, Truth) {
|
||||||
@ -6262,7 +6278,7 @@ TEST(StreamingAssertionsTest, Truth2) {
|
|||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
// Restores warnings after previous "#pragma option push" supressed them
|
// Restores warnings after previous "#pragma option push" supressed them
|
||||||
#pragma option pop
|
# pragma option pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TEST(StreamingAssertionsTest, IntegerEquals) {
|
TEST(StreamingAssertionsTest, IntegerEquals) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user