summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386>2009-02-23 23:37:29 +0000
committerzhanyong.wan <zhanyong.wan@8415998a-534a-0410-bf83-d39667b30386>2009-02-23 23:37:29 +0000
commit903413c0b51215e6c7b5100683cd2f6ec7374173 (patch)
treea1eec03b5f17ae6336af2355ef9e6f05520e8786
parent530c151c3e3ef2d436734e7710c2e0952ffb79bd (diff)
downloadgooglemock-903413c0b51215e6c7b5100683cd2f6ec7374173.tar.gz
Cleans up macro definitions.
git-svn-id: http://googlemock.googlecode.com/svn/trunk@109 8415998a-534a-0410-bf83-d39667b30386
-rw-r--r--include/gmock/gmock-actions.h4
-rw-r--r--include/gmock/gmock-matchers.h4
-rw-r--r--include/gmock/internal/gmock-port.h4
-rw-r--r--src/gmock-printers.cc2
-rw-r--r--test/gmock-actions_test.cc16
-rw-r--r--test/gmock-generated-function-mockers_test.cc14
-rw-r--r--test/gmock-internal-utils_test.cc2
-rw-r--r--test/gmock-matchers_test.cc2
-rw-r--r--test/gmock-port_test.cc2
-rw-r--r--test/gmock-printers_test.cc20
-rw-r--r--test/gmock-spec-builders_test.cc6
11 files changed, 38 insertions, 38 deletions
diff --git a/include/gmock/gmock-actions.h b/include/gmock/gmock-actions.h
index 7aa5274..823054b 100644
--- a/include/gmock/gmock-actions.h
+++ b/include/gmock/gmock-actions.h
@@ -678,12 +678,12 @@ class SetArrayArgumentAction {
// Microsoft compiler deprecates ::std::copy, so we want to suppress warning
// 4996 (Function call with parameters that may be unsafe) there.
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
#pragma warning(push) // Saves the current warning state.
#pragma warning(disable:4996) // Temporarily disables warning 4996.
#endif // GTEST_OS_WINDOWS
::std::copy(first_, last_, ::std::tr1::get<N>(args));
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
#pragma warning(pop) // Restores the warning state.
#endif // GTEST_OS_WINDOWS
}
diff --git a/include/gmock/gmock-matchers.h b/include/gmock/gmock-matchers.h
index 525128b..e6af144 100644
--- a/include/gmock/gmock-matchers.h
+++ b/include/gmock/gmock-matchers.h
@@ -1141,13 +1141,13 @@ class TrulyMatcher {
// interested in the address of the argument.
template <typename T>
bool Matches(T& x) const {
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
// MSVC warns about converting a value into bool (warning 4800).
#pragma warning(push) // Saves the current warning state.
#pragma warning(disable:4800) // Temporarily disables warning 4800.
#endif // GTEST_OS_WINDOWS
return predicate_(x);
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
#pragma warning(pop) // Restores the warning state.
#endif // GTEST_OS_WINDOWS
}
diff --git a/include/gmock/internal/gmock-port.h b/include/gmock/internal/gmock-port.h
index 45b95cd..cb35219 100644
--- a/include/gmock/internal/gmock-port.h
+++ b/include/gmock/internal/gmock-port.h
@@ -58,7 +58,7 @@
#include <tuple>
#endif // __GNUC__
-#ifdef 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
@@ -85,7 +85,7 @@ namespace internal {
// For Windows, check the compiler version. At least VS 2005 SP1 is
// required to compile Google Mock.
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
#if _MSC_VER < 1400
#error "At least Visual Studio 2005 SP1 is required to compile Google Mock."
diff --git a/src/gmock-printers.cc b/src/gmock-printers.cc
index 611d865..495717d 100644
--- a/src/gmock-printers.cc
+++ b/src/gmock-printers.cc
@@ -55,7 +55,7 @@ namespace {
using ::std::ostream;
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
#define snprintf _snprintf_s
#endif
diff --git a/test/gmock-actions_test.cc b/test/gmock-actions_test.cc
index 6fb47bc..077681b 100644
--- a/test/gmock-actions_test.cc
+++ b/test/gmock-actions_test.cc
@@ -95,10 +95,10 @@ TEST(BuiltInDefaultValueTest, IsZeroForNumericTypes) {
EXPECT_EQ(0, BuiltInDefaultValue<unsigned char>::Get());
EXPECT_EQ(0, BuiltInDefaultValue<signed char>::Get());
EXPECT_EQ(0, BuiltInDefaultValue<char>::Get());
-#ifndef GTEST_OS_WINDOWS
+#if !GTEST_OS_WINDOWS
EXPECT_EQ(0, BuiltInDefaultValue<unsigned wchar_t>::Get());
EXPECT_EQ(0, BuiltInDefaultValue<signed wchar_t>::Get());
-#endif // GTEST_OS_WINDOWS
+#endif // !GTEST_OS_WINDOWS
EXPECT_EQ(0, BuiltInDefaultValue<wchar_t>::Get());
EXPECT_EQ(0, BuiltInDefaultValue<unsigned short>::Get()); // NOLINT
EXPECT_EQ(0, BuiltInDefaultValue<signed short>::Get()); // NOLINT
@@ -121,10 +121,10 @@ TEST(BuiltInDefaultValueTest, ExistsForNumericTypes) {
EXPECT_TRUE(BuiltInDefaultValue<unsigned char>::Exists());
EXPECT_TRUE(BuiltInDefaultValue<signed char>::Exists());
EXPECT_TRUE(BuiltInDefaultValue<char>::Exists());
-#ifndef GTEST_OS_WINDOWS
+#if !GTEST_OS_WINDOWS
EXPECT_TRUE(BuiltInDefaultValue<unsigned wchar_t>::Exists());
EXPECT_TRUE(BuiltInDefaultValue<signed wchar_t>::Exists());
-#endif // GTEST_OS_WINDOWS
+#endif // !GTEST_OS_WINDOWS
EXPECT_TRUE(BuiltInDefaultValue<wchar_t>::Exists());
EXPECT_TRUE(BuiltInDefaultValue<unsigned short>::Exists()); // NOLINT
EXPECT_TRUE(BuiltInDefaultValue<signed short>::Exists()); // NOLINT
@@ -196,7 +196,7 @@ TEST(BuiltInDefaultValueTest, UserTypeHasNoDefault) {
EXPECT_FALSE(BuiltInDefaultValue<UserType>::Exists());
}
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
// Tests that BuiltInDefaultValue<T&>::Get() aborts the program.
TEST(BuiltInDefaultValueDeathTest, IsUndefinedForReferences) {
@@ -257,7 +257,7 @@ TEST(DefaultValueDeathTest, GetReturnsBuiltInDefaultValueWhenUnset) {
EXPECT_EQ(0, DefaultValue<int>::Get());
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
EXPECT_DEATH({ // NOLINT
DefaultValue<UserType>::Get();
}, "");
@@ -313,7 +313,7 @@ TEST(DefaultValueOfReferenceDeathTest, GetReturnsBuiltInDefaultValueWhenUnset) {
EXPECT_FALSE(DefaultValue<int&>::IsSet());
EXPECT_FALSE(DefaultValue<UserType&>::IsSet());
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
EXPECT_DEATH({ // NOLINT
DefaultValue<int&>::Get();
}, "");
@@ -556,7 +556,7 @@ TEST(DoDefaultTest, ReturnsBuiltInDefaultValueByDefault) {
EXPECT_EQ(0, mock.IntFunc(true));
}
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
// Tests that DoDefault() aborts the process when there is no built-in
// default value for the return type.
diff --git a/test/gmock-generated-function-mockers_test.cc b/test/gmock-generated-function-mockers_test.cc
index d8e678b..431cbd6 100644
--- a/test/gmock-generated-function-mockers_test.cc
+++ b/test/gmock-generated-function-mockers_test.cc
@@ -40,7 +40,7 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
// MSDN says the header file to be included for STDMETHOD is BaseTyps.h but
// we are getting compiler errors if we use basetyps.h, hence including
// objbase.h for definition of STDMETHOD.
@@ -50,9 +50,9 @@
// There is a bug in MSVC (fixed in VS 2008) that prevents creating a
// mock for a function with const arguments, so we don't test such
// cases for MSVC versions older than 2008.
-#if !defined(GTEST_OS_WINDOWS) || (_MSC_VER >= 1500)
+#if !GTEST_OS_WINDOWS || (_MSC_VER >= 1500)
#define GMOCK_ALLOWS_CONST_PARAM_FUNCTIONS
-#endif // !defined(GTEST_OS_WINDOWS) || (_MSC_VER >= 1500)
+#endif // !GTEST_OS_WINDOWS || (_MSC_VER >= 1500)
namespace testing {
namespace gmock_generated_function_mockers_test {
@@ -102,7 +102,7 @@ class FooInterface {
virtual int TypeWithHole(int (*func)()) = 0;
virtual int TypeWithComma(const std::map<int, string>& a_map) = 0;
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
STDMETHOD_(int, CTNullary)() = 0;
STDMETHOD_(bool, CTUnary)(int x) = 0;
STDMETHOD_(int, CTDecimal)(bool b, char c, short d, int e, long f, // NOLINT
@@ -140,7 +140,7 @@ class MockFoo : public FooInterface {
MOCK_METHOD1(TypeWithHole, int(int (*)())); // NOLINT
MOCK_METHOD1(TypeWithComma, int(const std::map<int, string>&)); // NOLINT
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
MOCK_METHOD0_WITH_CALLTYPE(STDMETHODCALLTYPE, CTNullary, int());
MOCK_METHOD1_WITH_CALLTYPE(STDMETHODCALLTYPE, CTUnary, bool(int));
MOCK_METHOD10_WITH_CALLTYPE(STDMETHODCALLTYPE, CTDecimal, int(bool b, char c,
@@ -261,7 +261,7 @@ TEST_F(FunctionMockerTest, MocksFunctionsOverloadedOnConstnessOfThis) {
EXPECT_EQ('a', Const(*foo_).OverloadedOnConstness());
}
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
// Tests mocking a nullary function with calltype.
TEST_F(FunctionMockerTest, MocksNullaryFunctionWithCallType) {
EXPECT_CALL(mock_foo_, CTNullary())
@@ -373,7 +373,7 @@ TEST(TemplateMockTest, Works) {
EXPECT_EQ(0, mock.GetSize());
}
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
// Tests mocking template interfaces with calltype.
template <typename T>
diff --git a/test/gmock-internal-utils_test.cc b/test/gmock-internal-utils_test.cc
index 6503ffb..b678a9e 100644
--- a/test/gmock-internal-utils_test.cc
+++ b/test/gmock-internal-utils_test.cc
@@ -320,7 +320,7 @@ TEST(AssertTest, SucceedsOnTrue) {
Assert(true, __FILE__, __LINE__); // This should succeed too.
}
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
// Tests that Assert(false, ...) generates a fatal failure.
TEST(AssertTest, FailsFatallyOnFalse) {
diff --git a/test/gmock-matchers_test.cc b/test/gmock-matchers_test.cc
index 0afa623..82820fe 100644
--- a/test/gmock-matchers_test.cc
+++ b/test/gmock-matchers_test.cc
@@ -2462,7 +2462,7 @@ TEST(ResultOfTest, WorksForCompatibleMatcherTypes) {
EXPECT_FALSE(matcher.Matches(42));
}
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
// Tests that the program aborts when ResultOf is passed
// a NULL function pointer.
TEST(ResultOfDeathTest, DiesOnNullFunctionPointers) {
diff --git a/test/gmock-port_test.cc b/test/gmock-port_test.cc
index f35bc11..5c4b3a5 100644
--- a/test/gmock-port_test.cc
+++ b/test/gmock-port_test.cc
@@ -65,7 +65,7 @@ TEST(GmockCheckSyntaxTest, WorksWithSwitch) {
GMOCK_CHECK_(true) << "Check failed in switch case";
}
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
TEST(GmockCheckDeathTest, DiesWithCorrectOutputOnFailure) {
const bool a_false_condition = false;
diff --git a/test/gmock-printers_test.cc b/test/gmock-printers_test.cc
index e5e3ff1..29a0db8 100644
--- a/test/gmock-printers_test.cc
+++ b/test/gmock-printers_test.cc
@@ -53,11 +53,11 @@
#include <gtest/gtest.h>
// hash_map and hash_set are available on Windows.
-#ifdef GTEST_OS_WINDOWS
-#define GMOCK_HAS_HASH_MAP_ // Indicates that hash_map is available.
-#include <hash_map> // NOLINT
-#define GMOCK_HAS_HASH_SET_ // Indicates that hash_set is available.
-#include <hash_set> // NOLINT
+#if GTEST_OS_WINDOWS
+#define GMOCK_HAS_HASH_MAP_ 1 // Indicates that hash_map is available.
+#include <hash_map> // NOLINT
+#define GMOCK_HAS_HASH_SET_ 1 // Indicates that hash_set is available.
+#include <hash_set> // NOLINT
#endif // GTEST_OS_WINDOWS
// Some user-defined types for testing the universal value printer.
@@ -160,7 +160,7 @@ using ::testing::internal::UniversalTersePrintTupleFieldsToStrings;
using ::testing::internal::UniversalPrinter;
using ::testing::internal::string;
-#ifdef GTEST_OS_WINDOWS
+#if GTEST_OS_WINDOWS
// MSVC defines the following classes in the ::stdext namespace while
// gcc defines them in the :: namespace. Note that they are not part
// of the C++ standard.
@@ -279,10 +279,10 @@ TEST(PrintBuiltInTypeTest, Integer) {
// Size types.
TEST(PrintBuiltInTypeTest, Size_t) {
EXPECT_EQ("1", Print(sizeof('a'))); // size_t.
-#ifndef GTEST_OS_WINDOWS
+#if !GTEST_OS_WINDOWS
// Windows has no ssize_t type.
EXPECT_EQ("-2", Print(static_cast<ssize_t>(-2))); // ssize_t.
-#endif // GTEST_OS_WINDOWS
+#endif // !GTEST_OS_WINDOWS
}
// Floating-points.
@@ -674,7 +674,7 @@ TEST(PrintStlContainerTest, NonEmptyDeque) {
EXPECT_EQ("{ 1, 3 }", Print(non_empty));
}
-#ifdef GMOCK_HAS_HASH_MAP_
+#if GMOCK_HAS_HASH_MAP_
TEST(PrintStlContainerTest, OneElementHashMap) {
hash_map<int, char> map1;
@@ -696,7 +696,7 @@ TEST(PrintStlContainerTest, HashMultiMap) {
#endif // GMOCK_HAS_HASH_MAP_
-#ifdef GMOCK_HAS_HASH_SET_
+#if GMOCK_HAS_HASH_SET_
TEST(PrintStlContainerTest, HashSet) {
hash_set<string> set1;
diff --git a/test/gmock-spec-builders_test.cc b/test/gmock-spec-builders_test.cc
index 3e944ea..4e330f0 100644
--- a/test/gmock-spec-builders_test.cc
+++ b/test/gmock-spec-builders_test.cc
@@ -192,7 +192,7 @@ TEST(OnCallSyntaxTest, WithArgumentsCanAppearAtMostOnce) {
}, ".WithArguments() cannot appear more than once in an ON_CALL()");
}
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
TEST(OnCallSyntaxTest, WillByDefaultIsMandatory) {
MockA a;
@@ -987,7 +987,7 @@ TEST(UnexpectedCallTest, UnsatisifiedPrerequisites) {
#endif // GMOCK_HAS_REGEX
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
TEST(UndefinedReturnValueTest, ReturnValueIsMandatory) {
MockA a;
@@ -1143,7 +1143,7 @@ TEST(SequenceTest, AnyOrderIsOkByDefault) {
}
}
-#ifdef GTEST_HAS_DEATH_TEST
+#if GTEST_HAS_DEATH_TEST
// Tests that the calls must be in strict order when a complete order
// is specified.