diff options
Diffstat (limited to 'googlemock')
-rw-r--r-- | googlemock/Makefile.am | 8 | ||||
-rw-r--r-- | googlemock/README.md | 2 | ||||
-rw-r--r-- | googlemock/include/gmock/gmock-actions.h | 8 | ||||
-rw-r--r-- | googlemock/test/gmock-actions_test.cc | 4 | ||||
-rw-r--r-- | googlemock/test/gmock-matchers_test.cc | 44 |
5 files changed, 36 insertions, 30 deletions
diff --git a/googlemock/Makefile.am b/googlemock/Makefile.am index 7ad45888..9adbc516 100644 --- a/googlemock/Makefile.am +++ b/googlemock/Makefile.am @@ -42,7 +42,10 @@ pkginclude_internaldir = $(pkgincludedir)/internal pkginclude_internal_HEADERS = \ include/gmock/internal/gmock-generated-internal-utils.h \ include/gmock/internal/gmock-internal-utils.h \ - include/gmock/internal/gmock-port.h + include/gmock/internal/gmock-port.h \ + include/gmock/internal/custom/gmock-generated-actions.h \ + include/gmock/internal/custom/gmock-matchers.h \ + include/gmock/internal/custom/gmock-port.h lib_libgmock_main_la_SOURCES = src/gmock_main.cc lib_libgmock_main_la_LIBADD = lib/libgmock.la @@ -136,7 +139,8 @@ EXTRA_DIST += \ include/gmock/gmock-generated-function-mockers.h.pump \ include/gmock/gmock-generated-matchers.h.pump \ include/gmock/gmock-generated-nice-strict.h.pump \ - include/gmock/internal/gmock-generated-internal-utils.h.pump + include/gmock/internal/gmock-generated-internal-utils.h.pump \ + include/gmock/internal/custom/gmock-generated-actions.h.pump # Script for fusing Google Mock and Google Test source files. EXTRA_DIST += scripts/fuse_gmock_files.py diff --git a/googlemock/README.md b/googlemock/README.md index d3613541..332beab3 100644 --- a/googlemock/README.md +++ b/googlemock/README.md @@ -69,7 +69,7 @@ Once you understand the basics, check out the rest of the docs: If you need help, please check the [KnownIssues](docs/KnownIssues.md) and -[FrequentlyAskedQuestions](docs/frequentlyaskedquestions.md) before +[FrequentlyAskedQuestions](docs/FrequentlyAskedQuestions.md) before posting a question on the [discussion group](http://groups.google.com/group/googlemock). diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h index c09c4d6e..b3f654af 100644 --- a/googlemock/include/gmock/gmock-actions.h +++ b/googlemock/include/gmock/gmock-actions.h @@ -46,7 +46,7 @@ #include "gmock/internal/gmock-internal-utils.h" #include "gmock/internal/gmock-port.h" -#if GTEST_LANG_CXX11 // Defined by gtest-port.h via gmock-port.h. +#if GTEST_HAS_STD_TYPE_TRAITS_ // Defined by gtest-port.h via gmock-port.h. #include <type_traits> #endif @@ -96,7 +96,7 @@ struct BuiltInDefaultValueGetter<T, false> { template <typename T> class BuiltInDefaultValue { public: -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_TYPE_TRAITS_ // This function returns true iff type T has a built-in default value. static bool Exists() { return ::std::is_default_constructible<T>::value; @@ -107,7 +107,7 @@ class BuiltInDefaultValue { T, ::std::is_default_constructible<T>::value>::Get(); } -#else // GTEST_LANG_CXX11 +#else // GTEST_HAS_STD_TYPE_TRAITS_ // This function returns true iff type T has a built-in default value. static bool Exists() { return false; @@ -117,7 +117,7 @@ class BuiltInDefaultValue { return BuiltInDefaultValueGetter<T, false>::Get(); } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_TYPE_TRAITS_ }; // This partial specialization says that we use the same built-in diff --git a/googlemock/test/gmock-actions_test.cc b/googlemock/test/gmock-actions_test.cc index a665fc5f..f470de4c 100644 --- a/googlemock/test/gmock-actions_test.cc +++ b/googlemock/test/gmock-actions_test.cc @@ -214,7 +214,7 @@ class MyNonDefaultConstructible { int value_; }; -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_TYPE_TRAITS_ TEST(BuiltInDefaultValueTest, ExistsForDefaultConstructibleType) { EXPECT_TRUE(BuiltInDefaultValue<MyDefaultConstructible>::Exists()); @@ -224,7 +224,7 @@ TEST(BuiltInDefaultValueTest, IsDefaultConstructedForDefaultConstructibleType) { EXPECT_EQ(42, BuiltInDefaultValue<MyDefaultConstructible>::Get().value()); } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_TYPE_TRAITS_ TEST(BuiltInDefaultValueTest, DoesNotExistForNonDefaultConstructibleType) { EXPECT_FALSE(BuiltInDefaultValue<MyNonDefaultConstructible>::Exists()); diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index b09acba9..78c4c901 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -1042,14 +1042,14 @@ TEST(IsNullTest, ReferenceToConstLinkedPtr) { EXPECT_FALSE(m.Matches(non_null_p)); } -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_FUNCTION_ TEST(IsNullTest, StdFunction) { const Matcher<std::function<void()>> m = IsNull(); EXPECT_TRUE(m.Matches(std::function<void()>())); EXPECT_FALSE(m.Matches([]{})); } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_FUNCTION_ // Tests that IsNull() describes itself properly. TEST(IsNullTest, CanDescribeSelf) { @@ -1090,14 +1090,14 @@ TEST(NotNullTest, ReferenceToConstLinkedPtr) { EXPECT_TRUE(m.Matches(non_null_p)); } -#if GTEST_LANG_CXX11 +#if GTEST_HAS_STD_FUNCTION_ TEST(NotNullTest, StdFunction) { const Matcher<std::function<void()>> m = NotNull(); EXPECT_TRUE(m.Matches([]{})); EXPECT_FALSE(m.Matches(std::function<void()>())); } -#endif // GTEST_LANG_CXX11 +#endif // GTEST_HAS_STD_FUNCTION_ // Tests that NotNull() describes itself properly. TEST(NotNullTest, CanDescribeSelf) { @@ -2708,22 +2708,18 @@ class FloatingPointTest : public testing::Test { zero_bits_(Floating(0).bits()), one_bits_(Floating(1).bits()), infinity_bits_(Floating(Floating::Infinity()).bits()), - close_to_positive_zero_( - Floating::ReinterpretBits(zero_bits_ + max_ulps_/2)), - close_to_negative_zero_( - -Floating::ReinterpretBits(zero_bits_ + max_ulps_ - max_ulps_/2)), - further_from_negative_zero_(-Floating::ReinterpretBits( + close_to_positive_zero_(AsBits(zero_bits_ + max_ulps_/2)), + close_to_negative_zero_(AsBits(zero_bits_ + max_ulps_ - max_ulps_/2)), + further_from_negative_zero_(-AsBits( zero_bits_ + max_ulps_ + 1 - max_ulps_/2)), - close_to_one_(Floating::ReinterpretBits(one_bits_ + max_ulps_)), - further_from_one_(Floating::ReinterpretBits(one_bits_ + max_ulps_ + 1)), + close_to_one_(AsBits(one_bits_ + max_ulps_)), + further_from_one_(AsBits(one_bits_ + max_ulps_ + 1)), infinity_(Floating::Infinity()), - close_to_infinity_( - Floating::ReinterpretBits(infinity_bits_ - max_ulps_)), - further_from_infinity_( - Floating::ReinterpretBits(infinity_bits_ - max_ulps_ - 1)), + close_to_infinity_(AsBits(infinity_bits_ - max_ulps_)), + further_from_infinity_(AsBits(infinity_bits_ - max_ulps_ - 1)), max_(Floating::Max()), - nan1_(Floating::ReinterpretBits(Floating::kExponentBitMask | 1)), - nan2_(Floating::ReinterpretBits(Floating::kExponentBitMask | 200)) { + nan1_(AsBits(Floating::kExponentBitMask | 1)), + nan2_(AsBits(Floating::kExponentBitMask | 200)) { } void TestSize() { @@ -2804,6 +2800,12 @@ class FloatingPointTest : public testing::Test { // Some NaNs. const RawType nan1_; const RawType nan2_; + + private: + template <typename T> + static RawType AsBits(T value) { + return Floating::ReinterpretBits(static_cast<Bits>(value)); + } }; // Tests floating-point matchers with fixed epsilons. @@ -3179,6 +3181,8 @@ MATCHER_P(FieldIIs, inner_matcher, "") { return ExplainMatchResult(inner_matcher, arg.i, result_listener); } +#if GTEST_HAS_RTTI + TEST(WhenDynamicCastToTest, SameType) { Derived derived; derived.i = 4; @@ -3236,12 +3240,8 @@ TEST(WhenDynamicCastToTest, AmbiguousCast) { TEST(WhenDynamicCastToTest, Describe) { Matcher<Base*> matcher = WhenDynamicCastTo<Derived*>(Pointee(_)); -#if GTEST_HAS_RTTI const string prefix = "when dynamic_cast to " + internal::GetTypeName<Derived*>() + ", "; -#else // GTEST_HAS_RTTI - const string prefix = "when dynamic_cast, "; -#endif // GTEST_HAS_RTTI EXPECT_EQ(prefix + "points to a value that is anything", Describe(matcher)); EXPECT_EQ(prefix + "does not point to a value that is anything", DescribeNegation(matcher)); @@ -3275,6 +3275,8 @@ TEST(WhenDynamicCastToTest, BadReference) { EXPECT_THAT(as_base_ref, Not(WhenDynamicCastTo<const OtherDerived&>(_))); } +#endif // GTEST_HAS_RTTI + // Minimal const-propagating pointer. template <typename T> class ConstPropagatingPtr { |