proxygen
testing::gmock_matchers_test::FloatingPointNearTest< RawType > Class Template Reference
Inheritance diagram for testing::gmock_matchers_test::FloatingPointNearTest< RawType >:
testing::gmock_matchers_test::FloatingPointTest< RawType > testing::gmock_matchers_test::FloatingPointTest< RawType > testing::gmock_matchers_test::FloatingPointTest< RawType > testing::Test testing::Test testing::Test testing::Test testing::Test testing::Test testing::Test testing::Test testing::Test

Protected Types

typedef FloatingPointTest< RawType > ParentType
 
typedef FloatingPointTest< RawType > ParentType
 
typedef FloatingPointTest< RawType > ParentType
 
- Protected Types inherited from testing::gmock_matchers_test::FloatingPointTest< RawType >
typedef testing::internal::FloatingPoint< RawType > Floating
 
typedef Floating::Bits Bits
 
typedef testing::internal::FloatingPoint< RawType > Floating
 
typedef Floating::Bits Bits
 
typedef testing::internal::FloatingPoint< RawType > Floating
 
typedef Floating::Bits Bits
 

Protected Member Functions

void TestNearMatches (testing::internal::FloatingEqMatcher< RawType >(*matcher_maker)(RawType, RawType))
 
void TestNearMatches (testing::internal::FloatingEqMatcher< RawType >(*matcher_maker)(RawType, RawType))
 
void TestNearMatches (testing::internal::FloatingEqMatcher< RawType >(*matcher_maker)(RawType, RawType))
 
- Protected Member Functions inherited from testing::gmock_matchers_test::FloatingPointTest< RawType >
 FloatingPointTest ()
 
void TestSize ()
 
void TestMatches (testing::internal::FloatingEqMatcher< RawType >(*matcher_maker)(RawType))
 
 FloatingPointTest ()
 
void TestSize ()
 
void TestMatches (testing::internal::FloatingEqMatcher< RawType >(*matcher_maker)(RawType))
 
 FloatingPointTest ()
 
void TestSize ()
 
void TestMatches (testing::internal::FloatingEqMatcher< RawType >(*matcher_maker)(RawType))
 
- Protected Member Functions inherited from testing::Test
 Test ()
 
virtual void SetUp ()
 
virtual void TearDown ()
 
 Test ()
 
virtual void SetUp ()
 
virtual void TearDown ()
 
 Test ()
 
virtual void SetUp ()
 
virtual void TearDown ()
 

Additional Inherited Members

- Public Types inherited from testing::Test
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
- Public Member Functions inherited from testing::Test
virtual ~Test ()
 
virtual ~Test ()
 
virtual ~Test ()
 
- Static Public Member Functions inherited from testing::Test
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 
static void SetUpTestCase ()
 
static void TearDownTestCase ()
 
static bool HasFatalFailure ()
 
static bool HasNonfatalFailure ()
 
static bool HasFailure ()
 
static void RecordProperty (const std::string &key, const std::string &value)
 
static void RecordProperty (const std::string &key, int value)
 
- Protected Attributes inherited from testing::gmock_matchers_test::FloatingPointTest< RawType >
const size_t max_ulps_
 
const Bits zero_bits_
 
const Bits one_bits_
 
const Bits infinity_bits_
 
const RawType close_to_positive_zero_
 
const RawType close_to_negative_zero_
 
const RawType further_from_negative_zero_
 
const RawType close_to_one_
 
const RawType further_from_one_
 
const RawType infinity_
 
const RawType close_to_infinity_
 
const RawType further_from_infinity_
 
const RawType max_
 
const RawType nan1_
 
const RawType nan2_
 

Detailed Description

template<typename RawType>
class testing::gmock_matchers_test::FloatingPointNearTest< RawType >

Definition at line 2817 of file gmock-matchers_test.cc.

Member Typedef Documentation

template<typename RawType >
typedef FloatingPointTest<RawType> testing::gmock_matchers_test::FloatingPointNearTest< RawType >::ParentType
protected

Definition at line 2819 of file gmock-matchers_test.cc.

template<typename RawType >
typedef FloatingPointTest<RawType> testing::gmock_matchers_test::FloatingPointNearTest< RawType >::ParentType
protected

Definition at line 2819 of file gmock-matchers_test.cc.

template<typename RawType >
typedef FloatingPointTest<RawType> testing::gmock_matchers_test::FloatingPointNearTest< RawType >::ParentType
protected

Definition at line 2819 of file gmock-matchers_test.cc.

Member Function Documentation

template<typename RawType >
void testing::gmock_matchers_test::FloatingPointNearTest< RawType >::TestNearMatches ( testing::internal::FloatingEqMatcher< RawType >(*)(RawType, RawType)  matcher_maker)
inlineprotected

