summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-02-23 23:21:55 (GMT)
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-02-23 23:21:55 (GMT)
commit0af0709b02899f9177db55eba7929e65e5834b29 (patch)
tree96dd43de8d817d4cea7090c7daf548ebc9869237
parent3c7868a9a8fab4fd9209bbd2d2f1ae269d063680 (diff)
downloadgoogletest-0af0709b02899f9177db55eba7929e65e5834b29.zip
googletest-0af0709b02899f9177db55eba7929e65e5834b29.tar.gz
googletest-0af0709b02899f9177db55eba7929e65e5834b29.tar.bz2
Cleans up macro definitions.
-rw-r--r--include/gtest/gtest-death-test.h2
-rw-r--r--include/gtest/gtest-message.h4
-rw-r--r--include/gtest/gtest-param-test.h4
-rw-r--r--include/gtest/gtest-param-test.h.pump4
-rw-r--r--include/gtest/gtest-typed-test.h4
-rw-r--r--include/gtest/gtest.h8
-rw-r--r--include/gtest/internal/gtest-death-test-internal.h2
-rw-r--r--include/gtest/internal/gtest-internal.h6
-rw-r--r--include/gtest/internal/gtest-param-util-generated.h4
-rw-r--r--include/gtest/internal/gtest-param-util-generated.h.pump4
-rw-r--r--include/gtest/internal/gtest-param-util.h2
-rw-r--r--include/gtest/internal/gtest-port.h111
-rw-r--r--include/gtest/internal/gtest-type-util.h2
-rw-r--r--include/gtest/internal/gtest-type-util.h.pump2
-rw-r--r--samples/sample6_unittest.cc4
-rw-r--r--samples/sample7_unittest.cc2
-rw-r--r--samples/sample8_unittest.cc2
-rw-r--r--src/gtest-death-test.cc14
-rw-r--r--src/gtest-filepath.cc20
-rw-r--r--src/gtest-internal-inl.h20
-rw-r--r--src/gtest-port.cc13
-rw-r--r--src/gtest-test-part.cc4
-rw-r--r--src/gtest-typed-test.cc2
-rw-r--r--src/gtest.cc110
-rw-r--r--test/gtest-death-test_test.cc6
-rw-r--r--test/gtest-filepath_test.cc170
-rw-r--r--test/gtest-options_test.cc18
-rw-r--r--test/gtest-param-test2_test.cc2
-rw-r--r--test/gtest-param-test_test.cc14
-rw-r--r--test/gtest-param-test_test.h2
-rw-r--r--test/gtest-port_test.cc6
-rw-r--r--test/gtest-test-part_test.cc2
-rw-r--r--test/gtest-typed-test2_test.cc2
-rw-r--r--test/gtest-typed-test_test.cc6
-rw-r--r--test/gtest-typed-test_test.h2
-rw-r--r--test/gtest_break_on_failure_unittest_.cc4
-rw-r--r--test/gtest_env_var_test_.cc4
-rw-r--r--test/gtest_filter_unittest_.cc6
-rw-r--r--test/gtest_output_test_.cc20
-rw-r--r--test/gtest_repeat_test.cc16
-rw-r--r--test/gtest_stress_test.cc4
-rw-r--r--test/gtest_unittest.cc196
42 files changed, 411 insertions, 419 deletions
diff --git a/include/gtest/gtest-death-test.h b/include/gtest/gtest-death-test.h
index 1d4cf98..bb306f2 100644
--- a/include/gtest/gtest-death-test.h
+++ b/include/gtest/gtest-death-test.h
@@ -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.
diff --git a/include/gtest/gtest-message.h b/include/gtest/gtest-message.h
index 7effd08..99ae454 100644
--- a/include/gtest/gtest-message.h
+++ b/include/gtest/gtest-message.h
@@ -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
diff --git a/include/gtest/gtest-param-test.h b/include/gtest/gtest-param-test.h
index 2d63237..421517d 100644
--- a/include/gtest/gtest-param-test.h
+++ b/include/gtest/gtest-param-test.h
@@ -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.
//
diff --git a/include/gtest/gtest-param-test.h.pump b/include/gtest/gtest-param-test.h.pump
index 858e917..c761f12 100644
--- a/include/gtest/gtest-param-test.h.pump
+++ b/include/gtest/gtest-param-test.h.pump
@@ -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.
//
diff --git a/include/gtest/gtest-typed-test.h b/include/gtest/gtest-typed-test.h
index dec42cf..519edfe 100644
--- a/include/gtest/gtest-typed-test.h
+++ b/include/gtest/gtest-typed-test.h
@@ -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.
//
diff --git a/include/gtest/gtest.h b/include/gtest/gtest.h
index f28757d..7fecb92 100644
--- a/include/gtest/gtest.h
+++ b/include/gtest/gtest.h
@@ -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.
diff --git a/include/gtest/internal/gtest-death-test-internal.h b/include/gtest/internal/gtest-death-test-internal.h
index 3b90c49..815a3b5 100644
--- a/include/gtest/internal/gtest-death-test-internal.h
+++ b/include/gtest/internal/gtest-death-test-internal.h
@@ -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
diff --git a/include/gtest/internal/gtest-internal.h b/include/gtest/internal/gtest-internal.h
index b28da96..5908b76 100644
--- a/include/gtest/internal/gtest-internal.h
+++ b/include/gtest/internal/gtest-internal.h
@@ -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 {
diff --git a/include/gtest/internal/gtest-param-util-generated.h b/include/gtest/internal/gtest-param-util-generated.h
index 17f3f7b..ad06e02 100644
--- a/include/gtest/internal/gtest-param-util-generated.h
+++ b/include/gtest/internal/gtest-param-util-generated.h
@@ -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
diff --git a/include/gtest/internal/gtest-param-util-generated.h.pump b/include/gtest/internal/gtest-param-util-generated.h.pump
index fe32a8e..54b2dc1 100644
--- a/include/gtest/internal/gtest-param-util-generated.h.pump
+++ b/include/gtest/internal/gtest-param-util-generated.h.pump
@@ -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
diff --git a/include/gtest/internal/gtest-param-util.h b/include/gtest/internal/gtest-param-util.h
index 3bb07ec..5559ab4 100644
--- a/include/gtest/internal/gtest-param-util.h
+++ b/include/gtest/internal/gtest-param-util.h
@@ -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>
diff --git a/include/gtest/internal/gtest-port.h b/include/gtest/internal/gtest-port.h
index c502efa..8f75e9a 100644
--- a/include/gtest/internal/gtest-port.h
+++ b/include/gtest/internal/gtest-port.h
@@ -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.
-//
-// 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;
+// Note that it is possible that none of the GTEST_OS_* macros are defined.
+//
+// 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.
diff --git a/include/gtest/internal/gtest-type-util.h b/include/gtest/internal/gtest-type-util.h
index 815da4b..1ea7d18 100644
--- a/include/gtest/internal/gtest-type-util.h
+++ b/include/gtest/internal/gtest-type-util.h
@@ -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>
diff --git a/include/gtest/internal/gtest-type-util.h.pump b/include/gtest/internal/gtest-type-util.h.pump
index 4858c7d..27821ac 100644
--- a/include/gtest/internal/gtest-type-util.h.pump
+++ b/include/gtest/internal/gtest-type-util.h.pump
@@ -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>
diff --git a/samples/sample6_unittest.cc b/samples/sample6_unittest.cc
index 3616672..dd0df31 100644
--- a/samples/sample6_unittest.cc
+++ b/samples/sample6_unittest.cc
@@ -74,7 +74,7 @@ class PrimeTableTest : public testing::Test {
PrimeTable* const table_;
};
-#ifdef GTEST_HAS_TYPED_TEST
+#if GTEST_HAS_TYPED_TEST
using testing::Types;
@@ -137,7 +137,7 @@ TYPED_TEST(PrimeTableTest, CanGetNextPrime) {
#endif // GTEST_HAS_TYPED_TEST
-#ifdef GTEST_HAS_TYPED_TEST_P
+#if GTEST_HAS_TYPED_TEST_P
using testing::Types;
diff --git a/samples/sample7_unittest.cc b/samples/sample7_unittest.cc
index 7f555c4..b5d507a 100644
--- a/samples/sample7_unittest.cc
+++ b/samples/sample7_unittest.cc
@@ -40,7 +40,7 @@
#include <gtest/gtest.h>
-#ifdef GTEST_HAS_PARAM_TEST
+#if GTEST_HAS_PARAM_TEST
using ::testing::TestWithParam;
using ::testing::Values;
diff --git a/samples/sample8_unittest.cc b/samples/sample8_unittest.cc
index 6a1b0c1..d76136a 100644
--- a/samples/sample8_unittest.cc
+++ b/samples/sample8_unittest.cc
@@ -38,7 +38,7 @@
#include <gtest/gtest.h>
-#ifdef GTEST_HAS_COMBINE
+#if GTEST_HAS_COMBINE
// Suppose we want to introduce a new, improved implementation of PrimeTable
// which combines speed of PrecalcPrimeTable and versatility of
diff --git a/src/gtest-death-test.cc b/src/gtest-death-test.cc
index 6499842..7bb3649 100644
--- a/src/gtest-death-test.cc
+++ b/src/gtest-death-test.cc
@@ -34,7 +34,7 @@
#include <gtest/gtest-death-test.h>
#include <gtest/internal/gtest-port.h>
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
#include <errno.h>
#include <limits.h>
#include <stdarg.h>
@@ -48,9 +48,9 @@
// included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in
// his code.
-#define GTEST_IMPLEMENTATION
+#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION
+#undef GTEST_IMPLEMENTATION_
namespace testing {
@@ -90,7 +90,7 @@ GTEST_DEFINE_string_(
"death test. FOR INTERNAL USE ONLY.");
} // namespace internal
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
// ExitedWithCode constructor.
ExitedWithCode::ExitedWithCode(int exit_code) : exit_code_(exit_code) {
@@ -144,7 +144,7 @@ bool ExitedUnsuccessfully(int exit_status) {
static String DeathTestThreadWarning(size_t thread_count) {
Message msg;
msg << "Death tests use fork(), which is unsafe particularly"
- << " in a threaded context. For this test, " << GTEST_NAME << " ";
+ << " in a threaded context. For this test, " << GTEST_NAME_ << " ";
if (thread_count == 0)
msg << "couldn't detect the number of threads.";
else
@@ -655,11 +655,11 @@ DeathTest::TestRole ExecDeathTest::AssumeRole() {
const String filter_flag =
String::Format("--%s%s=%s.%s",
- GTEST_FLAG_PREFIX, kFilterFlag,
+ GTEST_FLAG_PREFIX_, kFilterFlag,
info->test_case_name(), info->name());
const String internal_flag =
String::Format("--%s%s=%s:%d:%d:%d",
- GTEST_FLAG_PREFIX, kInternalRunDeathTestFlag, file_, line_,
+ GTEST_FLAG_PREFIX_, kInternalRunDeathTestFlag, file_, line_,
death_test_index, pipe_fd[1]);
Arguments args;
args.AddArguments(GetArgvs());
diff --git a/src/gtest-filepath.cc b/src/gtest-filepath.cc
index ebf7cf9..e590801 100644
--- a/src/gtest-filepath.cc
+++ b/src/gtest-filepath.cc
@@ -36,11 +36,11 @@
#ifdef _WIN32_WCE
#include <windows.h>
-#elif defined(GTEST_OS_WINDOWS)
+#elif GTEST_OS_WINDOWS
#include <direct.h>
#include <io.h>
#include <sys/stat.h>
-#elif defined(GTEST_OS_SYMBIAN)
+#elif GTEST_OS_SYMBIAN
// Symbian OpenC has PATH_MAX in sys/syslimits.h
#include <sys/syslimits.h>
#include <unistd.h>
@@ -50,7 +50,7 @@
#include <unistd.h> // NOLINT
#endif // _WIN32_WCE or _WIN32
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
#define GTEST_PATH_MAX_ _MAX_PATH
#elif defined(PATH_MAX)
#define GTEST_PATH_MAX_ PATH_MAX
@@ -65,7 +65,7 @@
namespace testing {
namespace internal {
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
const char kPathSeparator = '\\';
const char kPathSeparatorString[] = "\\";
#ifdef _WIN32_WCE
@@ -90,7 +90,7 @@ FilePath FilePath::GetCurrentDir() {
// Windows CE doesn't have a current directory, so we just return
// something reasonable.
return FilePath(kCurrentDirectoryString);
-#elif defined(GTEST_OS_WINDOWS)
+#elif GTEST_OS_WINDOWS
char cwd[GTEST_PATH_MAX_ + 1] = {};
return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd);
#else
@@ -165,7 +165,7 @@ FilePath FilePath::ConcatPaths(const FilePath& directory,
// Returns true if pathname describes something findable in the file-system,
// either a file, directory, or whatever.
bool FilePath::FileOrDirectoryExists() const {
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
#ifdef _WIN32_WCE
LPCWSTR unicode = String::AnsiToUtf16(pathname_.c_str());
const DWORD attributes = GetFileAttributes(unicode);
@@ -185,7 +185,7 @@ bool FilePath::FileOrDirectoryExists() const {
// that exists.
bool FilePath::DirectoryExists() const {
bool result = false;
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
// Don't strip off trailing separator if path is a root directory on
// Windows (like "C:\\").
const FilePath& path(IsRootDirectory() ? *this :
@@ -214,7 +214,7 @@ bool FilePath::DirectoryExists() const {
// Returns true if pathname describes a root directory. (Windows has one
// root directory per disk drive.)
bool FilePath::IsRootDirectory() const {
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
// TODO(wan@google.com): on Windows a network share like
// \\server\share can be a root directory, although it cannot be the
// current directory. Handle this properly.
@@ -227,7 +227,7 @@ bool FilePath::IsRootDirectory() const {
// Returns true if pathname describes an absolute path.
bool FilePath::IsAbsolutePath() const {
const char* const name = pathname_.c_str();
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
return pathname_.GetLength() >= 3 &&
((name[0] >= 'a' && name[0] <= 'z') ||
(name[0] >= 'A' && name[0] <= 'Z')) &&
@@ -285,7 +285,7 @@ bool FilePath::CreateDirectoriesRecursively() const {
// directory for any reason, including if the parent directory does not
// exist. Not named "CreateDirectory" because that's a macro on Windows.
bool FilePath::CreateFolder() const {
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
#ifdef _WIN32_WCE
FilePath removed_sep(this->RemoveTrailingPathSeparator());
LPCWSTR unicode = String::AnsiToUtf16(removed_sep.c_str());
diff --git a/src/gtest-internal-inl.h b/src/gtest-internal-inl.h
index 07d0c5b..b1a5dbb 100644
--- a/src/gtest-internal-inl.h
+++ b/src/gtest-internal-inl.h
@@ -37,19 +37,19 @@
#ifndef GTEST_SRC_GTEST_INTERNAL_INL_H_
#define GTEST_SRC_GTEST_INTERNAL_INL_H_
-// GTEST_IMPLEMENTATION is defined iff the current translation unit is
-// part of Google Test's implementation.
-#ifndef GTEST_IMPLEMENTATION
+// GTEST_IMPLEMENTATION_ is defined to 1 iff the current translation unit is
+// part of Google Test's implementation; otherwise it's undefined.
+#if !GTEST_IMPLEMENTATION_
// 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 "It must not be included except by Google Test itself."
-#endif // GTEST_IMPLEMENTATION
+#endif // GTEST_IMPLEMENTATION_
#include <stddef.h>
#include <gtest/internal/gtest-port.h>
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
#include <windows.h> // NOLINT
#endif // GTEST_OS_WINDOWS
@@ -833,7 +833,7 @@ class UnitTestOptions {
static bool FilterMatchesTest(const String &test_case_name,
const String &test_name);
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
// Function for supporting the gtest_catch_exception flag.
// Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the
@@ -1095,7 +1095,7 @@ class UnitTestImpl {
tear_down_tc)->AddTestInfo(test_info);
}
-#ifdef GTEST_HAS_PARAM_TEST
+#if GTEST_HAS_PARAM_TEST
// Returns ParameterizedTestCaseRegistry object used to keep track of
// value-parameterized tests and instantiate and register them.
internal::ParameterizedTestCaseRegistry& parameterized_test_registry() {
@@ -1175,7 +1175,7 @@ class UnitTestImpl {
return gtest_trace_stack_.pointer();
}
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
// Returns a pointer to the parsed --gtest_internal_run_death_test
// flag, or NULL if that flag was not specified.
// This information is useful only in a death test child process.
@@ -1224,7 +1224,7 @@ class UnitTestImpl {
internal::List<TestCase*> test_cases_; // The list of TestCases.
-#ifdef GTEST_HAS_PARAM_TEST
+#if GTEST_HAS_PARAM_TEST
// ParameterizedTestRegistry object used to register value-parameterized
// tests.
internal::ParameterizedTestCaseRegistry parameterized_test_registry_;
@@ -1273,7 +1273,7 @@ class UnitTestImpl {
// How long the test took to run, in milliseconds.
TimeInMillis elapsed_time_;
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
// The decomposed components of the gtest_internal_run_death_test flag,
// parsed when RUN_ALL_TESTS is called.
internal::scoped_ptr<InternalRunDeathTestFlag> internal_run_death_test_flag_;
diff --git a/src/gtest-port.cc b/src/gtest-port.cc
index 9348f55..59a2230 100644
--- a/src/gtest-port.cc
+++ b/src/gtest-port.cc
@@ -35,7 +35,7 @@
#include <stdlib.h>
#include <stdio.h>
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
#include <regex.h>
#endif // GTEST_HAS_DEATH_TEST
@@ -56,9 +56,9 @@
// included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in
// his code.
-#define GTEST_IMPLEMENTATION
+#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION
+#undef GTEST_IMPLEMENTATION_
namespace testing {
namespace internal {
@@ -334,7 +334,7 @@ bool RE::PartialMatch(const char* str, const RE& re) {
void RE::Init(const char* regex) {
pattern_ = full_pattern_ = NULL;
if (regex != NULL) {
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
pattern_ = _strdup(regex);
#else
pattern_ = strdup(regex);
@@ -383,7 +383,7 @@ void GTestLog(GTestLogSeverity severity, const char* file,
}
}
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
// Defines the stderr capturer.
@@ -502,7 +502,8 @@ void abort() {
// given flag. For example, FlagToEnvVar("foo") will return
// "GTEST_FOO" in the open-source version.
static String FlagToEnvVar(const char* flag) {
- const String full_flag = (Message() << GTEST_FLAG_PREFIX << flag).GetString();
+ const String full_flag =
+ (Message() << GTEST_FLAG_PREFIX_ << flag).GetString();
Message env_var;
for (int i = 0; i != full_flag.GetLength(); i++) {
diff --git a/src/gtest-test-part.cc b/src/gtest-test-part.cc
index dcd30b2..2cb5585 100644
--- a/src/gtest-test-part.cc
+++ b/src/gtest-test-part.cc
@@ -38,9 +38,9 @@
// included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in
// his code.
-#define GTEST_IMPLEMENTATION
+#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION
+#undef GTEST_IMPLEMENTATION_
namespace testing {
diff --git a/src/gtest-typed-test.cc b/src/gtest-typed-test.cc
index d42a159..cb91f2b 100644
--- a/src/gtest-typed-test.cc
+++ b/src/gtest-typed-test.cc
@@ -35,7 +35,7 @@
namespace testing {
namespace internal {
-#ifdef GTEST_HAS_TYPED_TEST_P
+#if GTEST_HAS_TYPED_TEST_P
// Verifies that registered_tests match the test names in
// defined_test_names_; returns registered_tests if successful, or
diff --git a/src/gtest.cc b/src/gtest.cc
index 0d161e0..e4f9d0f 100644
--- a/src/gtest.cc
+++ b/src/gtest.cc
@@ -43,11 +43,11 @@
#include <wchar.h>
#include <wctype.h>
-#ifdef GTEST_OS_LINUX
+#if GTEST_OS_LINUX
// TODO(kenton@google.com): Use autoconf to detect availability of
// gettimeofday().
-#define GTEST_HAS_GETTIMEOFDAY
+#define GTEST_HAS_GETTIMEOFDAY_ 1
#include <fcntl.h>
#include <limits.h>
@@ -60,12 +60,12 @@
#include <string>
#include <vector>
-#elif defined(GTEST_OS_SYMBIAN)
-#define GTEST_HAS_GETTIMEOFDAY
+#elif GTEST_OS_SYMBIAN
+#define GTEST_HAS_GETTIMEOFDAY_ 1
#include <sys/time.h> // NOLINT
-#elif defined(GTEST_OS_ZOS)
-#define GTEST_HAS_GETTIMEOFDAY
+#elif GTEST_OS_ZOS
+#define GTEST_HAS_GETTIMEOFDAY_ 1
#include <sys/time.h> // NOLINT
// On z/OS we additionally need strings.h for strcasecmp.
@@ -75,7 +75,7 @@
#include <windows.h> // NOLINT
-#elif defined(GTEST_OS_WINDOWS) // We are on Windows proper.
+#elif GTEST_OS_WINDOWS // We are on Windows proper.
#include <io.h> // NOLINT
#include <sys/timeb.h> // NOLINT
@@ -89,9 +89,9 @@
// TODO(kenton@google.com): There are other ways to get the time on
// Windows, like GetTickCount() or GetSystemTimeAsFileTime(). MinGW
// supports these. consider using them instead.
-#define GTEST_HAS_GETTIMEOFDAY
+#define GTEST_HAS_GETTIMEOFDAY_ 1
#include <sys/time.h> // NOLINT
-#endif
+#endif // defined(__MINGW__) || defined(__MINGW32__)
// cpplint thinks that the header is already included, so we want to
// silence it.
@@ -102,25 +102,25 @@
// Assume other platforms have gettimeofday().
// TODO(kenton@google.com): Use autoconf to detect availability of
// gettimeofday().
-#define GTEST_HAS_GETTIMEOFDAY
+#define GTEST_HAS_GETTIMEOFDAY_ 1
// cpplint thinks that the header is already included, so we want to
// silence it.
#include <sys/time.h> // NOLINT
#include <unistd.h> // NOLINT
-#endif
+#endif // GTEST_OS_LINUX
// Indicates that this translation unit is part of Google Test's
// implementation. It must come before gtest-internal-inl.h is
// included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in
// his code.
-#define GTEST_IMPLEMENTATION
+#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION
+#undef GTEST_IMPLEMENTATION_
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
#define fileno _fileno
#define isatty _isatty
#define vsnprintf _vsnprintf
@@ -173,7 +173,7 @@ GTEST_DEFINE_bool_(
GTEST_DEFINE_bool_(
catch_exceptions,
internal::BoolFromGTestEnv("catch_exceptions", false),
- "True iff " GTEST_NAME
+ "True iff " GTEST_NAME_
" should catch exceptions and treat them as test failures.");
GTEST_DEFINE_string_(
@@ -211,7 +211,7 @@ GTEST_DEFINE_string_(
GTEST_DEFINE_bool_(
print_time,
internal::BoolFromGTestEnv("print_time", false),
- "True iff " GTEST_NAME
+ "True iff " GTEST_NAME_
" should display elapsed time in text output.");
GTEST_DEFINE_int32_(
@@ -228,7 +228,7 @@ GTEST_DEFINE_int32_(
GTEST_DEFINE_bool_(
show_internal_stack_frames, false,
- "True iff " GTEST_NAME " should include internal stack frames when "
+ "True iff " GTEST_NAME_ " should include internal stack frames when "
"printing test failure stack traces.");
namespace internal {
@@ -302,7 +302,7 @@ String g_executable_path;
FilePath GetCurrentExecutableName() {
FilePath result;
-#if defined(_WIN32_WCE) || defined(GTEST_OS_WINDOWS)
+#if defined(_WIN32_WCE) || GTEST_OS_WINDOWS
result.Set(FilePath(g_executable_path).RemoveExtension("exe"));
#else
result.Set(FilePath(g_executable_path));
@@ -433,7 +433,7 @@ bool UnitTestOptions::FilterMatchesTest(const String &test_case_name,
!MatchesFilter(full_name, negative.c_str()));
}
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
// Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the
// given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise.
// This function is useful as an __except condition.
@@ -743,7 +743,7 @@ static TimeInMillis GetTimeInMillis() {
return now_int64.QuadPart;
}
return 0;
-#elif defined(GTEST_OS_WINDOWS) && !defined(GTEST_HAS_GETTIMEOFDAY)
+#elif GTEST_OS_WINDOWS && !GTEST_HAS_GETTIMEOFDAY_
__timeb64 now;
#ifdef _MSC_VER
// MSVC 8 deprecates _ftime64(), so we want to suppress warning 4996
@@ -758,7 +758,7 @@ static TimeInMillis GetTimeInMillis() {
_ftime64(&now);
#endif // _MSC_VER
return static_cast<TimeInMillis>(now.time) * 1000 + now.millitm;
-#elif defined(GTEST_HAS_GETTIMEOFDAY)
+#elif GTEST_HAS_GETTIMEOFDAY_
struct timeval now;
gettimeofday(&now, NULL);
return static_cast<TimeInMillis>(now.tv_sec) * 1000 + now.tv_usec / 1000;
@@ -793,7 +793,7 @@ static char* CloneString(const char* str, size_t length) {
char* const clone = new char[length + 1];
// MSVC 8 deprecates strncpy(), so we want to suppress warning
// 4996 (deprecated function) there.
-#ifdef GTEST_OS_WINDOWS // We are on Windows.
+#if GTEST_OS_WINDOWS // We are on Windows.
#pragma warning(push) // Saves the current warning state.
#pragma warning(disable:4996) // Temporarily disables warning 4996.
strncpy(clone, str, length);
@@ -1314,7 +1314,7 @@ AssertionResult IsNotSubstring(
namespace internal {
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
namespace {
@@ -1442,14 +1442,14 @@ char* CodePointToUtf8(UInt32 code_point, char* str) {
// null-terminate the destination string.
// MSVC 8 deprecates strncpy(), so we want to suppress warning
// 4996 (deprecated function) there.
-#ifdef GTEST_OS_WINDOWS // We are on Windows.
+#if GTEST_OS_WINDOWS // We are on Windows.
#pragma warning(push) // Saves the current warning state.
#pragma warning(disable:4996) // Temporarily disables warning 4996.
#endif
strncpy(str, String::Format("(Invalid Unicode 0x%X)", code_point).c_str(),
32);
-#ifdef GTEST_OS_WINDOWS // We are on Windows.
-#pragma warning(pop) // Restores the warning state.
+#if GTEST_OS_WINDOWS // We are on Windows.
+#pragma warning(pop) // Restores the warning state.
#endif
str[31] = '\0'; // Makes sure no change in the format to strncpy leaves
// the result unterminated.
@@ -1592,7 +1592,7 @@ bool String::CaseInsensitiveCStringEquals(const char * lhs, const char * rhs) {
if ( rhs == NULL ) return false;
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
return _stricmp(lhs, rhs) == 0;
#else // GTEST_OS_WINDOWS
return strcasecmp(lhs, rhs) == 0;
@@ -1617,9 +1617,9 @@ bool String::CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
if ( rhs == NULL ) return false;
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
return _wcsicmp(lhs, rhs) == 0;
-#elif defined(GTEST_OS_LINUX)
+#elif GTEST_OS_LINUX
return wcscasecmp(lhs, rhs) == 0;
#else
// Mac OS X and Cygwin don't define wcscasecmp. Other unknown OSes
@@ -1720,7 +1720,7 @@ String String::Format(const char * format, ...) {
char buffer[4096];
// MSVC 8 deprecates vsnprintf(), so we want to suppress warning
// 4996 (deprecated function) there.
-#ifdef GTEST_OS_WINDOWS // We are on Windows.
+#if GTEST_OS_WINDOWS // We are on Windows.
#pragma warning(push) // Saves the current warning state.
#pragma warning(disable:4996) // Temporarily disables warning 4996.
const int size =
@@ -1827,7 +1827,7 @@ bool TestResult::ValidateTestProperty(const TestProperty& test_property) {
<< "Reserved key used in RecordProperty(): "
<< key
<< " ('name', 'status', 'time', and 'classname' are reserved by "
- << GTEST_NAME << ")";
+ << GTEST_NAME_ << ")";
return false;
}
return true;
@@ -1917,7 +1917,7 @@ void Test::RecordProperty(const char* key, int value) {
RecordProperty(key, value_message.GetString().c_str());
}
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
// We are on Windows.
// Adds an "exception thrown" fatal failure to the current test.
@@ -2013,7 +2013,7 @@ void Test::Run() {
if (!HasSameFixtureClass()) return;
internal::UnitTestImpl* const impl = internal::GetUnitTestImpl();
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
// We are on Windows.
impl->os_stack_trace_getter()->UponLeavingGTest();
__try {
@@ -2122,7 +2122,7 @@ TestInfo* MakeAndRegisterTestInfo(
return test_info;
}
-#ifdef GTEST_HAS_PARAM_TEST
+#if GTEST_HAS_PARAM_TEST
void ReportInvalidTestCaseType(const char* test_case_name,
const char* file, int line) {
Message errors;
@@ -2221,7 +2221,7 @@ namespace internal {
// and INSTANTIATE_TEST_CASE_P into regular tests and registers those.
// This will be done just once during the program runtime.
void UnitTestImpl::RegisterParameterizedTests() {
-#ifdef GTEST_HAS_PARAM_TEST
+#if GTEST_HAS_PARAM_TEST
if (!parameterized_tests_registered_) {
parameterized_test_registry_.RegisterTests();
parameterized_tests_registered_ = true;
@@ -2247,7 +2247,7 @@ void TestInfoImpl::Run() {
const TimeInMillis start = GetTimeInMillis();
impl->os_stack_trace_getter()->UponLeavingGTest();
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
// We are on Windows.
Test* test = NULL;
@@ -2459,7 +2459,7 @@ enum GTestColor {
COLOR_YELLOW
};
-#if defined(GTEST_OS_WINDOWS) && !defined(_WIN32_WCE)
+#if GTEST_OS_WINDOWS && !defined(_WIN32_WCE)
// Returns the character attribute for the given color.
WORD GetColorAttribute(GTestColor color) {
@@ -2490,7 +2490,7 @@ bool ShouldUseColor(bool stdout_is_tty) {
const char* const gtest_color = GTEST_FLAG(color).c_str();
if (String::CaseInsensitiveCStringEquals(gtest_color, "auto")) {
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
// On Windows the TERM variable is usually not set, but the
// console there does support colors.
return stdout_is_tty;
@@ -2522,11 +2522,11 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
va_list args;
va_start(args, fmt);
-#if defined(_WIN32_WCE) || defined(GTEST_OS_SYMBIAN) || defined(GTEST_OS_ZOS)
+#if defined(_WIN32_WCE) || GTEST_OS_SYMBIAN || GTEST_OS_ZOS
static const bool use_color = false;
#else
static const bool use_color = ShouldUseColor(isatty(fileno(stdout)) != 0);
-#endif // !_WIN32_WCE
+#endif // defined(_WIN32_WCE) || GTEST_OS_SYMBIAN || GTEST_OS_ZOS
// The '!= 0' comparison is necessary to satisfy MSVC 7.1.
if (!use_color) {
@@ -2535,7 +2535,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
return;
}
-#if defined(GTEST_OS_WINDOWS) && !defined(_WIN32_WCE)
+#if GTEST_OS_WINDOWS && !defined(_WIN32_WCE)
const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE);
// Gets the current text color.
@@ -2553,7 +2553,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
printf("\033[0;3%sm", GetAnsiColorCode(color));
vprintf(fmt, args);
printf("\033[m"); // Resets the terminal to default.
-#endif // GTEST_OS_WINDOWS && !_WIN32_WCE
+#endif // GTEST_OS_WINDOWS && !defined(_WIN32_WCE)
va_end(args);
}
@@ -2599,7 +2599,7 @@ void PrettyUnitTestResultPrinter::OnUnitTestStart(
// tests may be skipped.
if (!internal::String::CStringEquals(filter, kUniversalFilter)) {
ColoredPrintf(COLOR_YELLOW,
- "Note: %s filter = %s\n", GTEST_NAME, filter);
+ "Note: %s filter = %s\n", GTEST_NAME_, filter);
}
if (internal::ShouldShard(kTestTotalShards, kTestShardIndex, false)) {
@@ -2926,7 +2926,7 @@ void XmlUnitTestResultPrinter::OnUnitTestEnd(const UnitTest* unit_test) {
if (output_dir.CreateDirectoriesRecursively()) {
// MSVC 8 deprecates fopen(), so we want to suppress warning 4996
// (deprecated function) there.
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
// We are on Windows.
#pragma warning(push) // Saves the current warning state.
#pragma warning(disable:4996) // Temporarily disables warning 4996.
@@ -3191,7 +3191,7 @@ void OsStackTraceGetter::UponLeavingGTest() {
const char* const
OsStackTraceGetter::kElidedFramesMarker =
- "... " GTEST_NAME " internal frames ...";
+ "... " GTEST_NAME_ " internal frames ...";
} // namespace internal
@@ -3255,7 +3255,7 @@ void UnitTest::AddTestPartResult(TestPartResultType result_type,
internal::MutexLock lock(&mutex_);
if (impl_->gtest_trace_stack()->size() > 0) {
- msg << "\n" << GTEST_NAME << " trace:";
+ msg << "\n" << GTEST_NAME_ << " trace:";
for (internal::ListNode<internal::TraceInfo>* node =
impl_->gtest_trace_stack()->Head();
@@ -3298,7 +3298,7 @@ void UnitTest::RecordPropertyForCurrentTest(const char* key,
// We don't protect this under mutex_, as we only support calling it
// from the main thread.
int UnitTest::Run() {
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
#if !defined(_WIN32_WCE)
// SetErrorMode doesn't exist on CE.
@@ -3349,7 +3349,7 @@ const TestInfo* UnitTest::current_test_info() const {
return impl_->current_test_info();
}
-#ifdef GTEST_HAS_PARAM_TEST
+#if GTEST_HAS_PARAM_TEST
// Returns ParameterizedTestCaseRegistry object used to keep track of
// value-parameterized tests and instantiate and register them.
// L < mutex_
@@ -3404,7 +3404,7 @@ UnitTestImpl::UnitTestImpl(UnitTest* parent)
per_thread_test_part_result_reporter_(
&default_per_thread_test_part_result_reporter_),
test_cases_(),
-#ifdef GTEST_HAS_PARAM_TEST
+#if GTEST_HAS_PARAM_TEST
parameterized_test_registry_(),
parameterized_tests_registered_(false),
#endif // GTEST_HAS_PARAM_TEST
@@ -3414,7 +3414,7 @@ UnitTestImpl::UnitTestImpl(UnitTest* parent)
ad_hoc_test_result_(),
result_printer_(NULL),
os_stack_trace_getter_(NULL),
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
elapsed_time_(0),
internal_run_death_test_flag_(NULL),
death_test_factory_(new DefaultDeathTestFactory) {
@@ -3540,7 +3540,7 @@ int UnitTestImpl::RunAllTests() {
// death test.
bool in_subprocess_for_death_test = false;
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
internal_run_death_test_flag_.reset(ParseInternalRunDeathTestFlag());
in_subprocess_for_death_test = (internal_run_death_test_flag_.get() != NULL);
#endif // GTEST_HAS_DEATH_TEST
@@ -3817,7 +3817,7 @@ UnitTestEventListenerInterface* UnitTestImpl::result_printer() {
return result_printer_;
}
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
if (internal_run_death_test_flag_.get() != NULL) {
result_printer_ = new NullUnitTestResultPrinter;
return result_printer_;
@@ -3943,8 +3943,8 @@ const char* ParseFlagValue(const char* str,
// str and flag must not be NULL.
if (str == NULL || flag == NULL) return NULL;
- // The flag must start with "--" followed by GTEST_FLAG_PREFIX.
- const String flag_str = String::Format("--%s%s", GTEST_FLAG_PREFIX, flag);
+ // The flag must start with "--" followed by GTEST_FLAG_PREFIX_.
+ const String flag_str = String::Format("--%s%s", GTEST_FLAG_PREFIX_, flag);
const size_t flag_len = flag_str.GetLength();
if (strncmp(str, flag_str.c_str(), flag_len) != 0) return NULL;
@@ -4096,7 +4096,7 @@ void InitGoogleTestImpl(int* argc, CharType** argv) {
internal::g_executable_path = internal::StreamableToString(argv[0]);
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
g_argvs.clear();
for (int i = 0; i != *argc; i++) {
g_argvs.push_back(StreamableToString(argv[i]));
diff --git a/test/gtest-death-test_test.cc b/test/gtest-death-test_test.cc
index 204ec41..6d8a3f8 100644
--- a/test/gtest-death-test_test.cc
+++ b/test/gtest-death-test_test.cc
@@ -34,7 +34,7 @@
#include <gtest/gtest-death-test.h>
#include <gtest/gtest.h>
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
#include <stdio.h>
#include <unistd.h>
@@ -45,9 +45,9 @@
// included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in
// his code.
-#define GTEST_IMPLEMENTATION
+#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION
+#undef GTEST_IMPLEMENTATION_
using testing::internal::DeathTest;
using testing::internal::DeathTestFactory;
diff --git a/test/gtest-filepath_test.cc b/test/gtest-filepath_test.cc
index ee80f0d..dfbd5f0 100644
--- a/test/gtest-filepath_test.cc
+++ b/test/gtest-filepath_test.cc
@@ -46,19 +46,19 @@
// included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in
// his code.
-#define GTEST_IMPLEMENTATION
+#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION
+#undef GTEST_IMPLEMENTATION_
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
#ifdef _WIN32_WCE
#include <windows.h> // NOLINT
#else
#include <direct.h> // NOLINT
#endif // _WIN32_WCE
-#define PATH_SEP "\\"
+#define GTEST_PATH_SEP_ "\\"
#else
-#define PATH_SEP "/"
+#define GTEST_PATH_SEP_ "/"
#endif // GTEST_OS_WINDOWS
namespace testing {
@@ -90,16 +90,16 @@ int _rmdir(const char* path) {
TEST(GetCurrentDirTest, ReturnsCurrentDir) {
EXPECT_FALSE(FilePath::GetCurrentDir().IsEmpty());
-#ifdef GTEST_OS_WINDOWS
- _chdir(PATH_SEP);
+#if GTEST_OS_WINDOWS
+ _chdir(GTEST_PATH_SEP_);
const FilePath cwd = FilePath::GetCurrentDir();
// Skips the ":".
const char* const cwd_without_drive = strchr(cwd.c_str(), ':');
ASSERT_TRUE(cwd_without_drive != NULL);
- EXPECT_STREQ(PATH_SEP, cwd_without_drive + 1);
+ EXPECT_STREQ(GTEST_PATH_SEP_, cwd_without_drive + 1);
#else
- chdir(PATH_SEP);
- EXPECT_STREQ(PATH_SEP, FilePath::GetCurrentDir().c_str());
+ chdir(GTEST_PATH_SEP_);
+ EXPECT_STREQ(GTEST_PATH_SEP_, FilePath::GetCurrentDir().c_str());
#endif
}
@@ -131,25 +131,25 @@ TEST(RemoveDirectoryNameTest, ButNoDirectory) {
// RemoveDirectoryName "/afile" -> "afile"
TEST(RemoveDirectoryNameTest, RootFileShouldGiveFileName) {
EXPECT_STREQ("afile",
- FilePath(PATH_SEP "afile").RemoveDirectoryName().c_str());
+ FilePath(GTEST_PATH_SEP_ "afile").RemoveDirectoryName().c_str());
}
// RemoveDirectoryName "adir/" -> ""
TEST(RemoveDirectoryNameTest, WhereThereIsNoFileName) {
EXPECT_STREQ("",
- FilePath("adir" PATH_SEP).RemoveDirectoryName().c_str());
+ FilePath("adir" GTEST_PATH_SEP_).RemoveDirectoryName().c_str());
}
// RemoveDirectoryName "adir/afile" -> "afile"
TEST(RemoveDirectoryNameTest, ShouldGiveFileName) {
EXPECT_STREQ("afile",
- FilePath("adir" PATH_SEP "afile").RemoveDirectoryName().c_str());
+ FilePath("adir" GTEST_PATH_SEP_ "afile").RemoveDirectoryName().c_str());
}
// RemoveDirectoryName "adir/subdir/afile" -> "afile"
TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileName) {
EXPECT_STREQ("afile",
- FilePath("adir" PATH_SEP "subdir" PATH_SEP "afile")
+ FilePath("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_ "afile")
.RemoveDirectoryName().c_str());
}
@@ -158,63 +158,63 @@ TEST(RemoveDirectoryNameTest, ShouldAlsoGiveFileName) {
TEST(RemoveFileNameTest, EmptyName) {
#ifdef _WIN32_WCE
// On Windows CE, we use the root as the current directory.
- EXPECT_STREQ(PATH_SEP,
+ EXPECT_STREQ(GTEST_PATH_SEP_,
FilePath("").RemoveFileName().c_str());
#else
- EXPECT_STREQ("." PATH_SEP,
+ EXPECT_STREQ("." GTEST_PATH_SEP_,
FilePath("").RemoveFileName().c_str());
#endif
}
// RemoveFileName "adir/" -> "adir/"
TEST(RemoveFileNameTest, ButNoFile) {
- EXPECT_STREQ("adir" PATH_SEP,
- FilePath("adir" PATH_SEP).RemoveFileName().c_str());
+ EXPECT_STREQ("adir" GTEST_PATH_SEP_,
+ FilePath("adir" GTEST_PATH_SEP_).RemoveFileName().c_str());
}
// RemoveFileName "adir/afile" -> "adir/"
TEST(RemoveFileNameTest, GivesDirName) {
- EXPECT_STREQ("adir" PATH_SEP,
- FilePath("adir" PATH_SEP "afile")
+ EXPECT_STREQ("adir" GTEST_PATH_SEP_,
+ FilePath("adir" GTEST_PATH_SEP_ "afile")
.RemoveFileName().c_str());
}
// RemoveFileName "adir/subdir/afile" -> "adir/subdir/"
TEST(RemoveFileNameTest, GivesDirAndSubDirName) {
- EXPECT_STREQ("adir" PATH_SEP "subdir" PATH_SEP,
- FilePath("adir" PATH_SEP "subdir" PATH_SEP "afile")
+ EXPECT_STREQ("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_,
+ FilePath("adir" GTEST_PATH_SEP_ "subdir" GTEST_PATH_SEP_ "afile")
.RemoveFileName().c_str());
}
// RemoveFileName "/afile" -> "/"
TEST(RemoveFileNameTest, GivesRootDir) {
- EXPECT_STREQ(PATH_SEP,
- FilePath(PATH_SEP "afile").RemoveFileName().c_str());
+ EXPECT_STREQ(GTEST_PATH_SEP_,
+ FilePath(GTEST_PATH_SEP_ "afile").RemoveFileName().c_str());
}
TEST(MakeFileNameTest, GenerateWhenNumberIsZero) {
FilePath actual = FilePath::MakeFileName(FilePath("foo"), FilePath("bar"),
0, "xml");
- EXPECT_STREQ("foo" PATH_SEP "bar.xml", actual.c_str());
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str());
}
TEST(MakeFileNameTest, GenerateFileNameNumberGtZero) {
FilePath actual = FilePath::MakeFileName(FilePath("foo"), FilePath("bar"),
12, "xml");
- EXPECT_STREQ("foo" PATH_SEP "bar_12.xml", actual.c_str());
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar_12.xml", actual.c_str());
}
TEST(MakeFileNameTest, GenerateFileNameWithSlashNumberIsZero) {
- FilePath actual = FilePath::MakeFileName(FilePath("foo" PATH_SEP),
+ FilePath actual = FilePath::MakeFileName(FilePath("foo" GTEST_PATH_SEP_),
FilePath("bar"), 0, "xml");
- EXPECT_STREQ("foo" PATH_SEP "bar.xml", actual.c_str());
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str());
}
TEST(MakeFileNameTest, GenerateFileNameWithSlashNumberGtZero) {
- FilePath actual = FilePath::MakeFileName(FilePath("foo" PATH_SEP),
+ FilePath actual = FilePath::MakeFileName(FilePath("foo" GTEST_PATH_SEP_),
FilePath("bar"), 12, "xml");
- EXPECT_STREQ("foo" PATH_SEP "bar_12.xml", actual.c_str());
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar_12.xml", actual.c_str());
}
TEST(MakeFileNameTest, GenerateWhenNumberIsZeroAndDirIsEmpty) {
@@ -232,13 +232,13 @@ TEST(MakeFileNameTest, GenerateWhenNumberIsNotZeroAndDirIsEmpty) {
TEST(ConcatPathsTest, WorksWhenDirDoesNotEndWithPathSep) {
FilePath actual = FilePath::ConcatPaths(FilePath("foo"),
FilePath("bar.xml"));
- EXPECT_STREQ("foo" PATH_SEP "bar.xml", actual.c_str());
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str());
}
TEST(ConcatPathsTest, WorksWhenPath1EndsWithPathSep) {
- FilePath actual = FilePath::ConcatPaths(FilePath("foo" PATH_SEP),
+ FilePath actual = FilePath::ConcatPaths(FilePath("foo" GTEST_PATH_SEP_),
FilePath("bar.xml"));
- EXPECT_STREQ("foo" PATH_SEP "bar.xml", actual.c_str());
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar.xml", actual.c_str());
}
TEST(ConcatPathsTest, Path1BeingEmpty) {
@@ -250,7 +250,7 @@ TEST(ConcatPathsTest, Path1BeingEmpty) {
TEST(ConcatPathsTest, Path2BeingEmpty) {
FilePath actual = FilePath::ConcatPaths(FilePath("foo"),
FilePath(""));
- EXPECT_STREQ("foo" PATH_SEP, actual.c_str());
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_, actual.c_str());
}
TEST(ConcatPathsTest, BothPathBeingEmpty) {
@@ -260,21 +260,24 @@ TEST(ConcatPathsTest, BothPathBeingEmpty) {
}
TEST(ConcatPathsTest, Path1ContainsPathSep) {
- FilePath actual = FilePath::ConcatPaths(FilePath("foo" PATH_SEP "bar"),
+ FilePath actual = FilePath::ConcatPaths(FilePath("foo" GTEST_PATH_SEP_ "bar"),
FilePath("foobar.xml"));
- EXPECT_STREQ("foo" PATH_SEP "bar" PATH_SEP "foobar.xml", actual.c_str());
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_ "foobar.xml",
+ actual.c_str());
}
TEST(ConcatPathsTest, Path2ContainsPathSep) {
- FilePath actual = FilePath::ConcatPaths(FilePath("foo" PATH_SEP),
- FilePath("bar" PATH_SEP "bar.xml"));
- EXPECT_STREQ("foo" PATH_SEP "bar" PATH_SEP "bar.xml", actual.c_str());
+ FilePath actual = FilePath::ConcatPaths(
+ FilePath("foo" GTEST_PATH_SEP_),
+ FilePath("bar" GTEST_PATH_SEP_ "bar.xml"));
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_ "bar.xml",
+ actual.c_str());
}
TEST(ConcatPathsTest, Path2EndsWithPathSep) {
FilePath actual = FilePath::ConcatPaths(FilePath("foo"),
- FilePath("bar" PATH_SEP));
- EXPECT_STREQ("foo" PATH_SEP "bar" PATH_SEP, actual.c_str());
+ FilePath("bar" GTEST_PATH_SEP_));
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_, actual.c_str());
}
// RemoveTrailingPathSeparator "" -> ""
@@ -291,25 +294,27 @@ TEST(RemoveTrailingPathSeparatorTest, FileNoSlashString) {
// RemoveTrailingPathSeparator "foo/" -> "foo"
TEST(RemoveTrailingPathSeparatorTest, ShouldRemoveTrailingSeparator) {
- EXPECT_STREQ("foo",
- FilePath("foo" PATH_SEP).RemoveTrailingPathSeparator().c_str());
+ EXPECT_STREQ(
+ "foo",
+ FilePath("foo" GTEST_PATH_SEP_).RemoveTrailingPathSeparator().c_str());
}
// RemoveTrailingPathSeparator "foo/bar/" -> "foo/bar/"
TEST(RemoveTrailingPathSeparatorTest, ShouldRemoveLastSeparator) {
- EXPECT_STREQ("foo" PATH_SEP "bar",
- FilePath("foo" PATH_SEP "bar" PATH_SEP).RemoveTrailingPathSeparator()
- .c_str());
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
+ FilePath("foo" GTEST_PATH_SEP_ "bar" GTEST_PATH_SEP_)
+ .RemoveTrailingPathSeparator().c_str());
}
// RemoveTrailingPathSeparator "foo/bar" -> "foo/bar"
TEST(RemoveTrailingPathSeparatorTest, ShouldReturnUnmodified) {
- EXPECT_STREQ("foo" PATH_SEP "bar",
- FilePath("foo" PATH_SEP "bar").RemoveTrailingPathSeparator().c_str());
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
+ FilePath("foo" GTEST_PATH_SEP_ "bar")
+ .RemoveTrailingPathSeparator().c_str());
}
TEST(DirectoryTest, RootDirectoryExists) {
-#ifdef GTEST_OS_WINDOWS // We are on Windows.
+#if GTEST_OS_WINDOWS // We are on Windows.
char current_drive[_MAX_PATH]; // NOLINT
current_drive[0] = static_cast<char>(_getdrive() + 'A' - 1);
current_drive[1] = ':';
@@ -321,7 +326,7 @@ TEST(DirectoryTest, RootDirectoryExists) {
#endif // GTEST_OS_WINDOWS
}
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
TEST(DirectoryTest, RootOfWrongDriveDoesNotExists) {
const int saved_drive_ = _getdrive();
// Find a drive that doesn't exist. Start with 'Z' to avoid common ones.
@@ -347,7 +352,7 @@ TEST(DirectoryTest, EmptyPathDirectoryDoesNotExist) {
#endif // ! _WIN32_WCE
TEST(DirectoryTest, CurrentDirectoryExists) {
-#ifdef 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.
EXPECT_TRUE(FilePath(".").DirectoryExists());
EXPECT_TRUE(FilePath(".\\").DirectoryExists());
@@ -365,32 +370,33 @@ TEST(NormalizeTest, NullStringsEqualEmptyDirectory) {
// "foo/bar" == foo//bar" == "foo///bar"
TEST(NormalizeTest, MultipleConsecutiveSepaparatorsInMidstring) {
- EXPECT_STREQ("foo" PATH_SEP "bar",
- FilePath("foo" PATH_SEP "bar").c_str());
- EXPECT_STREQ("foo" PATH_SEP "bar",
- FilePath("foo" PATH_SEP PATH_SEP "bar").c_str());
- EXPECT_STREQ("foo" PATH_SEP "bar",
- FilePath("foo" PATH_SEP PATH_SEP PATH_SEP "bar").c_str());
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
+ FilePath("foo" GTEST_PATH_SEP_ "bar").c_str());
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
+ FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").c_str());
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_ "bar",
+ FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_
+ GTEST_PATH_SEP_ "bar").c_str());
}
// "/bar" == //bar" == "///bar"
TEST(NormalizeTest, MultipleConsecutiveSepaparatorsAtStringStart) {
- EXPECT_STREQ(PATH_SEP "bar",
- FilePath(PATH_SEP "bar").c_str());
- EXPECT_STREQ(PATH_SEP "bar",
- FilePath(PATH_SEP PATH_SEP "bar").c_str());
- EXPECT_STREQ(PATH_SEP "bar",
- FilePath(PATH_SEP PATH_SEP PATH_SEP "bar").c_str());
+ EXPECT_STREQ(GTEST_PATH_SEP_ "bar",
+ FilePath(GTEST_PATH_SEP_ "bar").c_str());
+ EXPECT_STREQ(GTEST_PATH_SEP_ "bar",
+ FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").c_str());
+ EXPECT_STREQ(GTEST_PATH_SEP_ "bar",
+ FilePath(GTEST_PATH_SEP_ GTEST_PATH_SEP_ GTEST_PATH_SEP_ "bar").c_str());
}
// "foo/" == foo//" == "foo///"
TEST(NormalizeTest, MultipleConsecutiveSepaparatorsAtStringEnd) {
- EXPECT_STREQ("foo" PATH_SEP,
- FilePath("foo" PATH_SEP).c_str());
- EXPECT_STREQ("foo" PATH_SEP,
- FilePath("foo" PATH_SEP PATH_SEP).c_str());
- EXPECT_STREQ("foo" PATH_SEP,
- FilePath("foo" PATH_SEP PATH_SEP PATH_SEP).c_str());
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_,
+ FilePath("foo" GTEST_PATH_SEP_).c_str());
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_,
+ FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_).c_str());
+ EXPECT_STREQ("foo" GTEST_PATH_SEP_,
+ FilePath("foo" GTEST_PATH_SEP_ GTEST_PATH_SEP_ GTEST_PATH_SEP_).c_str());
}
TEST(AssignmentOperatorTest, DefaultAssignedToNonDefault) {
@@ -421,7 +427,7 @@ class DirectoryCreationTest : public Test {
virtual void SetUp() {
testdata_path_.Set(FilePath(String::Format("%s%s%s",
TempDir().c_str(), GetCurrentExecutableName().c_str(),
- "_directory_creation" PATH_SEP "test" PATH_SEP)));
+ "_directory_creation" GTEST_PATH_SEP_ "test" GTEST_PATH_SEP_)));
testdata_file_.Set(testdata_path_.RemoveTrailingPathSeparator());
unique_file0_.Set(FilePath::MakeFileName(testdata_path_, FilePath("unique"),
@@ -432,7 +438,7 @@ class DirectoryCreationTest : public Test {
remove(testdata_file_.c_str());
remove(unique_file0_.c_str());
remove(unique_file1_.c_str());
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
_rmdir(testdata_path_.c_str());
#else
rmdir(testdata_path_.c_str());
@@ -443,7 +449,7 @@ class DirectoryCreationTest : public Test {
remove(testdata_file_.c_str());
remove(unique_file0_.c_str());
remove(unique_file1_.c_str());
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
_rmdir(testdata_path_.c_str());
#else
rmdir(testdata_path_.c_str());
@@ -454,7 +460,7 @@ class DirectoryCreationTest : public Test {
#ifdef _WIN32_WCE
return String("\\temp\\");
-#elif defined(GTEST_OS_WINDOWS)
+#elif GTEST_OS_WINDOWS
// MSVC 8 deprecates getenv(), so we want to suppress warning 4996
// (deprecated function) there.
#pragma warning(push) // Saves the current warning state.
@@ -474,7 +480,7 @@ class DirectoryCreationTest : public Test {
}
void CreateTextFile(const char* filename) {
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
// MSVC 8 deprecates fopen(), so we want to suppress warning 4996
// (deprecated function) there.#pragma warning(push)
#pragma warning(push) // Saves the current warning state.
@@ -585,18 +591,18 @@ TEST(FilePathTest, RemoveExtensionWhenThereIsNoExtension) {
TEST(FilePathTest, IsDirectory) {
EXPECT_FALSE(FilePath("cola").IsDirectory());
- EXPECT_TRUE(FilePath("koala" PATH_SEP).IsDirectory());
+ EXPECT_TRUE(FilePath("koala" GTEST_PATH_SEP_).IsDirectory());
}
TEST(FilePathTest, IsAbsolutePath) {
- EXPECT_FALSE(FilePath("is" PATH_SEP "relative").IsAbsolutePath());
+ EXPECT_FALSE(FilePath("is" GTEST_PATH_SEP_ "relative").IsAbsolutePath());
EXPECT_FALSE(FilePath("").IsAbsolutePath());
-#ifdef GTEST_OS_WINDOWS
- EXPECT_TRUE(FilePath("c:\\" PATH_SEP "is_not" PATH_SEP "relative")
- .IsAbsolutePath());
- EXPECT_FALSE(FilePath("c:foo" PATH_SEP "bar").IsAbsolutePath());
+#if GTEST_OS_WINDOWS
+ EXPECT_TRUE(FilePath("c:\\" GTEST_PATH_SEP_ "is_not"
+ GTEST_PATH_SEP_ "relative").IsAbsolutePath());
+ EXPECT_FALSE(FilePath("c:foo" GTEST_PATH_SEP_ "bar").IsAbsolutePath());
#else
- EXPECT_TRUE(FilePath(PATH_SEP "is_not" PATH_SEP "relative")
+ EXPECT_TRUE(FilePath(GTEST_PATH_SEP_ "is_not" GTEST_PATH_SEP_ "relative")
.IsAbsolutePath());
#endif // GTEST_OS_WINDOWS
}
@@ -605,4 +611,4 @@ TEST(FilePathTest, IsAbsolutePath) {
} // namespace internal
} // namespace testing
-#undef PATH_SEP
+#undef GTEST_PATH_SEP_
diff --git a/test/gtest-options_test.cc b/test/gtest-options_test.cc
index e3e7bd7..5f24e7e 100644
--- a/test/gtest-options_test.cc
+++ b/test/gtest-options_test.cc
@@ -42,7 +42,7 @@
#ifdef _WIN32_WCE
#include <windows.h>
-#elif defined(GTEST_OS_WINDOWS)
+#elif GTEST_OS_WINDOWS
#include <direct.h>
#endif // _WIN32_WCE
@@ -51,9 +51,9 @@
// included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in
// his code.
-#define GTEST_IMPLEMENTATION
+#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION
+#undef GTEST_IMPLEMENTATION_
namespace testing {
namespace internal {
@@ -89,7 +89,7 @@ TEST(XmlOutputTest, GetOutputFileSingleFile) {
}
TEST(XmlOutputTest, GetOutputFileFromDirectoryPath) {
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
GTEST_FLAG(output) = "xml:path\\";
const String& output_file = UnitTestOptions::GetAbsolutePathToOutputFile();
EXPECT_TRUE(
@@ -121,7 +121,7 @@ TEST(XmlOutputTest, GetOutputFileFromDirectoryPath) {
TEST(OutputFileHelpersTest, GetCurrentExecutableName) {
const FilePath executable = GetCurrentExecutableName();
const char* const exe_str = executable.c_str();
-#if defined(_WIN32_WCE) || defined(GTEST_OS_WINDOWS)
+#if defined(_WIN32_WCE) || GTEST_OS_WINDOWS
ASSERT_TRUE(_strcmpi("gtest-options_test", exe_str) == 0 ||
_strcmpi("gtest-options-ex_test", exe_str) == 0)
<< "GetCurrentExecutableName() returns " << exe_str;
@@ -149,7 +149,7 @@ class XmlOutputChangeDirTest : public Test {
}
void ChDir(const char* dir) {
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
_chdir(dir);
#else
chdir(dir);
@@ -181,7 +181,7 @@ TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativeFile) {
}
TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativePath) {
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
GTEST_FLAG(output) = "xml:path\\";
const String& output_file = UnitTestOptions::GetAbsolutePathToOutputFile();
EXPECT_TRUE(
@@ -211,7 +211,7 @@ TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithRelativePath) {
}
TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsoluteFile) {
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
GTEST_FLAG(output) = "xml:c:\\tmp\\filename.abc";
EXPECT_STREQ(FilePath("c:\\tmp\\filename.abc").c_str(),
UnitTestOptions::GetAbsolutePathToOutputFile().c_str());
@@ -223,7 +223,7 @@ TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsoluteFile) {
}
TEST_F(XmlOutputChangeDirTest, PreserveOriginalWorkingDirWithAbsolutePath) {
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
GTEST_FLAG(output) = "xml:c:\\tmp\\";
const String& output_file = UnitTestOptions::GetAbsolutePathToOutputFile();
EXPECT_TRUE(
diff --git a/test/gtest-param-test2_test.cc b/test/gtest-param-test2_test.cc
index 4e54206..ccb6cfa 100644
--- a/test/gtest-param-test2_test.cc
+++ b/test/gtest-param-test2_test.cc
@@ -36,7 +36,7 @@
#include "test/gtest-param-test_test.h"
-#ifdef GTEST_HAS_PARAM_TEST
+#if GTEST_HAS_PARAM_TEST
using ::testing::Values;
using ::testing::internal::ParamGenerator;
diff --git a/test/gtest-param-test_test.cc b/test/gtest-param-test_test.cc
index 22ba1a3..6308021 100644
--- a/test/gtest-param-test_test.cc
+++ b/test/gtest-param-test_test.cc
@@ -35,7 +35,7 @@
#include <gtest/gtest.h>
-#ifdef GTEST_HAS_PARAM_TEST
+#if GTEST_HAS_PARAM_TEST
#include <algorithm>
#include <iostream>
@@ -43,9 +43,9 @@
#include <vector>
// To include gtest-internal-inl.h.
-#define GTEST_IMPLEMENTATION
+#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h" // for UnitTestOptions
-#undef GTEST_IMPLEMENTATION
+#undef GTEST_IMPLEMENTATION_
#include "test/gtest-param-test_test.h"
@@ -60,7 +60,7 @@ using ::testing::TestWithParam;
using ::testing::Values;
using ::testing::ValuesIn;
-#ifdef GTEST_HAS_COMBINE
+#if GTEST_HAS_COMBINE
using ::testing::Combine;
using ::std::tr1::get;
using ::std::tr1::make_tuple;
@@ -398,7 +398,7 @@ TEST(BoolTest, BoolWorks) {
VerifyGenerator(gen, expected_values);
}
-#ifdef GTEST_HAS_COMBINE
+#if GTEST_HAS_COMBINE
template <typename T1, typename T2>
::std::ostream& operator<<(::std::ostream& stream, const tuple<T1, T2>& value) {
@@ -774,13 +774,13 @@ INSTANTIATE_TEST_CASE_P(ZeroToFiveSequence, NamingTest, Range(0, 5));
#endif // GTEST_HAS_PARAM_TEST
TEST(CompileTest, CombineIsDefinedOnlyWhenGtestHasParamTestIsDefined) {
-#if defined(GTEST_HAS_COMBINE) && !defined(GTEST_HAS_PARAM_TEST)
+#if GTEST_HAS_COMBINE && !GTEST_HAS_PARAM_TEST
FAIL() << "GTEST_HAS_COMBINE is defined while GTEST_HAS_PARAM_TEST is not\n"
#endif
}
int main(int argc, char **argv) {
-#ifdef GTEST_HAS_PARAM_TEST
+#if GTEST_HAS_PARAM_TEST
// Used in TestGenerationTest test case.
AddGlobalTestEnvironment(TestGenerationTest::Environment::Instance());
// Used in GeneratorEvaluationTest test case.
diff --git a/test/gtest-param-test_test.h b/test/gtest-param-test_test.h
index ee7bea0..b7f9493 100644
--- a/test/gtest-param-test_test.h
+++ b/test/gtest-param-test_test.h
@@ -39,7 +39,7 @@
#include <gtest/gtest.h>
-#ifdef GTEST_HAS_PARAM_TEST
+#if GTEST_HAS_PARAM_TEST
// Test fixture for testing definition and instantiation of a test
// in separate translation units.
diff --git a/test/gtest-port_test.cc b/test/gtest-port_test.cc
index 0041c91..40d36bd 100644
--- a/test/gtest-port_test.cc
+++ b/test/gtest-port_test.cc
@@ -40,9 +40,9 @@
// included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in
// his code.
-#define GTEST_IMPLEMENTATION
+#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION
+#undef GTEST_IMPLEMENTATION_
namespace testing {
namespace internal {
@@ -76,7 +76,7 @@ TEST(GtestCheckSyntaxTest, WorksWithSwitch) {
GTEST_CHECK_(true) << "Check failed in switch case";
}
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
TEST(GtestCheckDeathTest, DiesWithCorrectOutputOnFailure) {
const bool a_false_condition = false;
diff --git a/test/gtest-test-part_test.cc b/test/gtest-test-part_test.cc
index f4f0d1d..f9e2e5d 100644
--- a/test/gtest-test-part_test.cc
+++ b/test/gtest-test-part_test.cc
@@ -117,7 +117,7 @@ TEST_F(TestPartResultArrayTest, ContainsGivenResultsAfterTwoAppends) {
EXPECT_STREQ("Failure 2", results.GetTestPartResult(1).message());
}
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
typedef TestPartResultArrayTest TestPartResultArrayDeathTest;
diff --git a/test/gtest-typed-test2_test.cc b/test/gtest-typed-test2_test.cc
index 7dabe76..79a8a87 100644
--- a/test/gtest-typed-test2_test.cc
+++ b/test/gtest-typed-test2_test.cc
@@ -34,7 +34,7 @@
#include "test/gtest-typed-test_test.h"
#include <gtest/gtest.h>
-#ifdef GTEST_HAS_TYPED_TEST_P
+#if GTEST_HAS_TYPED_TEST_P
// Tests that the same type-parameterized test case can be
// instantiated in different translation units linked together.
diff --git a/test/gtest-typed-test_test.cc b/test/gtest-typed-test_test.cc
index ec03c95..9ba9675 100644
--- a/test/gtest-typed-test_test.cc
+++ b/test/gtest-typed-test_test.cc
@@ -82,7 +82,7 @@ template <typename T>
T* CommonTest<T>::shared_ = NULL;
// This #ifdef block tests typed tests.
-#ifdef GTEST_HAS_TYPED_TEST
+#if GTEST_HAS_TYPED_TEST
using testing::Types;
@@ -166,7 +166,7 @@ TYPED_TEST(NumericTest, DefaultIsZero) {
#endif // GTEST_HAS_TYPED_TEST
// This #ifdef block tests type-parameterized tests.
-#ifdef GTEST_HAS_TYPED_TEST_P
+#if GTEST_HAS_TYPED_TEST_P
using testing::Types;
using testing::internal::TypedTestCasePState;
@@ -198,7 +198,7 @@ TEST_F(TypedTestCasePStateTest, IgnoresOrderAndSpaces) {
state_.VerifyRegisteredTestNames("foo.cc", 1, tests));
}
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
typedef TypedTestCasePStateTest TypedTestCasePStateDeathTest;
diff --git a/test/gtest-typed-test_test.h b/test/gtest-typed-test_test.h
index 2e89dc4..ecbe5b3 100644
--- a/test/gtest-typed-test_test.h
+++ b/test/gtest-typed-test_test.h
@@ -34,7 +34,7 @@
#include <gtest/gtest.h>
-#ifdef GTEST_HAS_TYPED_TEST_P
+#if GTEST_HAS_TYPED_TEST_P
using testing::Test;
diff --git a/test/gtest_break_on_failure_unittest_.cc b/test/gtest_break_on_failure_unittest_.cc
index 84c4a2e..26b5bd3 100644
--- a/test/gtest_break_on_failure_unittest_.cc
+++ b/test/gtest_break_on_failure_unittest_.cc
@@ -41,7 +41,7 @@
#include <gtest/gtest.h>
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
#include <windows.h>
#endif
@@ -56,7 +56,7 @@ TEST(Foo, Bar) {
int main(int argc, char **argv) {
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
// Suppresses display of the Windows error dialog upon encountering
// a general protection fault (segment violation).
SetErrorMode(SEM_NOGPFAULTERRORBOX | SEM_FAILCRITICALERRORS);
diff --git a/test/gtest_env_var_test_.cc b/test/gtest_env_var_test_.cc
index bbccd46..dd820e4 100644
--- a/test/gtest_env_var_test_.cc
+++ b/test/gtest_env_var_test_.cc
@@ -36,9 +36,9 @@
#include <iostream>
-#define GTEST_IMPLEMENTATION
+#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION
+#undef GTEST_IMPLEMENTATION_
using ::std::cout;
diff --git a/test/gtest_filter_unittest_.cc b/test/gtest_filter_unittest_.cc
index 22638e0..dd4f716 100644
--- a/test/gtest_filter_unittest_.cc
+++ b/test/gtest_filter_unittest_.cc
@@ -94,7 +94,7 @@ TEST(BazTest, DISABLED_TestC) {
// Test case HasDeathTest
TEST(HasDeathTest, Test1) {
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
EXPECT_DEATH({exit(1);},
".*");
#endif // GTEST_HAS_DEATH_TEST
@@ -103,7 +103,7 @@ TEST(HasDeathTest, Test1) {
// We need at least two death tests to make sure that the all death tests
// aren't on the first shard.
TEST(HasDeathTest, Test2) {
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
EXPECT_DEATH({exit(1);},
".*");
#endif // GTEST_HAS_DEATH_TEST
@@ -126,7 +126,7 @@ TEST(DISABLED_FoobarbazTest, TestA) {
FAIL() << "Expected failure.";
}
-#ifdef GTEST_HAS_PARAM_TEST
+#if GTEST_HAS_PARAM_TEST
class ParamTest : public testing::TestWithParam<int> {
};
diff --git a/test/gtest_output_test_.cc b/test/gtest_output_test_.cc
index f5748d1..a8ffa41 100644
--- a/test/gtest_output_test_.cc
+++ b/test/gtest_output_test_.cc
@@ -40,9 +40,9 @@
// included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in
// his code.
-#define GTEST_IMPLEMENTATION
+#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION
+#undef GTEST_IMPLEMENTATION_
#include <stdlib.h>
@@ -50,7 +50,7 @@
#include <pthread.h>
#endif // GTEST_HAS_PTHREAD
-#ifdef GTEST_OS_LINUX
+#if GTEST_OS_LINUX
#include <string.h>
#include <signal.h>
#include <string>
@@ -355,7 +355,7 @@ TEST_F(FatalFailureInSetUpTest, FailureInSetUp) {
<< "We should never get here, as SetUp() failed.";
}
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
// This group of tests verifies that Google Test handles SEH and C++
// exceptions correctly.
@@ -722,7 +722,7 @@ TEST(ExpectFatalFailureTest, FailsWhenStatementThrows) {
#endif // GTEST_HAS_EXCEPTIONS
// This #ifdef block tests the output of typed tests.
-#ifdef GTEST_HAS_TYPED_TEST
+#if GTEST_HAS_TYPED_TEST
template <typename T>
class TypedTest : public testing::Test {
@@ -741,7 +741,7 @@ TYPED_TEST(TypedTest, Failure) {
#endif // GTEST_HAS_TYPED_TEST
// This #ifdef block tests the output of type-parameterized tests.
-#ifdef GTEST_HAS_TYPED_TEST_P
+#if GTEST_HAS_TYPED_TEST_P
template <typename T>
class TypedTestP : public testing::Test {
@@ -764,7 +764,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(Unsigned, TypedTestP, UnsignedTypes);
#endif // GTEST_HAS_TYPED_TEST_P
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
// We rely on the golden file to verify that tests whose test case
// name ends with DeathTest are run first.
@@ -772,7 +772,7 @@ INSTANTIATE_TYPED_TEST_CASE_P(Unsigned, TypedTestP, UnsignedTypes);
TEST(ADeathTest, ShouldRunFirst) {
}
-#ifdef GTEST_HAS_TYPED_TEST
+#if GTEST_HAS_TYPED_TEST
// We rely on the golden file to verify that typed tests whose test
// case name ends with DeathTest are run first.
@@ -789,7 +789,7 @@ TYPED_TEST(ATypedDeathTest, ShouldRunFirst) {
#endif // GTEST_HAS_TYPED_TEST
-#ifdef GTEST_HAS_TYPED_TEST_P
+#if GTEST_HAS_TYPED_TEST_P
// We rely on the golden file to verify that type-parameterized tests
@@ -984,7 +984,7 @@ int main(int argc, char **argv) {
String(argv[1]) == "--gtest_internal_skip_environment_and_ad_hoc_tests")
GTEST_FLAG(internal_skip_environment_and_ad_hoc_tests) = true;
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
if (testing::internal::GTEST_FLAG(internal_run_death_test) != "") {
// Skip the usual output capturing if we're running as the child
// process of an threadsafe-style death test.
diff --git a/test/gtest_repeat_test.cc b/test/gtest_repeat_test.cc
index 65298bf..39a0601 100644
--- a/test/gtest_repeat_test.cc
+++ b/test/gtest_repeat_test.cc
@@ -40,9 +40,9 @@
// included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in
// his code.
-#define GTEST_IMPLEMENTATION
+#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION
+#undef GTEST_IMPLEMENTATION_
namespace testing {
@@ -112,7 +112,7 @@ int g_death_test_count = 0;
TEST(BarDeathTest, ThreadSafeAndFast) {
g_death_test_count++;
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
GTEST_FLAG(death_test_style) = "threadsafe";
EXPECT_DEATH(abort(), "");
@@ -121,7 +121,7 @@ TEST(BarDeathTest, ThreadSafeAndFast) {
#endif // GTEST_HAS_DEATH_TEST
}
-#ifdef GTEST_HAS_PARAM_TEST
+#if GTEST_HAS_PARAM_TEST
int g_param_test_count = 0;
const int kNumberOfParamTests = 10;
@@ -146,7 +146,7 @@ void ResetCounts() {
g_should_fail_count = 0;
g_should_pass_count = 0;
g_death_test_count = 0;
-#ifdef GTEST_HAS_PARAM_TEST
+#if GTEST_HAS_PARAM_TEST
g_param_test_count = 0;
#endif // GTEST_HAS_PARAM_TEST
}
@@ -158,7 +158,7 @@ void CheckCounts(int expected) {
GTEST_CHECK_INT_EQ_(expected, g_should_fail_count);
GTEST_CHECK_INT_EQ_(expected, g_should_pass_count);
GTEST_CHECK_INT_EQ_(expected, g_death_test_count);
-#ifdef GTEST_HAS_PARAM_TEST
+#if GTEST_HAS_PARAM_TEST
GTEST_CHECK_INT_EQ_(expected * kNumberOfParamTests, g_param_test_count);
#endif // GTEST_HAS_PARAM_TEST
}
@@ -203,7 +203,7 @@ void TestRepeatWithFilterForSuccessfulTests(int repeat) {
GTEST_CHECK_INT_EQ_(0, g_should_fail_count);
GTEST_CHECK_INT_EQ_(repeat, g_should_pass_count);
GTEST_CHECK_INT_EQ_(repeat, g_death_test_count);
-#ifdef GTEST_HAS_PARAM_TEST
+#if GTEST_HAS_PARAM_TEST
GTEST_CHECK_INT_EQ_(repeat * kNumberOfParamTests, g_param_test_count);
#endif // GTEST_HAS_PARAM_TEST
}
@@ -221,7 +221,7 @@ void TestRepeatWithFilterForFailedTests(int repeat) {
GTEST_CHECK_INT_EQ_(repeat, g_should_fail_count);
GTEST_CHECK_INT_EQ_(0, g_should_pass_count);
GTEST_CHECK_INT_EQ_(0, g_death_test_count);
-#ifdef GTEST_HAS_PARAM_TEST
+#if GTEST_HAS_PARAM_TEST
GTEST_CHECK_INT_EQ_(0, g_param_test_count);
#endif // GTEST_HAS_PARAM_TEST
}
diff --git a/test/gtest_stress_test.cc b/test/gtest_stress_test.cc
index c58f56c..55e8bf4 100644
--- a/test/gtest_stress_test.cc
+++ b/test/gtest_stress_test.cc
@@ -38,9 +38,9 @@
// We must define this macro in order to #include
// gtest-internal-inl.h. This is how Google Test prevents a user from
// accidentally depending on its internal implementation.
-#define GTEST_IMPLEMENTATION
+#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION
+#undef GTEST_IMPLEMENTATION_
namespace testing {
namespace {
diff --git a/test/gtest_unittest.cc b/test/gtest_unittest.cc
index f8dbff0..8dabcc9 100644
--- a/test/gtest_unittest.cc
+++ b/test/gtest_unittest.cc
@@ -59,9 +59,9 @@ TEST(CommandLineFlagsTest, CanBeAccessedInCodeOnceGTestHIsIncluded) {
// included, or there will be a compiler error. This trick is to
// prevent a user from accidentally including gtest-internal-inl.h in
// his code.
-#define GTEST_IMPLEMENTATION
+#define GTEST_IMPLEMENTATION_ 1
#include "src/gtest-internal-inl.h"
-#undef GTEST_IMPLEMENTATION
+#undef GTEST_IMPLEMENTATION_
#include <stdlib.h>
@@ -69,7 +69,7 @@ TEST(CommandLineFlagsTest, CanBeAccessedInCodeOnceGTestHIsIncluded) {
#include <pthread.h>
#endif // GTEST_HAS_PTHREAD
-#ifdef GTEST_OS_LINUX
+#if GTEST_OS_LINUX
#include <string.h>
#include <signal.h>
#include <sys/stat.h>
@@ -201,7 +201,7 @@ TEST(FormatTimeInMillisAsSecondsTest, FormatsNegativeNumber) {
EXPECT_STREQ("-3", FormatTimeInMillisAsSeconds(-3000));
}
-#ifndef GTEST_OS_SYMBIAN
+#if !GTEST_OS_SYMBIAN
// NULL testing does not work with Symbian compilers.
// Tests that GTEST_IS_NULL_LITERAL_(x) is true when x is a null
@@ -225,7 +225,7 @@ TEST(NullLiteralTest, IsFalseForNonNullLiterals) {
EXPECT_FALSE(GTEST_IS_NULL_LITERAL_(static_cast<void*>(NULL)));
}
-#endif // GTEST_OS_SYMBIAN
+#endif // !GTEST_OS_SYMBIAN
//
// Tests CodePointToUtf8().
@@ -266,7 +266,7 @@ TEST(CodePointToUtf8Test, CanEncode12To16Bits) {
EXPECT_STREQ("\xEC\x9D\x8D", CodePointToUtf8(L'\xC74D', buffer));
}
-#ifndef GTEST_WIDE_STRING_USES_UTF16_
+#if !GTEST_WIDE_STRING_USES_UTF16_
// Tests in this group require a wchar_t to hold > 16 bits, and thus
// are skipped on Windows, Cygwin, and Symbian, where a wchar_t is
// 16-bit wide. This code may not compile on those systems.
@@ -292,7 +292,7 @@ TEST(CodePointToUtf8Test, CanEncodeInvalidCodePoint) {
CodePointToUtf8(L'\x1234ABCD', buffer));
}
-#endif // GTEST_WIDE_STRING_USES_UTF16_
+#endif // !GTEST_WIDE_STRING_USES_UTF16_
// Tests WideStringToUtf8().
@@ -346,7 +346,7 @@ TEST(WideStringToUtf8Test, StopsWhenLengthLimitReached) {
}
-#ifndef GTEST_WIDE_STRING_USES_UTF16_
+#if !GTEST_WIDE_STRING_USES_UTF16_
// Tests that Unicode code-points that have 17 to 21 bits are encoded
// as 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx. This code may not compile
// on the systems using UTF-16 encoding.
@@ -365,7 +365,7 @@ TEST(WideStringToUtf8Test, CanEncodeInvalidCodePoint) {
EXPECT_STREQ("(Invalid Unicode 0xABCDFF)",
WideStringToUtf8(L"\xABCDFF", -1).c_str());
}
-#else
+#else // !GTEST_WIDE_STRING_USES_UTF16_
// Tests that surrogate pairs are encoded correctly on the systems using
// UTF-16 encoding in the wide strings.
TEST(WideStringToUtf8Test, CanEncodeValidUtf16SUrrogatePairs) {
@@ -383,10 +383,10 @@ TEST(WideStringToUtf8Test, CanEncodeInvalidUtf16SurrogatePair) {
// Trailing surrogate appearas without a leading surrogate.
EXPECT_STREQ("\xED\xB0\x80PQR", WideStringToUtf8(L"\xDC00PQR", -1).c_str());
}
-#endif // GTEST_WIDE_STRING_USES_UTF16_
+#endif // !GTEST_WIDE_STRING_USES_UTF16_
// Tests that codepoint concatenation works correctly.
-#ifndef GTEST_WIDE_STRING_USES_UTF16_
+#if !GTEST_WIDE_STRING_USES_UTF16_
TEST(WideStringToUtf8Test, ConcatenatesCodepointsCorrectly) {
EXPECT_STREQ(
"\xF4\x88\x98\xB4"
@@ -403,7 +403,7 @@ TEST(WideStringToUtf8Test, ConcatenatesCodepointsCorrectly) {
"\xEC\x9D\x8D" "\n" "\xD5\xB6" "\xE0\xA3\x93",
WideStringToUtf8(L"\xC74D\n\x576\x8D3", -1).c_str());
}
-#endif // GTEST_WIDE_STRING_USES_UTF16_
+#endif // !GTEST_WIDE_STRING_USES_UTF16_
// Tests the List template class.
@@ -725,7 +725,7 @@ TEST(StringTest, CanBeAssignedSelf) {
EXPECT_STREQ("hello", dest.c_str());
}
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
// Tests String::ShowWideCString().
TEST(StringTest, ShowWideCString) {
@@ -1265,7 +1265,7 @@ static void SetEnv(const char* name, const char* value) {
#ifdef _WIN32_WCE
// Environment variables are not supported on Windows CE.
return;
-#elif defined(GTEST_OS_WINDOWS) // If we are on Windows proper.
+#elif GTEST_OS_WINDOWS // If we are on Windows proper.
_putenv((Message() << name << "=" << value).GetString().c_str());
#else
if (*value == '\0') {
@@ -1286,7 +1286,7 @@ using testing::internal::Int32FromGTestEnv;
// Tests that Int32FromGTestEnv() returns the default value when the
// environment variable is not set.
TEST(Int32FromGTestEnvTest, ReturnsDefaultWhenVariableIsNotSet) {
- SetEnv(GTEST_FLAG_PREFIX_UPPER "TEMP", "");
+ SetEnv(GTEST_FLAG_PREFIX_UPPER_ "TEMP", "");
EXPECT_EQ(10, Int32FromGTestEnv("temp", 10));
}
@@ -1295,10 +1295,10 @@ TEST(Int32FromGTestEnvTest, ReturnsDefaultWhenVariableIsNotSet) {
TEST(Int32FromGTestEnvTest, ReturnsDefaultWhenValueOverflows) {
printf("(expecting 2 warnings)\n");
- SetEnv(GTEST_FLAG_PREFIX_UPPER "TEMP", "12345678987654321");
+ SetEnv(GTEST_FLAG_PREFIX_UPPER_ "TEMP", "12345678987654321");
EXPECT_EQ(20, Int32FromGTestEnv("temp", 20));
- SetEnv(GTEST_FLAG_PREFIX_UPPER "TEMP", "-12345678987654321");
+ SetEnv(GTEST_FLAG_PREFIX_UPPER_ "TEMP", "-12345678987654321");
EXPECT_EQ(30, Int32FromGTestEnv("temp", 30));
}
@@ -1307,10 +1307,10 @@ TEST(Int32FromGTestEnvTest, ReturnsDefaultWhenValueOverflows) {
TEST(Int32FromGTestEnvTest, ReturnsDefaultWhenValueIsInvalid) {
printf("(expecting 2 warnings)\n");
- SetEnv(GTEST_FLAG_PREFIX_UPPER "TEMP", "A1");
+ SetEnv(GTEST_FLAG_PREFIX_UPPER_ "TEMP", "A1");
EXPECT_EQ(40, Int32FromGTestEnv("temp", 40));
- SetEnv(GTEST_FLAG_PREFIX_UPPER "TEMP", "12X");
+ SetEnv(GTEST_FLAG_PREFIX_UPPER_ "TEMP", "12X");
EXPECT_EQ(50, Int32FromGTestEnv("temp", 50));
}
@@ -1318,10 +1318,10 @@ TEST(Int32FromGTestEnvTest, ReturnsDefaultWhenValueIsInvalid) {
// environment variable when it represents a valid decimal integer in
// the range of an Int32.
TEST(Int32FromGTestEnvTest, ParsesAndReturnsValidValue) {
- SetEnv(GTEST_FLAG_PREFIX_UPPER "TEMP", "123");
+ SetEnv(GTEST_FLAG_PREFIX_UPPER_ "TEMP", "123");
EXPECT_EQ(123, Int32FromGTestEnv("temp", 0));
- SetEnv(GTEST_FLAG_PREFIX_UPPER "TEMP", "-321");
+ SetEnv(GTEST_FLAG_PREFIX_UPPER_ "TEMP", "-321");
EXPECT_EQ(-321, Int32FromGTestEnv("temp", 0));
}
#endif // !defined(_WIN32_WCE)
@@ -1371,38 +1371,38 @@ TEST(ParseInt32FlagTest, ReturnsDefaultWhenValueIsInvalid) {
// the range of an Int32.
TEST(ParseInt32FlagTest, ParsesAndReturnsValidValue) {
Int32 value = 123;
- EXPECT_TRUE(ParseInt32Flag("--" GTEST_FLAG_PREFIX "abc=456", "abc", &value));
+ EXPECT_TRUE(ParseInt32Flag("--" GTEST_FLAG_PREFIX_ "abc=456", "abc", &value));
EXPECT_EQ(456, value);
- EXPECT_TRUE(ParseInt32Flag("--" GTEST_FLAG_PREFIX "abc=-789", "abc", &value));
+ EXPECT_TRUE(ParseInt32Flag("--" GTEST_FLAG_PREFIX_ "abc=-789", "abc", &value));
EXPECT_EQ(-789, value);
}
// Tests that Int32FromEnvOrDie() parses the value of the var or
// returns the correct default.
TEST(Int32FromEnvOrDieTest, ParsesAndReturnsValidValue) {
- EXPECT_EQ(333, Int32FromEnvOrDie(GTEST_FLAG_PREFIX_UPPER "UnsetVar", 333));
- SetEnv(GTEST_FLAG_PREFIX_UPPER "UnsetVar", "123");
- EXPECT_EQ(123, Int32FromEnvOrDie(GTEST_FLAG_PREFIX_UPPER "UnsetVar", 333));
- SetEnv(GTEST_FLAG_PREFIX_UPPER "UnsetVar", "-123");
- EXPECT_EQ(-123, Int32FromEnvOrDie(GTEST_FLAG_PREFIX_UPPER "UnsetVar", 333));
+ EXPECT_EQ(333, Int32FromEnvOrDie(GTEST_FLAG_PREFIX_UPPER_ "UnsetVar", 333));
+ SetEnv(GTEST_FLAG_PREFIX_UPPER_ "UnsetVar", "123");
+ EXPECT_EQ(123, Int32FromEnvOrDie(GTEST_FLAG_PREFIX_UPPER_ "UnsetVar", 333));
+ SetEnv(GTEST_FLAG_PREFIX_UPPER_ "UnsetVar", "-123");
+ EXPECT_EQ(-123, Int32FromEnvOrDie(GTEST_FLAG_PREFIX_UPPER_ "UnsetVar", 333));
}
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
// Tests that Int32FromEnvOrDie() aborts with an error message
// if the variable is not an Int32.
TEST(Int32FromEnvOrDieDeathTest, AbortsOnFailure) {
- SetEnv(GTEST_FLAG_PREFIX_UPPER "VAR", "xxx");
- EXPECT_DEATH({Int32FromEnvOrDie(GTEST_FLAG_PREFIX_UPPER "VAR", 123);},
+ SetEnv(GTEST_FLAG_PREFIX_UPPER_ "VAR", "xxx");
+ EXPECT_DEATH({Int32FromEnvOrDie(GTEST_FLAG_PREFIX_UPPER_ "VAR", 123);},
".*");
}
// Tests that Int32FromEnvOrDie() aborts with an error message
// if the variable cannot be represnted by an Int32.
TEST(Int32FromEnvOrDieDeathTest, AbortsOnInt32Overflow) {
- SetEnv(GTEST_FLAG_PREFIX_UPPER "VAR", "1234567891234567891234");
- EXPECT_DEATH({Int32FromEnvOrDie(GTEST_FLAG_PREFIX_UPPER "VAR", 123);},
+ SetEnv(GTEST_FLAG_PREFIX_UPPER_ "VAR", "1234567891234567891234");
+ EXPECT_DEATH({Int32FromEnvOrDie(GTEST_FLAG_PREFIX_UPPER_ "VAR", 123);},
".*");
}
@@ -1422,8 +1422,8 @@ TEST(ShouldRunTestOnShardTest, IsPartitionWhenThereIsOneShard) {
class ShouldShardTest : public testing::Test {
protected:
virtual void SetUp() {
- index_var_ = GTEST_FLAG_PREFIX_UPPER "INDEX";
- total_var_ = GTEST_FLAG_PREFIX_UPPER "TOTAL";
+ index_var_ = GTEST_FLAG_PREFIX_UPPER_ "INDEX";
+ total_var_ = GTEST_FLAG_PREFIX_UPPER_ "TOTAL";
}
virtual void TearDown() {
@@ -1472,7 +1472,7 @@ TEST_F(ShouldShardTest, WorksWhenShardEnvVarsAreValid) {
EXPECT_FALSE(ShouldShard(total_var_, index_var_, true));
}
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
// Tests that we exit in error if the sharding values are not valid.
TEST_F(ShouldShardTest, AbortsWhenShardingEnvVarsAreInvalid) {
@@ -2243,7 +2243,7 @@ TEST_F(FloatTest, LargeDiff) {
TEST_F(FloatTest, Infinity) {
EXPECT_FLOAT_EQ(infinity_, close_to_infinity_);
EXPECT_FLOAT_EQ(-infinity_, -close_to_infinity_);
-#ifndef GTEST_OS_SYMBIAN
+#if !GTEST_OS_SYMBIAN
// Nokia's STLport crashes if we try to output infinity or NaN.
EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(infinity_, -infinity_),
"-infinity_");
@@ -2252,12 +2252,12 @@ TEST_F(FloatTest, Infinity) {
// are only 1 DLP apart.
EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(infinity_, nan1_),
"nan1_");
-#endif // ! GTEST_OS_SYMBIAN
+#endif // !GTEST_OS_SYMBIAN
}
// Tests that comparing with NAN always returns false.
TEST_F(FloatTest, NaN) {
-#ifndef GTEST_OS_SYMBIAN
+#if !GTEST_OS_SYMBIAN
// Nokia's STLport crashes if we try to output infinity or NaN.
EXPECT_NONFATAL_FAILURE(EXPECT_FLOAT_EQ(nan1_, nan1_),
"nan1_");
@@ -2268,7 +2268,7 @@ TEST_F(FloatTest, NaN) {
EXPECT_FATAL_FAILURE(ASSERT_FLOAT_EQ(nan1_, infinity_),
"infinity_");
-#endif // ! GTEST_OS_SYMBIAN
+#endif // !GTEST_OS_SYMBIAN
}
// Tests that *_FLOAT_EQ are reflexive.
@@ -2330,7 +2330,7 @@ TEST_F(FloatTest, FloatLEFails) {
EXPECT_PRED_FORMAT2(FloatLE, further_from_one_, 1.0f);
}, "(further_from_one_) <= (1.0f)");
-#ifndef GTEST_OS_SYMBIAN
+#if !GTEST_OS_SYMBIAN
// Nokia's STLport crashes if we try to output infinity or NaN.
// or when either val1 or val2 is NaN.
EXPECT_NONFATAL_FAILURE({ // NOLINT
@@ -2343,7 +2343,7 @@ TEST_F(FloatTest, FloatLEFails) {
EXPECT_FATAL_FAILURE({ // NOLINT
ASSERT_PRED_FORMAT2(FloatLE, nan1_, nan1_);
}, "(nan1_) <= (nan1_)");
-#endif // ! GTEST_OS_SYMBIAN
+#endif // !GTEST_OS_SYMBIAN
}
// Instantiates FloatingPointTest for testing *_DOUBLE_EQ.
@@ -2398,7 +2398,7 @@ TEST_F(DoubleTest, LargeDiff) {
TEST_F(DoubleTest, Infinity) {
EXPECT_DOUBLE_EQ(infinity_, close_to_infinity_);
EXPECT_DOUBLE_EQ(-infinity_, -close_to_infinity_);
-#ifndef GTEST_OS_SYMBIAN
+#if !GTEST_OS_SYMBIAN
// Nokia's STLport crashes if we try to output infinity or NaN.
EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(infinity_, -infinity_),
"-infinity_");
@@ -2407,29 +2407,29 @@ TEST_F(DoubleTest, Infinity) {
// are only 1 DLP apart.
EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(infinity_, nan1_),
"nan1_");
-#endif // ! GTEST_OS_SYMBIAN
+#endif // !GTEST_OS_SYMBIAN
}
// Tests that comparing with NAN always returns false.
TEST_F(DoubleTest, NaN) {
-#ifndef GTEST_OS_SYMBIAN
+#if !GTEST_OS_SYMBIAN
// Nokia's STLport crashes if we try to output infinity or NaN.
EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(nan1_, nan1_),
"nan1_");
EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(nan1_, nan2_), "nan2_");
EXPECT_NONFATAL_FAILURE(EXPECT_DOUBLE_EQ(1.0, nan1_), "nan1_");
EXPECT_FATAL_FAILURE(ASSERT_DOUBLE_EQ(nan1_, infinity_), "infinity_");
-#endif // ! GTEST_OS_SYMBIAN
+#endif // !GTEST_OS_SYMBIAN
}
// Tests that *_DOUBLE_EQ are reflexive.
TEST_F(DoubleTest, Reflexive) {
EXPECT_DOUBLE_EQ(0.0, 0.0);
EXPECT_DOUBLE_EQ(1.0, 1.0);
-#ifndef GTEST_OS_SYMBIAN
+#if !GTEST_OS_SYMBIAN
// Nokia's STLport crashes if we try to output infinity or NaN.
ASSERT_DOUBLE_EQ(infinity_, infinity_);
-#endif // ! GTEST_OS_SYMBIAN
+#endif // !GTEST_OS_SYMBIAN
}
// Tests that *_DOUBLE_EQ are commutative.
@@ -2483,7 +2483,7 @@ TEST_F(DoubleTest, DoubleLEFails) {
EXPECT_PRED_FORMAT2(DoubleLE, further_from_one_, 1.0);
}, "(further_from_one_) <= (1.0)");
-#ifndef GTEST_OS_SYMBIAN
+#if !GTEST_OS_SYMBIAN
// Nokia's STLport crashes if we try to output infinity or NaN.
// or when either val1 or val2 is NaN.
EXPECT_NONFATAL_FAILURE({ // NOLINT
@@ -2495,7 +2495,7 @@ TEST_F(DoubleTest, DoubleLEFails) {
EXPECT_FATAL_FAILURE({ // NOLINT
ASSERT_PRED_FORMAT2(DoubleLE, nan1_, nan1_);
}, "(nan1_) <= (nan1_)");
-#endif // ! GTEST_OS_SYMBIAN
+#endif // !GTEST_OS_SYMBIAN
}
@@ -2551,7 +2551,7 @@ TEST_F(DisabledTestsTest, DISABLED_TestShouldNotRun_2) {
// Tests that disabled typed tests aren't run.
-#ifdef GTEST_HAS_TYPED_TEST
+#if GTEST_HAS_TYPED_TEST
template <typename T>
class TypedTest : public Test {
@@ -2578,7 +2578,7 @@ TYPED_TEST(DISABLED_TypedTest, ShouldNotRun) {
// Tests that disabled type-parameterized tests aren't run.
-#ifdef GTEST_HAS_TYPED_TEST_P
+#if GTEST_HAS_TYPED_TEST_P
template <typename T>
class TypedTestP : public Test {
@@ -2956,7 +2956,7 @@ TEST(AssertionTest, ASSERT_EQ) {
}
// Tests ASSERT_EQ(NULL, pointer).
-#ifndef GTEST_OS_SYMBIAN
+#if !GTEST_OS_SYMBIAN
// The NULL-detection template magic fails to compile with
// the Nokia compiler and crashes the ARM compiler, hence
// not testing on Symbian.
@@ -2970,7 +2970,7 @@ TEST(AssertionTest, ASSERT_EQ_NULL) {
EXPECT_FATAL_FAILURE(ASSERT_EQ(NULL, &n),
"Value of: &n\n");
}
-#endif // GTEST_OS_SYMBIAN
+#endif // !GTEST_OS_SYMBIAN
// Tests ASSERT_EQ(0, non_pointer). Since the literal 0 can be
// treated as a null pointer by the compiler, we need to make sure
@@ -3145,12 +3145,12 @@ TEST(AssertionTest, ExpectWorksWithUncopyableObject) {
// The version of gcc used in XCode 2.2 has a bug and doesn't allow
// anonymous enums in assertions. Therefore the following test is
// done only on Linux and Windows.
-#if defined(GTEST_OS_LINUX) || defined(GTEST_OS_WINDOWS)
+#if GTEST_OS_LINUX || GTEST_OS_WINDOWS
// Tests using assertions with anonymous enums.
enum {
CASE_A = -1,
-#ifdef GTEST_OS_LINUX
+#if GTEST_OS_LINUX
// 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
// assertions doesn't truncate the enums. However, MSVC
@@ -3167,7 +3167,7 @@ enum {
};
TEST(AssertionTest, AnonymousEnum) {
-#ifdef GTEST_OS_LINUX
+#if GTEST_OS_LINUX
EXPECT_EQ(static_cast<int>(CASE_A), static_cast<int>(CASE_B));
#endif // GTEST_OS_LINUX
@@ -3190,9 +3190,9 @@ TEST(AssertionTest, AnonymousEnum) {
"Value of: CASE_B");
}
-#endif // defined(GTEST_OS_LINUX) || defined(GTEST_OS_WINDOWS)
+#endif // GTEST_OS_LINUX || GTEST_OS_WINDOWS
-#if defined(GTEST_OS_WINDOWS)
+#if GTEST_OS_WINDOWS
static HRESULT UnexpectedHRESULTFailure() {
return E_UNEXPECTED;
@@ -3274,7 +3274,7 @@ TEST(HRESULTAssertionTest, Streaming) {
"expected failure");
}
-#endif // defined(GTEST_OS_WINDOWS)
+#endif // GTEST_OS_WINDOWS
// Tests that the assertion macros behave like single statements.
TEST(AssertionSyntaxTest, BasicAssertionsBehavesLikeSingleStatement) {
@@ -3493,7 +3493,7 @@ TEST(ExpectTest, EXPECT_EQ_Double) {
"5.1");
}
-#ifndef GTEST_OS_SYMBIAN
+#if !GTEST_OS_SYMBIAN
// Tests EXPECT_EQ(NULL, pointer).
TEST(ExpectTest, EXPECT_EQ_NULL) {
// A success.
@@ -3505,7 +3505,7 @@ TEST(ExpectTest, EXPECT_EQ_NULL) {
EXPECT_NONFATAL_FAILURE(EXPECT_EQ(NULL, &n),
"Value of: &n\n");
}
-#endif // GTEST_OS_SYMBIAN
+#endif // !GTEST_OS_SYMBIAN
// Tests EXPECT_EQ(0, non_pointer). Since the literal 0 can be
// treated as a null pointer by the compiler, we need to make sure
@@ -4469,7 +4469,7 @@ class InitGoogleTestTest : public Test {
// This macro wraps TestParsingFlags s.t. the user doesn't need
// to specify the array sizes.
-#define TEST_PARSING_FLAGS(argv1, argv2, expected) \
+#define GTEST_TEST_PARSING_FLAGS_(argv1, argv2, expected) \
TestParsingFlags(sizeof(argv1)/sizeof(*argv1) - 1, argv1, \
sizeof(argv2)/sizeof(*argv2) - 1, argv2, expected)
};
@@ -4484,7 +4484,7 @@ TEST_F(InitGoogleTestTest, Empty) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags());
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags());
}
// Tests parsing a command line that has no flag.
@@ -4499,7 +4499,7 @@ TEST_F(InitGoogleTestTest, NoFlag) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags());
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags());
}
// Tests parsing a bad --gtest_filter flag.
@@ -4516,7 +4516,7 @@ TEST_F(InitGoogleTestTest, FilterBad) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::Filter(""));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter(""));
}
// Tests parsing an empty --gtest_filter flag.
@@ -4532,7 +4532,7 @@ TEST_F(InitGoogleTestTest, FilterEmpty) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::Filter(""));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter(""));
}
// Tests parsing a non-empty --gtest_filter flag.
@@ -4548,7 +4548,7 @@ TEST_F(InitGoogleTestTest, FilterNonEmpty) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::Filter("abc"));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter("abc"));
}
// Tests parsing --gtest_break_on_failure.
@@ -4564,7 +4564,7 @@ TEST_F(InitGoogleTestTest, BreakOnFailureNoDef) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::BreakOnFailure(true));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(true));
}
// Tests parsing --gtest_break_on_failure=0.
@@ -4580,7 +4580,7 @@ TEST_F(InitGoogleTestTest, BreakOnFailureFalse_0) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::BreakOnFailure(false));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(false));
}
// Tests parsing --gtest_break_on_failure=f.
@@ -4596,7 +4596,7 @@ TEST_F(InitGoogleTestTest, BreakOnFailureFalse_f) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::BreakOnFailure(false));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(false));
}
// Tests parsing --gtest_break_on_failure=F.
@@ -4612,7 +4612,7 @@ TEST_F(InitGoogleTestTest, BreakOnFailureFalse_F) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::BreakOnFailure(false));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(false));
}
// Tests parsing a --gtest_break_on_failure flag that has a "true"
@@ -4629,7 +4629,7 @@ TEST_F(InitGoogleTestTest, BreakOnFailureTrue) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::BreakOnFailure(true));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::BreakOnFailure(true));
}
// Tests parsing --gtest_catch_exceptions.
@@ -4645,7 +4645,7 @@ TEST_F(InitGoogleTestTest, CatchExceptions) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::CatchExceptions(true));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::CatchExceptions(true));
}
// Tests parsing --gtest_death_test_use_fork.
@@ -4661,7 +4661,7 @@ TEST_F(InitGoogleTestTest, DeathTestUseFork) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::DeathTestUseFork(true));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::DeathTestUseFork(true));
}
// Tests having the same flag twice with different values. The
@@ -4679,7 +4679,7 @@ TEST_F(InitGoogleTestTest, DuplicatedFlags) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::Filter("b"));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Filter("b"));
}
// Tests having an unrecognized flag on the command line.
@@ -4701,7 +4701,7 @@ TEST_F(InitGoogleTestTest, UnrecognizedFlag) {
Flags flags;
flags.break_on_failure = true;
flags.filter = "b";
- TEST_PARSING_FLAGS(argv, argv2, flags);
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, flags);
}
// Tests having a --gtest_list_tests flag
@@ -4717,7 +4717,7 @@ TEST_F(InitGoogleTestTest, ListTestsFlag) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::ListTests(true));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(true));
}
// Tests having a --gtest_list_tests flag with a "true" value
@@ -4733,7 +4733,7 @@ TEST_F(InitGoogleTestTest, ListTestsTrue) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::ListTests(true));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(true));
}
// Tests having a --gtest_list_tests flag with a "false" value
@@ -4749,7 +4749,7 @@ TEST_F(InitGoogleTestTest, ListTestsFalse) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::ListTests(false));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(false));
}
// Tests parsing --gtest_list_tests=f.
@@ -4765,7 +4765,7 @@ TEST_F(InitGoogleTestTest, ListTestsFalse_f) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::ListTests(false));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(false));
}
// Tests parsing --gtest_break_on_failure=F.
@@ -4781,7 +4781,7 @@ TEST_F(InitGoogleTestTest, ListTestsFalse_F) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::ListTests(false));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::ListTests(false));
}
// Tests parsing --gtest_output (invalid).
@@ -4798,7 +4798,7 @@ TEST_F(InitGoogleTestTest, OutputEmpty) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags());
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags());
}
// Tests parsing --gtest_output=xml
@@ -4814,7 +4814,7 @@ TEST_F(InitGoogleTestTest, OutputXml) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::Output("xml"));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Output("xml"));
}
// Tests parsing --gtest_output=xml:file
@@ -4830,7 +4830,7 @@ TEST_F(InitGoogleTestTest, OutputXmlFile) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::Output("xml:file"));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Output("xml:file"));
}
// Tests parsing --gtest_output=xml:directory/path/
@@ -4846,7 +4846,7 @@ TEST_F(InitGoogleTestTest, OutputXmlDirectory) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::Output("xml:directory/path/"));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Output("xml:directory/path/"));
}
// Tests having a --gtest_print_time flag
@@ -4862,7 +4862,7 @@ TEST_F(InitGoogleTestTest, PrintTimeFlag) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::PrintTime(true));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(true));
}
// Tests having a --gtest_print_time flag with a "true" value
@@ -4878,7 +4878,7 @@ TEST_F(InitGoogleTestTest, PrintTimeTrue) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::PrintTime(true));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(true));
}
// Tests having a --gtest_print_time flag with a "false" value
@@ -4894,7 +4894,7 @@ TEST_F(InitGoogleTestTest, PrintTimeFalse) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::PrintTime(false));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(false));
}
// Tests parsing --gtest_print_time=f.
@@ -4910,7 +4910,7 @@ TEST_F(InitGoogleTestTest, PrintTimeFalse_f) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::PrintTime(false));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(false));
}
// Tests parsing --gtest_print_time=F.
@@ -4926,7 +4926,7 @@ TEST_F(InitGoogleTestTest, PrintTimeFalse_F) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::PrintTime(false));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::PrintTime(false));
}
// Tests parsing --gtest_repeat=number
@@ -4942,7 +4942,7 @@ TEST_F(InitGoogleTestTest, Repeat) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::Repeat(1000));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::Repeat(1000));
}
// Tests having a --gtest_also_run_disabled_tests flag
@@ -4958,7 +4958,7 @@ TEST_F(InitGoogleTestTest, AlsoRunDisabledTestsFlag) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::AlsoRunDisabledTests(true));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::AlsoRunDisabledTests(true));
}
// Tests having a --gtest_also_run_disabled_tests flag with a "true" value
@@ -4974,7 +4974,7 @@ TEST_F(InitGoogleTestTest, AlsoRunDisabledTestsTrue) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::AlsoRunDisabledTests(true));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::AlsoRunDisabledTests(true));
}
// Tests having a --gtest_also_run_disabled_tests flag with a "false" value
@@ -4990,10 +4990,10 @@ TEST_F(InitGoogleTestTest, AlsoRunDisabledTestsFalse) {
NULL
};
- TEST_PARSING_FLAGS(argv, argv2, Flags::AlsoRunDisabledTests(false));
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, Flags::AlsoRunDisabledTests(false));
}
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
// Tests parsing wide strings.
TEST_F(InitGoogleTestTest, WideStrings) {
const wchar_t* argv[] = {
@@ -5016,7 +5016,7 @@ TEST_F(InitGoogleTestTest, WideStrings) {
expected_flags.filter = "Foo*";
expected_flags.list_tests = true;
- TEST_PARSING_FLAGS(argv, argv2, expected_flags);
+ GTEST_TEST_PARSING_FLAGS_(argv, argv2, expected_flags);
}
#endif // GTEST_OS_WINDOWS
@@ -5304,7 +5304,7 @@ TEST(ColoredOutputTest, UsesColorsWhenStdoutIsTty) {
TEST(ColoredOutputTest, UsesColorsWhenTermSupportsColors) {
GTEST_FLAG(color) = "auto";
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
// On Windows, we ignore the TERM variable as it's usually not set.
SetEnv("TERM", "dumb");