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

Protected Types

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

 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 ()
 

Protected Attributes

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_
 

Static Private Member Functions

template<typename T >
static RawType AsBits (T value)
 
template<typename T >
static RawType AsBits (T value)
 
template<typename T >
static RawType AsBits (T value)
 

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)
 

Detailed Description

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

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

Member Typedef Documentation

template<typename RawType >
typedef Floating::Bits testing::gmock_matchers_test::FloatingPointTest< RawType >::Bits
protected

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

template<typename RawType >
typedef Floating::Bits testing::gmock_matchers_test::FloatingPointTest< RawType >::Bits
protected

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

template<typename RawType >
typedef Floating::Bits testing::gmock_matchers_test::FloatingPointTest< RawType >::Bits
protected

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

template<typename RawType >
typedef testing::internal::FloatingPoint<RawType> testing::gmock_matchers_test::FloatingPointTest< RawType >::Floating
protected

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

template<typename RawType >
typedef testing::internal::FloatingPoint<RawType> testing::gmock_matchers_test::FloatingPointTest< RawType >::Floating
protected

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

template<typename RawType >
typedef testing::internal::FloatingPoint<RawType> testing::gmock_matchers_test::FloatingPointTest< RawType >::Floating
protected

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

Constructor & Destructor Documentation

template<typename RawType >
testing::gmock_matchers_test::FloatingPointTest< RawType >::FloatingPointTest ( )
inlineprotected

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

2712  zero_bits_(Floating(0).bits()),
2713  one_bits_(Floating(1).bits()),
2718  zero_bits_ + max_ulps_ + 1 - max_ulps_/2)),
2724  max_(Floating::Max()),
2727  }
testing::internal::FloatingPoint< RawType > Floating
template<typename RawType >
testing::gmock_matchers_test::FloatingPointTest< RawType >::FloatingPointTest ( )
inlineprotected

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

2712  zero_bits_(Floating(0).bits()),
2713  one_bits_(Floating(1).bits()),
2718  zero_bits_ + max_ulps_ + 1 - max_ulps_/2)),
2724  max_(Floating::Max()),
2727  }
testing::internal::FloatingPoint< RawType > Floating
template<typename RawType >
testing::gmock_matchers_test::FloatingPointTest< RawType >::FloatingPointTest ( )
inlineprotected

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

2712  zero_bits_(Floating(0).bits()),
2713  one_bits_(Floating(1).bits()),
2718  zero_bits_ + max_ulps_ + 1 - max_ulps_/2)),
2724  max_(Floating::Max()),
2727  }
testing::internal::FloatingPoint< RawType > Floating

Member Function Documentation

template<typename RawType >
template<typename T >
static RawType testing::gmock_matchers_test::FloatingPointTest< RawType >::AsBits ( T  value)
inlinestaticprivate

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

2810  {
2811  return Floating::ReinterpretBits(static_cast<Bits>(value));
2812  }
static RawType ReinterpretBits(const Bits bits)
static const char *const value
Definition: Conv.cpp:50
template<typename RawType >
template<typename T >
static RawType testing::gmock_matchers_test::FloatingPointTest< RawType >::AsBits ( T  value)
inlinestaticprivate

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

2810  {
2811  return Floating::ReinterpretBits(static_cast<Bits>(value));
2812  }
static RawType ReinterpretBits(const Bits bits)
static const char *const value
Definition: Conv.cpp:50
template<typename RawType >
template<typename T >
static RawType testing::gmock_matchers_test::FloatingPointTest< RawType >::AsBits ( T  value)
inlinestaticprivate

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

2810  {
2811  return Floating::ReinterpretBits(static_cast<Bits>(value));
2812  }
static RawType ReinterpretBits(const Bits bits)
static const char *const value
Definition: Conv.cpp:50
template<typename RawType >
void testing::gmock_matchers_test::FloatingPointTest< RawType >::TestMatches ( testing::internal::FloatingEqMatcher< RawType >(*)(RawType)  matcher_maker)
inlineprotected

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

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