Definition at line 2823 of file gmock-matchers_test.cc.

References EXPECT_FALSE, EXPECT_TRUE, testing::internal::MatcherBase< T >::Matches(), and max_.

2825  {
2826  Matcher<RawType> m1 = matcher_maker(0.0, 0.0);
2827  EXPECT_TRUE(m1.Matches(0.0));
2828  EXPECT_TRUE(m1.Matches(-0.0));
2831  EXPECT_FALSE(m1.Matches(1.0));
2832 
2833  Matcher<RawType> m2 = matcher_maker(0.0, 1.0);
2834  EXPECT_TRUE(m2.Matches(0.0));
2835  EXPECT_TRUE(m2.Matches(-0.0));
2836  EXPECT_TRUE(m2.Matches(1.0));
2837  EXPECT_TRUE(m2.Matches(-1.0));
2840 
2841  // Check that inf matches inf, regardless of the of the specified max
2842  // absolute error.
2843  Matcher<RawType> m3 = matcher_maker(ParentType::infinity_, 0.0);
2844  EXPECT_TRUE(m3.Matches(ParentType::infinity_));
2846  EXPECT_FALSE(m3.Matches(-ParentType::infinity_));
2847 
2848  Matcher<RawType> m4 = matcher_maker(-ParentType::infinity_, 0.0);
2849  EXPECT_TRUE(m4.Matches(-ParentType::infinity_));
2851  EXPECT_FALSE(m4.Matches(ParentType::infinity_));
2852 
2853  // Test various overflow scenarios.
2854  Matcher<RawType> m5 = matcher_maker(ParentType::max_, ParentType::max_);
2855  EXPECT_TRUE(m5.Matches(ParentType::max_));
2856  EXPECT_FALSE(m5.Matches(-ParentType::max_));
2857 
2858  Matcher<RawType> m6 = matcher_maker(-ParentType::max_, ParentType::max_);
2859  EXPECT_FALSE(m6.Matches(ParentType::max_));
2860  EXPECT_TRUE(m6.Matches(-ParentType::max_));
2861 
2862  Matcher<RawType> m7 = matcher_maker(ParentType::max_, 0);
2863  EXPECT_TRUE(m7.Matches(ParentType::max_));
2864  EXPECT_FALSE(m7.Matches(-ParentType::max_));
2865 
2866  Matcher<RawType> m8 = matcher_maker(-ParentType::max_, 0);
2867  EXPECT_FALSE(m8.Matches(ParentType::max_));
2868  EXPECT_TRUE(m8.Matches(-ParentType::max_));
2869 
2870  // The difference between max() and -max() normally overflows to infinity,
2871  // but it should still match if the max_abs_error is also infinity.
2872  Matcher<RawType> m9 = matcher_maker(
2874  EXPECT_TRUE(m8.Matches(-ParentType::max_));
2875 
2876  // matcher_maker can produce a Matcher<const RawType&>, which is needed in
2877  // some cases.
2878  Matcher<const RawType&> m10 = matcher_maker(0.0, 1.0);
2879  EXPECT_TRUE(m10.Matches(-0.0));
2882 
2883  // matcher_maker can produce a Matcher<RawType&>, which is needed in some
2884  // cases.
2885  Matcher<RawType&> m11 = matcher_maker(0.0, 1.0);
2886  RawType x = 0.0;
2887  EXPECT_TRUE(m11.Matches(x));
2888  x = 1.0f;
2889  EXPECT_TRUE(m11.Matches(x));
2890  x = -1.0f;
2891  EXPECT_TRUE(m11.Matches(x));
2892  x = 1.1f;
2893  EXPECT_FALSE(m11.Matches(x));
2894  x = -1.1f;
2895  EXPECT_FALSE(m11.Matches(x));
2896  }
Definition: InvokeTest.cpp:58
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
#define EXPECT_FALSE(condition)
Definition: gtest.h:1862
template<typename RawType >
void testing::gmock_matchers_test::FloatingPointNearTest< RawType >::TestNearMatches ( testing::internal::FloatingEqMatcher< RawType >(*)(RawType, RawType)  matcher_maker)
inlineprotected

Definition at line 2823 of file gmock-matchers_test.cc.

References testing::_, testing::gmock_matchers_test::Describe(), testing::gmock_matchers_test::DescribeNegation(), testing::DoubleEq(), testing::DoubleNear(), EXPECT_EQ, EXPECT_FALSE, EXPECT_THAT, EXPECT_TRUE, testing::gmock_matchers_test::Explain(), testing::ExplainMatchResult(), f, testing::FloatEq(), testing::FloatNear(), testing::Ge(), testing::HasSubstr(), testing::gmock_matchers_test::Derived::i, testing::internal::IsNull(), testing::gmock_matchers_test::MATCHER_P(), testing::internal::MatcherBase< T >::Matches(), max_, testing::NanSensitiveDoubleEq(), testing::NanSensitiveDoubleNear(), testing::NanSensitiveFloatEq(), testing::NanSensitiveFloatNear(), testing::Not(), testing::Pointee(), prefix(), testing::internal::TEST(), testing::internal::TEST_F(), and x.

2825  {
2826  Matcher<RawType> m1 = matcher_maker(0.0, 0.0);
2827  EXPECT_TRUE(m1.Matches(0.0));
2828  EXPECT_TRUE(m1.Matches(-0.0));
2831  EXPECT_FALSE(m1.Matches(1.0));
2832 
2833  Matcher<RawType> m2 = matcher_maker(0.0, 1.0);
2834  EXPECT_TRUE(m2.Matches(0.0));
2835  EXPECT_TRUE(m2.Matches(-0.0));
2836  EXPECT_TRUE(m2.Matches(1.0));
2837  EXPECT_TRUE(m2.Matches(-1.0));
2840 
2841  // Check that inf matches inf, regardless of the of the specified max
2842  // absolute error.
2843  Matcher<RawType> m3 = matcher_maker(ParentType::infinity_, 0.0);
2844  EXPECT_TRUE(m3.Matches(ParentType::infinity_));
2846  EXPECT_FALSE(m3.Matches(-ParentType::infinity_));
2847 
2848  Matcher<RawType> m4 = matcher_maker(-ParentType::infinity_, 0.0);
2849  EXPECT_TRUE(m4.Matches(-ParentType::infinity_));
2851  EXPECT_FALSE(m4.Matches(ParentType::infinity_));
2852 
2853  // Test various overflow scenarios.
2854  Matcher<RawType> m5 = matcher_maker(ParentType::max_, ParentType::max_);
2855  EXPECT_TRUE(m5.Matches(ParentType::max_));
2856  EXPECT_FALSE(m5.Matches(-ParentType::max_));
2857 
2858  Matcher<RawType> m6 = matcher_maker(-ParentType::max_, ParentType::max_);
2859  EXPECT_FALSE(m6.Matches(ParentType::max_));
2860  EXPECT_TRUE(m6.Matches(-ParentType::max_));
2861 
2862  Matcher<RawType> m7 = matcher_maker(ParentType::max_, 0);
2863  EXPECT_TRUE(m7.Matches(ParentType::max_));
2864  EXPECT_FALSE(m7.Matches(-ParentType::max_));
2865 
2866  Matcher<RawType> m8 = matcher_maker(-ParentType::max_, 0);
2867  EXPECT_FALSE(m8.Matches(ParentType::max_));
2868  EXPECT_TRUE(m8.Matches(-ParentType::max_));
2869 
2870  // The difference between max() and -max() normally overflows to infinity,
2871  // but it should still match if the max_abs_error is also infinity.
2872  Matcher<RawType> m9 = matcher_maker(
2874  EXPECT_TRUE(m8.Matches(-ParentType::max_));
2875 
2876  // matcher_maker can produce a Matcher<const RawType&>, which is needed in
2877  // some cases.
2878  Matcher<const RawType&> m10 = matcher_maker(0.0, 1.0);
2879  EXPECT_TRUE(m10.Matches(-0.0));
2882 
2883  // matcher_maker can produce a Matcher<RawType&>, which is needed in some
2884  // cases.
2885  Matcher<RawType&> m11 = matcher_maker(0.0, 1.0);
2886  RawType x = 0.0;
2887  EXPECT_TRUE(m11.Matches(x));
2888  x = 1.0f;
2889  EXPECT_TRUE(m11.Matches(x));
2890  x = -1.0f;
2891  EXPECT_TRUE(m11.Matches(x));
2892  x = 1.1f;
2893  EXPECT_FALSE(m11.Matches(x));
2894  x = -1.1f;
2895  EXPECT_FALSE(m11.Matches(x));
2896  }
Definition: InvokeTest.cpp:58
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
#define EXPECT_FALSE(condition)
Definition: gtest.h:1862
template<typename RawType >
void testing::gmock_matchers_test::FloatingPointNearTest< RawType >::TestNearMatches ( testing::internal::FloatingEqMatcher< RawType >(*)(RawType, RawType)  matcher_maker)
inlineprotected

Definition at line 2823 of file gmock-matchers_test.cc.

References testing::_, testing::gmock_matchers_test::Describe(), testing::gmock_matchers_test::DescribeNegation(), testing::DoubleEq(), testing::DoubleNear(), EXPECT_EQ, EXPECT_FALSE, EXPECT_THAT, EXPECT_TRUE, testing::gmock_matchers_test::Explain(), testing::ExplainMatchResult(), f, testing::FloatEq(), testing::FloatNear(), testing::Ge(), testing::HasSubstr(), testing::gmock_matchers_test::Derived::i, testing::internal::IsNull(), testing::gmock_matchers_test::MATCHER_P(), testing::internal::MatcherBase< T >::Matches(), max_, testing::NanSensitiveDoubleEq(), testing::NanSensitiveDoubleNear(), testing::NanSensitiveFloatEq(), testing::NanSensitiveFloatNear(), testing::Not(), testing::Pointee(), prefix(), testing::internal::TEST(), testing::internal::TEST_F(), and x.

2825  {
2826  Matcher<RawType> m1 = matcher_maker(0.0, 0.0);
2827  EXPECT_TRUE(m1.Matches(0.0));
2828  EXPECT_TRUE(m1.Matches(-0.0));
2831  EXPECT_FALSE(m1.Matches(1.0));
2832 
2833  Matcher<RawType> m2 = matcher_maker(0.0, 1.0);
2834  EXPECT_TRUE(m2.Matches(0.0));
2835  EXPECT_TRUE(m2.Matches(-0.0));
2836  EXPECT_TRUE(m2.Matches(1.0));
2837  EXPECT_TRUE(m2.Matches(-1.0));
2840 
2841  // Check that inf matches inf, regardless of the of the specified max
2842  // absolute error.
2843  Matcher<RawType> m3 = matcher_maker(ParentType::infinity_, 0.0);
2844  EXPECT_TRUE(m3.Matches(ParentType::infinity_));
2846  EXPECT_FALSE(m3.Matches(-ParentType::infinity_));
2847 
2848  Matcher<RawType> m4 = matcher_maker(-ParentType::infinity_, 0.0);
2849  EXPECT_TRUE(m4.Matches(-ParentType::infinity_));
2851  EXPECT_FALSE(m4.Matches(ParentType::infinity_));
2852 
2853  // Test various overflow scenarios.
2854  Matcher<RawType> m5 = matcher_maker(ParentType::max_, ParentType::max_);
2855  EXPECT_TRUE(m5.Matches(ParentType::max_));
2856  EXPECT_FALSE(m5.Matches(-ParentType::max_));
2857 
2858  Matcher<RawType> m6 = matcher_maker(-ParentType::max_, ParentType::max_);
2859  EXPECT_FALSE(m6.Matches(ParentType::max_));
2860  EXPECT_TRUE(m6.Matches(-ParentType::max_));
2861 
2862  Matcher<RawType> m7 = matcher_maker(ParentType::max_, 0);
2863  EXPECT_TRUE(m7.Matches(ParentType::max_));
2864  EXPECT_FALSE(m7.Matches(-ParentType::max_));
2865 
2866  Matcher<RawType> m8 = matcher_maker(-ParentType::max_, 0);
2867  EXPECT_FALSE(m8.Matches(ParentType::max_));
2868  EXPECT_TRUE(m8.Matches(-ParentType::max_));
2869 
2870  // The difference between max() and -max() normally overflows to infinity,
2871  // but it should still match if the max_abs_error is also infinity.
2872  Matcher<RawType> m9 = matcher_maker(
2874  EXPECT_TRUE(m8.Matches(-ParentType::max_));
2875 
2876  // matcher_maker can produce a Matcher<const RawType&>, which is needed in
2877  // some cases.
2878  Matcher<const RawType&> m10 = matcher_maker(0.0, 1.0);
2879  EXPECT_TRUE(m10.Matches(-0.0));
2882 
2883  // matcher_maker can produce a Matcher<RawType&>, which is needed in some
2884  // cases.
2885  Matcher<RawType&> m11 = matcher_maker(0.0, 1.0);
2886  RawType x = 0.0;
2887  EXPECT_TRUE(m11.Matches(x));
2888  x = 1.0f;
2889  EXPECT_TRUE(m11.Matches(x));
2890  x = -1.0f;
2891  EXPECT_TRUE(m11.Matches(x));
2892  x = 1.1f;
2893  EXPECT_FALSE(m11.Matches(x));
2894  x = -1.1f;
2895  EXPECT_FALSE(m11.Matches(x));
2896  }
Definition: InvokeTest.cpp:58
#define EXPECT_TRUE(condition)
Definition: gtest.h:1859
#define EXPECT_FALSE(condition)
Definition: gtest.h:1862

The documentation for this class was generated from the following file: