Cleans up macro definitions.
This commit is contained in:
@@ -49,7 +49,7 @@ namespace testing {
|
||||
// after forking.
|
||||
GTEST_DECLARE_string_(death_test_style);
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
// The following macros are useful for writing death tests.
|
||||
|
||||
|
||||
@@ -102,7 +102,7 @@ class Message {
|
||||
}
|
||||
|
||||
~Message() { delete ss_; }
|
||||
#ifdef GTEST_OS_SYMBIAN
|
||||
#if GTEST_OS_SYMBIAN
|
||||
// Streams a value (either a pointer or not) to this object.
|
||||
template <typename T>
|
||||
inline Message& operator <<(const T& value) {
|
||||
@@ -187,7 +187,7 @@ class Message {
|
||||
}
|
||||
|
||||
private:
|
||||
#ifdef GTEST_OS_SYMBIAN
|
||||
#if GTEST_OS_SYMBIAN
|
||||
// These are needed as the Nokia Symbian Compiler cannot decide between
|
||||
// const T& and const T* in a function template. The Nokia compiler _can_
|
||||
// decide between class template specializations for T and T*, so a
|
||||
|
||||
@@ -151,7 +151,7 @@ INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
|
||||
|
||||
#include <gtest/internal/gtest-port.h>
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
|
||||
#include <gtest/internal/gtest-internal.h>
|
||||
#include <gtest/internal/gtest-param-util.h>
|
||||
@@ -1185,7 +1185,7 @@ inline internal::ParamGenerator<bool> Bool() {
|
||||
return Values(false, true);
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_COMBINE
|
||||
#if GTEST_HAS_COMBINE
|
||||
// Combine() allows the user to combine two or more sequences to produce
|
||||
// values of a Cartesian product of those sequences' elements.
|
||||
//
|
||||
|
||||
@@ -152,7 +152,7 @@ INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
|
||||
|
||||
#include <gtest/internal/gtest-port.h>
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
|
||||
#include <gtest/internal/gtest-internal.h>
|
||||
#include <gtest/internal/gtest-param-util.h>
|
||||
@@ -344,7 +344,7 @@ inline internal::ParamGenerator<bool> Bool() {
|
||||
return Values(false, true);
|
||||
}
|
||||
|
||||
#ifdef GTEST_HAS_COMBINE
|
||||
#if GTEST_HAS_COMBINE
|
||||
// Combine() allows the user to combine two or more sequences to produce
|
||||
// values of a Cartesian product of those sequences' elements.
|
||||
//
|
||||
|
||||
@@ -151,7 +151,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
|
||||
|
||||
// Implements typed tests.
|
||||
|
||||
#ifdef GTEST_HAS_TYPED_TEST
|
||||
#if GTEST_HAS_TYPED_TEST
|
||||
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
||||
//
|
||||
@@ -186,7 +186,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
|
||||
|
||||
// Implements type-parameterized tests.
|
||||
|
||||
#ifdef GTEST_HAS_TYPED_TEST_P
|
||||
#if GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
||||
//
|
||||
|
||||
@@ -390,7 +390,7 @@ class TestInfo {
|
||||
// Returns the result of the test.
|
||||
const internal::TestResult* result() const;
|
||||
private:
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
friend class internal::DefaultDeathTestFactory;
|
||||
#endif // GTEST_HAS_DEATH_TEST
|
||||
friend class internal::TestInfoImpl;
|
||||
@@ -521,7 +521,7 @@ class UnitTest {
|
||||
// or NULL if no test is running.
|
||||
const TestInfo* current_test_info() const;
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
// Returns the ParameterizedTestCaseRegistry object used to keep track of
|
||||
// value-parameterized tests and instantiate and register them.
|
||||
internal::ParameterizedTestCaseRegistry& parameterized_test_registry();
|
||||
@@ -940,7 +940,7 @@ class AssertHelper {
|
||||
|
||||
} // namespace internal
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
// The abstract base class that all value-parameterized tests inherit from.
|
||||
//
|
||||
// This class adds support for accessing the test parameter value via
|
||||
@@ -1234,7 +1234,7 @@ AssertionResult DoubleLE(const char* expr1, const char* expr2,
|
||||
double val1, double val2);
|
||||
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
|
||||
// Macros that test for HRESULT failure and success, these are only useful
|
||||
// on Windows, and rely on Windows SDK macros and APIs to compile.
|
||||
|
||||
@@ -49,7 +49,7 @@ const char kDeathTestStyleFlag[] = "death_test_style";
|
||||
const char kDeathTestUseFork[] = "death_test_use_fork";
|
||||
const char kInternalRunDeathTestFlag[] = "internal_run_death_test";
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
// DeathTest is a class that hides much of the complexity of the
|
||||
// GTEST_DEATH_TEST_ macro. It is abstract; its static Create method
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
#include <gtest/internal/gtest-port.h>
|
||||
|
||||
#ifdef GTEST_OS_LINUX
|
||||
#if GTEST_OS_LINUX
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
@@ -546,7 +546,7 @@ class TestFactoryImpl : public TestFactoryBase {
|
||||
virtual Test* CreateTest() { return new TestClass; }
|
||||
};
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
|
||||
// Predicate-formatters for implementing the HRESULT checking macros
|
||||
// {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}
|
||||
@@ -600,7 +600,7 @@ TestInfo* MakeAndRegisterTestInfo(
|
||||
TearDownTestCaseFunc tear_down_tc,
|
||||
TestFactoryBase* factory);
|
||||
|
||||
#if defined(GTEST_HAS_TYPED_TEST) || defined(GTEST_HAS_TYPED_TEST_P)
|
||||
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
// State of the definition of a type-parameterized test case.
|
||||
class TypedTestCasePState {
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
#include <gtest/internal/gtest-port.h>
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
|
||||
#include <gtest/internal/gtest-param-util.h>
|
||||
|
||||
@@ -2659,7 +2659,7 @@ class ValueArray50 {
|
||||
const T50 v50_;
|
||||
};
|
||||
|
||||
#ifdef GTEST_HAS_COMBINE
|
||||
#if GTEST_HAS_COMBINE
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
||||
//
|
||||
// Generates values from the Cartesian product of values produced
|
||||
|
||||
@@ -47,7 +47,7 @@ $var maxtuple = 10 $$ Maximum number of Combine arguments we want to support.
|
||||
|
||||
#include <gtest/internal/gtest-port.h>
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
|
||||
#include <gtest/internal/gtest-param-util.h>
|
||||
|
||||
@@ -92,7 +92,7 @@ $for j [[
|
||||
|
||||
]]
|
||||
|
||||
#ifdef GTEST_HAS_COMBINE
|
||||
#if GTEST_HAS_COMBINE
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
||||
//
|
||||
// Generates values from the Cartesian product of values produced
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
#include <gtest/internal/gtest-port.h>
|
||||
|
||||
#ifdef GTEST_HAS_PARAM_TEST
|
||||
#if GTEST_HAS_PARAM_TEST
|
||||
|
||||
#if GTEST_HAS_RTTI
|
||||
#include <typeinfo>
|
||||
|
||||
@@ -63,21 +63,15 @@
|
||||
|
||||
// This header defines the following utilities:
|
||||
//
|
||||
// Macros indicating the name of the Google C++ Testing Framework project:
|
||||
// GTEST_NAME - a string literal of the project name.
|
||||
// GTEST_FLAG_PREFIX - a string literal of the prefix all Google
|
||||
// Test flag names share.
|
||||
// GTEST_FLAG_PREFIX_UPPER - a string literal of the prefix all Google
|
||||
// Test flag names share, in upper case.
|
||||
//
|
||||
// Macros indicating the current platform:
|
||||
// GTEST_OS_CYGWIN - defined iff compiled on Cygwin.
|
||||
// GTEST_OS_LINUX - defined iff compiled on Linux.
|
||||
// GTEST_OS_MAC - defined iff compiled on Mac OS X.
|
||||
// GTEST_OS_SOLARIS - defined iff compiled on Sun Solaris.
|
||||
// GTEST_OS_SYMBIAN - defined iff compiled for Symbian.
|
||||
// GTEST_OS_WINDOWS - defined iff compiled on Windows.
|
||||
// GTEST_OS_ZOS - defined iff compiled on IBM z/OS.
|
||||
// Macros indicating the current platform (defined to 1 if compiled on
|
||||
// the given platform; otherwise undefined):
|
||||
// GTEST_OS_CYGWIN - Cygwin
|
||||
// GTEST_OS_LINUX - Linux
|
||||
// GTEST_OS_MAC - Mac OS X
|
||||
// GTEST_OS_SOLARIS - Sun Solaris
|
||||
// GTEST_OS_SYMBIAN - Symbian
|
||||
// GTEST_OS_WINDOWS - Windows
|
||||
// GTEST_OS_ZOS - z/OS
|
||||
//
|
||||
// Among the platforms, Cygwin, Linux, Max OS X, and Windows have the
|
||||
// most stable support. Since core members of the Google Test project
|
||||
@@ -86,19 +80,18 @@
|
||||
// googletestframework@googlegroups.com (patches for fixing them are
|
||||
// even more welcome!).
|
||||
//
|
||||
// Note that it is possible that none of the GTEST_OS_ macros are defined.
|
||||
// Note that it is possible that none of the GTEST_OS_* macros are defined.
|
||||
//
|
||||
// Macros indicating available Google Test features:
|
||||
// GTEST_HAS_COMBINE - defined iff Combine construct is supported
|
||||
// in value-parameterized tests.
|
||||
// GTEST_HAS_DEATH_TEST - defined iff death tests are supported.
|
||||
// GTEST_HAS_PARAM_TEST - defined iff value-parameterized tests are
|
||||
// supported.
|
||||
// GTEST_HAS_TYPED_TEST - defined iff typed tests are supported.
|
||||
// GTEST_HAS_TYPED_TEST_P - defined iff type-parameterized tests are
|
||||
// supported.
|
||||
// GTEST_USES_POSIX_RE - defined iff enhanced POSIX regex is used.
|
||||
// GTEST_USES_SIMPLE_RE - defined iff our own simple regex is used;
|
||||
// Macros indicating available Google Test features (defined to 1 if
|
||||
// the corresponding feature is supported; otherwise undefined):
|
||||
// GTEST_HAS_COMBINE - the Combine() function (for value-parameterized
|
||||
// tests)
|
||||
// GTEST_HAS_DEATH_TEST - death tests
|
||||
// GTEST_HAS_PARAM_TEST - value-parameterized tests
|
||||
// GTEST_HAS_TYPED_TEST - typed tests
|
||||
// GTEST_HAS_TYPED_TEST_P - type-parameterized tests
|
||||
// GTEST_USES_POSIX_RE - enhanced POSIX regex is used.
|
||||
// GTEST_USES_SIMPLE_RE - our own simple regex is used;
|
||||
// the above two are mutually exclusive.
|
||||
//
|
||||
// Macros for basic C++ coding:
|
||||
@@ -158,9 +151,9 @@
|
||||
#include <stdio.h>
|
||||
#include <iostream> // Used for GTEST_CHECK_
|
||||
|
||||
#define GTEST_NAME "Google Test"
|
||||
#define GTEST_FLAG_PREFIX "gtest_"
|
||||
#define GTEST_FLAG_PREFIX_UPPER "GTEST_"
|
||||
#define GTEST_NAME_ "Google Test"
|
||||
#define GTEST_FLAG_PREFIX_ "gtest_"
|
||||
#define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
|
||||
|
||||
// Determines the version of gcc that is used to compile this.
|
||||
#ifdef __GNUC__
|
||||
@@ -171,26 +164,26 @@
|
||||
|
||||
// Determines the platform on which Google Test is compiled.
|
||||
#ifdef __CYGWIN__
|
||||
#define GTEST_OS_CYGWIN
|
||||
#define GTEST_OS_CYGWIN 1
|
||||
#elif __SYMBIAN32__
|
||||
#define GTEST_OS_SYMBIAN
|
||||
#define GTEST_OS_SYMBIAN 1
|
||||
#elif defined _MSC_VER
|
||||
// TODO(kenton@google.com): GTEST_OS_WINDOWS is currently used to mean
|
||||
// both "The OS is Windows" and "The compiler is MSVC". These
|
||||
// meanings really should be separated in order to better support
|
||||
// Windows compilers other than MSVC.
|
||||
#define GTEST_OS_WINDOWS
|
||||
#define GTEST_OS_WINDOWS 1
|
||||
#elif defined __APPLE__
|
||||
#define GTEST_OS_MAC
|
||||
#define GTEST_OS_MAC 1
|
||||
#elif defined __linux__
|
||||
#define GTEST_OS_LINUX
|
||||
#define GTEST_OS_LINUX 1
|
||||
#elif defined __MVS__
|
||||
#define GTEST_OS_ZOS
|
||||
#define GTEST_OS_ZOS 1
|
||||
#elif defined(__sun) && defined(__SVR4)
|
||||
#define GTEST_OS_SOLARIS
|
||||
#define GTEST_OS_SOLARIS 1
|
||||
#endif // _MSC_VER
|
||||
|
||||
#if defined(GTEST_OS_LINUX)
|
||||
#if GTEST_OS_LINUX
|
||||
|
||||
// On some platforms, <regex.h> needs someone to define size_t, and
|
||||
// won't compile otherwise. We can #include it here as we already
|
||||
@@ -255,14 +248,14 @@
|
||||
// TODO(wan@google.com): uses autoconf to detect whether ::std::wstring
|
||||
// is available.
|
||||
|
||||
#if defined(GTEST_OS_CYGWIN) || defined(GTEST_OS_SOLARIS)
|
||||
#if GTEST_OS_CYGWIN || GTEST_OS_SOLARIS
|
||||
// Cygwin 1.5 and below doesn't support ::std::wstring.
|
||||
// Cygwin 1.7 might add wstring support; this should be updated when clear.
|
||||
// Solaris' libc++ doesn't support it either.
|
||||
#define GTEST_HAS_STD_WSTRING 0
|
||||
#else
|
||||
#define GTEST_HAS_STD_WSTRING GTEST_HAS_STD_STRING
|
||||
#endif // defined(GTEST_OS_CYGWIN) || defined(GTEST_OS_SOLARIS)
|
||||
#endif // GTEST_OS_CYGWIN || GTEST_OS_SOLARIS
|
||||
|
||||
#endif // GTEST_HAS_STD_WSTRING
|
||||
|
||||
@@ -324,13 +317,7 @@
|
||||
// Determines whether <pthread.h> is available.
|
||||
#ifndef GTEST_HAS_PTHREAD
|
||||
// The user didn't tell us, so we need to figure it out.
|
||||
|
||||
#if defined(GTEST_OS_LINUX) || defined(GTEST_OS_MAC)
|
||||
#define GTEST_HAS_PTHREAD 1
|
||||
#else
|
||||
#define GTEST_HAS_PTHREAD 0
|
||||
#endif // GTEST_OS_LINUX || GTEST_OS_MAC
|
||||
|
||||
#define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC)
|
||||
#endif // GTEST_HAS_PTHREAD
|
||||
|
||||
// Determines whether tr1/tuple is available. If you have tr1/tuple
|
||||
@@ -371,17 +358,17 @@
|
||||
#ifndef GTEST_HAS_CLONE
|
||||
// The user didn't tell us, so we need to figure it out.
|
||||
|
||||
#if defined(GTEST_OS_LINUX) && !defined(__ia64__)
|
||||
#if GTEST_OS_LINUX && !defined(__ia64__)
|
||||
#define GTEST_HAS_CLONE 1
|
||||
#else
|
||||
#define GTEST_HAS_CLONE 0
|
||||
#endif // defined(GTEST_OS_LINUX) && !defined(__ia64__)
|
||||
#endif // GTEST_OS_LINUX && !defined(__ia64__)
|
||||
|
||||
#endif // GTEST_HAS_CLONE
|
||||
|
||||
// Determines whether to support death tests.
|
||||
#if GTEST_HAS_STD_STRING && GTEST_HAS_CLONE
|
||||
#define GTEST_HAS_DEATH_TEST
|
||||
#define GTEST_HAS_DEATH_TEST 1
|
||||
#include <vector>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
@@ -392,7 +379,7 @@
|
||||
#if defined(__GNUC__) || (_MSC_VER >= 1400)
|
||||
// TODO(vladl@google.com): get the implementation rid of vector and list
|
||||
// to compile on MSVC 7.1.
|
||||
#define GTEST_HAS_PARAM_TEST
|
||||
#define GTEST_HAS_PARAM_TEST 1
|
||||
#endif // defined(__GNUC__) || (_MSC_VER >= 1400)
|
||||
|
||||
// Determines whether to support type-driven tests.
|
||||
@@ -406,15 +393,13 @@
|
||||
|
||||
// Determines whether to support Combine(). This only makes sense when
|
||||
// value-parameterized tests are enabled.
|
||||
#if defined(GTEST_HAS_PARAM_TEST) && GTEST_HAS_TR1_TUPLE
|
||||
#define GTEST_HAS_COMBINE
|
||||
#endif // defined(GTEST_HAS_PARAM_TEST) && GTEST_HAS_TR1_TUPLE
|
||||
#if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE
|
||||
#define GTEST_HAS_COMBINE 1
|
||||
#endif // GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE
|
||||
|
||||
// Determines whether the system compiler uses UTF-16 for encoding wide strings.
|
||||
#if defined(GTEST_OS_WINDOWS) || defined(GTEST_OS_CYGWIN) || \
|
||||
defined(GTEST_OS_SYMBIAN)
|
||||
#define GTEST_WIDE_STRING_USES_UTF16_ 1
|
||||
#endif
|
||||
#define GTEST_WIDE_STRING_USES_UTF16_ \
|
||||
(GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN)
|
||||
|
||||
// Defines some utility macros.
|
||||
|
||||
@@ -610,7 +595,7 @@ inline void FlushInfoLog() { fflush(NULL); }
|
||||
// CaptureStderr - starts capturing stderr.
|
||||
// GetCapturedStderr - stops capturing stderr and returns the captured string.
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
// A copy of all command line arguments. Set by InitGoogleTest().
|
||||
extern ::std::vector<String> g_argvs;
|
||||
@@ -704,7 +689,7 @@ struct is_pointer<T*> : public true_type {};
|
||||
// Defines BiggestInt as the biggest signed integer type the compiler
|
||||
// supports.
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
typedef __int64 BiggestInt;
|
||||
#else
|
||||
typedef long long BiggestInt; // NOLINT
|
||||
@@ -762,7 +747,7 @@ class TypeWithSize<4> {
|
||||
template <>
|
||||
class TypeWithSize<8> {
|
||||
public:
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
typedef __int64 Int;
|
||||
typedef unsigned __int64 UInt;
|
||||
#else
|
||||
@@ -785,7 +770,7 @@ inline const char* GetEnv(const char* name) {
|
||||
#ifdef _WIN32_WCE // We are on Windows CE.
|
||||
// CE has no environment variables.
|
||||
return NULL;
|
||||
#elif defined(GTEST_OS_WINDOWS) // We are on Windows proper.
|
||||
#elif GTEST_OS_WINDOWS // We are on Windows proper.
|
||||
// MSVC 8 deprecates getenv(), so we want to suppress warning 4996
|
||||
// (deprecated function) there.
|
||||
#pragma warning(push) // Saves the current warning state.
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
#include <gtest/internal/gtest-port.h>
|
||||
#include <gtest/internal/gtest-string.h>
|
||||
|
||||
#if defined(GTEST_HAS_TYPED_TEST) || defined(GTEST_HAS_TYPED_TEST_P)
|
||||
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <cxxabi.h>
|
||||
|
||||
@@ -45,7 +45,7 @@ $var n = 50 $$ Maximum length of type lists we want to support.
|
||||
#include <gtest/internal/gtest-port.h>
|
||||
#include <gtest/internal/gtest-string.h>
|
||||
|
||||
#if defined(GTEST_HAS_TYPED_TEST) || defined(GTEST_HAS_TYPED_TEST_P)
|
||||
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <cxxabi.h>
|
||||
|
||||
Reference in New Issue
Block a user