2736  {
2737  Matcher<RawType> m1 = matcher_maker(0.0);
2738  EXPECT_TRUE(m1.Matches(-0.0));
2739  EXPECT_TRUE(m1.Matches(close_to_positive_zero_));
2740  EXPECT_TRUE(m1.Matches(close_to_negative_zero_));
2741  EXPECT_FALSE(m1.Matches(1.0));
2742 
2743  Matcher<RawType> m2 = matcher_maker(close_to_positive_zero_);
2745 
2746  Matcher<RawType> m3 = matcher_maker(1.0);
2747  EXPECT_TRUE(m3.Matches(close_to_one_));
2748  EXPECT_FALSE(m3.Matches(further_from_one_));
2749 
2750  // Test commutativity: matcher_maker(0.0).Matches(1.0) was tested above.
2751  EXPECT_FALSE(m3.Matches(0.0));
2752 
2753  Matcher<RawType> m4 = matcher_maker(-infinity_);
2754  EXPECT_TRUE(m4.Matches(-close_to_infinity_));
2755 
2756  Matcher<RawType> m5 = matcher_maker(infinity_);
2757  EXPECT_TRUE(m5.Matches(close_to_infinity_));
2758 
2759  // This is interesting as the representations of infinity_ and nan1_
2760  // are only 1 DLP apart.
2761  EXPECT_FALSE(m5.Matches(nan1_));
2762 
2763  // matcher_maker can produce a Matcher<const RawType&>, which is needed in
2764  // some cases.
2765  Matcher<const RawType&> m6 = matcher_maker(0.0);
2766  EXPECT_TRUE(m6.Matches(-0.0));
2767  EXPECT_TRUE(m6.Matches(close_to_positive_zero_));
2768  EXPECT_FALSE(m6.Matches(1.0));
2769 
2770  // matcher_maker can produce a Matcher<RawType&>, which is needed in some
2771  // cases.
2772  Matcher<RawType&> m7 = matcher_maker(0.0);
2773  RawType x = 0.0;
2774  EXPECT_TRUE(m7.Matches(x));
2775  x = 0.01f;
2776  EXPECT_FALSE(m7.Matches(x));
2777  }
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::FloatingPointTest< RawType >::TestMatches ( testing::internal::FloatingEqMatcher< RawType >(*)(RawType)  matcher_maker)
inlineprotected

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

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

2736  {
2737  Matcher<RawType> m1 = matcher_maker(0.0);
2738  EXPECT_TRUE(m1.Matches(-0.0));
2739  EXPECT_TRUE(m1.Matches(close_to_positive_zero_));
2740  EXPECT_TRUE(m1.Matches(close_to_negative_zero_));
2741  EXPECT_FALSE(m1.Matches(1.0));
2742 
2743  Matcher<RawType> m2 = matcher_maker(close_to_positive_zero_);
2745 
2746  Matcher<RawType> m3 = matcher_maker(1.0);
2747  EXPECT_TRUE(m3.Matches(close_to_one_));
2748  EXPECT_FALSE(m3.Matches(further_from_one_));
2749 
2750  // Test commutativity: matcher_maker(0.0).Matches(1.0) was tested above.
2751  EXPECT_FALSE(m3.Matches(0.0));
2752 
2753  Matcher<RawType> m4 = matcher_maker(-infinity_);
2754  EXPECT_TRUE(m4.Matches(-close_to_infinity_));
2755 
2756  Matcher<RawType> m5 = matcher_maker(infinity_);
2757  EXPECT_TRUE(m5.Matches(close_to_infinity_));
2758 
2759  // This is interesting as the representations of infinity_ and nan1_
2760  // are only 1 DLP apart.
2761  EXPECT_FALSE(m5.Matches(nan1_));
2762 
2763  // matcher_maker can produce a Matcher<const RawType&>, which is needed in
2764  // some cases.
2765  Matcher<const RawType&> m6 = matcher_maker(0.0);
2766  EXPECT_TRUE(m6.Matches(-0.0));
2767  EXPECT_TRUE(m6.Matches(close_to_positive_zero_));
2768  EXPECT_FALSE(m6.Matches(1.0));
2769 
2770  // matcher_maker can produce a Matcher<RawType&>, which is needed in some
2771  // cases.
2772  Matcher<RawType&> m7 = matcher_maker(0.0);
2773  RawType x = 0.0;
2774  EXPECT_TRUE(m7.Matches(x));
2775  x = 0.01f;
2776  EXPECT_FALSE(m7.Matches(x));
2777  }
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::FloatingPointTest< RawType >::TestMatches ( testing::internal::FloatingEqMatcher< RawType >(*)(RawType)  matcher_maker)
inlineprotected

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

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

2736  {
2737  Matcher<RawType> m1 = matcher_maker(0.0);
2738  EXPECT_TRUE(m1.Matches(-0.0));
2739  EXPECT_TRUE(m1.Matches(close_to_positive_zero_));
2740  EXPECT_TRUE(m1.Matches(close_to_negative_zero_));
2741  EXPECT_FALSE(m1.Matches(1.0));
2742 
2743  Matcher<RawType> m2 = matcher_maker(close_to_positive_zero_);
2745 
2746  Matcher<RawType> m3 = matcher_maker(1.0);
2747  EXPECT_TRUE(m3.Matches(close_to_one_));
2748  EXPECT_FALSE(m3.Matches(further_from_one_));
2749 
2750  // Test commutativity: matcher_maker(0.0).Matches(1.0) was tested above.
2751  EXPECT_FALSE(m3.Matches(0.0));
2752 
2753  Matcher<RawType> m4 = matcher_maker(-infinity_);
2754  EXPECT_TRUE(m4.Matches(-close_to_infinity_));
2755 
2756  Matcher<RawType> m5 = matcher_maker(infinity_);
2757  EXPECT_TRUE(m5.Matches(close_to_infinity_));
2758 
2759  // This is interesting as the representations of infinity_ and nan1_
2760  // are only 1 DLP apart.
2761  EXPECT_FALSE(m5.Matches(nan1_));
2762 
2763  // matcher_maker can produce a Matcher<const RawType&>, which is needed in
2764  // some cases.
2765  Matcher<const RawType&> m6 = matcher_maker(0.0);
2766  EXPECT_TRUE(m6.Matches(-0.0));
2767  EXPECT_TRUE(m6.Matches(close_to_positive_zero_));
2768  EXPECT_FALSE(m6.Matches(1.0));
2769 
2770  // matcher_maker can produce a Matcher<RawType&>, which is needed in some
2771  // cases.
2772  Matcher<RawType&> m7 = matcher_maker(0.0);
2773  RawType x = 0.0;
2774  EXPECT_TRUE(m7.Matches(x));
2775  x = 0.01f;
2776  EXPECT_FALSE(m7.Matches(x));
2777  }
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::FloatingPointTest< RawType >::TestSize ( )
inlineprotected

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

References EXPECT_EQ.

2729  {
2730  EXPECT_EQ(sizeof(RawType), sizeof(Bits));
2731  }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
template<typename RawType >
void testing::gmock_matchers_test::FloatingPointTest< RawType >::TestSize ( )
inlineprotected

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

References EXPECT_EQ.

2729  {
2730  EXPECT_EQ(sizeof(RawType), sizeof(Bits));
2731  }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
template<typename RawType >
void testing::gmock_matchers_test::FloatingPointTest< RawType >::TestSize ( )
inlineprotected

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

References EXPECT_EQ.

2729  {
2730  EXPECT_EQ(sizeof(RawType), sizeof(Bits));
2731  }
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922

Member Data Documentation

template<typename RawType >
const RawType testing::gmock_matchers_test::FloatingPointTest< RawType >::close_to_infinity_
protected

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

template<typename RawType >
const RawType testing::gmock_matchers_test::FloatingPointTest< RawType >::close_to_negative_zero_
protected

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

template<typename RawType >
const RawType testing::gmock_matchers_test::FloatingPointTest< RawType >::close_to_one_
protected

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

template<typename RawType >
const RawType testing::gmock_matchers_test::FloatingPointTest< RawType >::close_to_positive_zero_
protected

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

template<typename RawType >
const RawType testing::gmock_matchers_test::FloatingPointTest< RawType >::further_from_infinity_
protected

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

template<typename RawType >
const RawType testing::gmock_matchers_test::FloatingPointTest< RawType >::further_from_negative_zero_
protected

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

template<typename RawType >
const RawType testing::gmock_matchers_test::FloatingPointTest< RawType >::further_from_one_
protected

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

template<typename RawType >
const RawType testing::gmock_matchers_test::FloatingPointTest< RawType >::infinity_
protected

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

template<typename RawType >
const Bits testing::gmock_matchers_test::FloatingPointTest< RawType >::infinity_bits_
protected

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

template<typename RawType >
const RawType testing::gmock_matchers_test::FloatingPointTest< RawType >::max_
protected

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

template<typename RawType >
const size_t testing::gmock_matchers_test::FloatingPointTest< RawType >::max_ulps_
protected

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

template<typename RawType >
const RawType testing::gmock_matchers_test::FloatingPointTest< RawType >::nan1_
protected

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

template<typename RawType >
const RawType testing::gmock_matchers_test::FloatingPointTest< RawType >::nan2_
protected

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

template<typename RawType >
const Bits testing::gmock_matchers_test::FloatingPointTest< RawType >::one_bits_
protected

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

template<typename RawType >
const Bits testing::gmock_matchers_test::FloatingPointTest< RawType >::zero_bits_
protected

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


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