Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
testing::gmock_matchers_test::FloatingPointTest< RawType > Class Template Reference
Inheritance diagram for testing::gmock_matchers_test::FloatingPointTest< RawType >:
Collaboration diagram for testing::gmock_matchers_test::FloatingPointTest< RawType >:

Protected Types

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))
 
- Protected Member Functions inherited from testing::Test
 Test ()
 
virtual void SetUp ()
 
virtual void TearDown ()
 

Protected Attributes

const Bits 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_
 

Additional Inherited Members

- Public Types inherited from testing::Test
typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc
 
typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc
 
- Public Member Functions inherited from testing::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)
 

Detailed Description

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

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

Member Typedef Documentation

◆ Bits

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

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

◆ Floating

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

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

Constructor & Destructor Documentation

◆ FloatingPointTest()

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

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

3232 zero_bits_(Floating(0).bits()),
3233 one_bits_(Floating(1).bits()),
3240 zero_bits_ + max_ulps_ + 1 - max_ulps_/2)),
3251 }
testing::internal::FloatingPoint< RawType > Floating
static RawType ReinterpretBits(const Bits bits)

Member Function Documentation

◆ TestMatches()

template<typename RawType >
void testing::gmock_matchers_test::FloatingPointTest< RawType >::TestMatches ( testing::internal::FloatingEqMatcher< RawType >(* matcher_maker )(RawType))
inlineprotected

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

3260 {
3261 Matcher<RawType> m1 = matcher_maker(0.0);
3262 EXPECT_TRUE(m1.Matches(-0.0));
3265 EXPECT_FALSE(m1.Matches(1.0));
3266
3267 Matcher<RawType> m2 = matcher_maker(close_to_positive_zero_);
3269
3270 Matcher<RawType> m3 = matcher_maker(1.0);
3271 EXPECT_TRUE(m3.Matches(close_to_one_));
3272 EXPECT_FALSE(m3.Matches(further_from_one_));
3273
3274 // Test commutativity: matcher_maker(0.0).Matches(1.0) was tested above.
3275 EXPECT_FALSE(m3.Matches(0.0));
3276
3277 Matcher<RawType> m4 = matcher_maker(-infinity_);
3278 EXPECT_TRUE(m4.Matches(-close_to_infinity_));
3279
3280 Matcher<RawType> m5 = matcher_maker(infinity_);
3281 EXPECT_TRUE(m5.Matches(close_to_infinity_));
3282
3283 // This is interesting as the representations of infinity_ and nan1_
3284 // are only 1 DLP apart.
3285 EXPECT_FALSE(m5.Matches(nan1_));
3286
3287 // matcher_maker can produce a Matcher<const RawType&>, which is needed in
3288 // some cases.
3289 Matcher<const RawType&> m6 = matcher_maker(0.0);
3290 EXPECT_TRUE(m6.Matches(-0.0));
3292 EXPECT_FALSE(m6.Matches(1.0));
3293
3294 // matcher_maker can produce a Matcher<RawType&>, which is needed in some
3295 // cases.
3296 Matcher<RawType&> m7 = matcher_maker(0.0);
3297 RawType x = 0.0;
3298 EXPECT_TRUE(m7.Matches(x));
3299 x = 0.01f;
3300 EXPECT_FALSE(m7.Matches(x));
3301 }
#define EXPECT_TRUE(condition)
Definition gtest.h:1895
#define EXPECT_FALSE(condition)
Definition gtest.h:1898
Here is the call graph for this function:

◆ TestSize()

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

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

3253 {
3254 EXPECT_EQ(sizeof(RawType), sizeof(Bits));
3255 }
#define EXPECT_EQ(val1, val2)
Definition gtest.h:1954

Member Data Documentation

◆ close_to_infinity_

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

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

◆ close_to_negative_zero_

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

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

◆ close_to_one_

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

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

◆ close_to_positive_zero_

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

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

◆ further_from_infinity_

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

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

◆ further_from_negative_zero_

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

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

◆ further_from_one_

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

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

◆ infinity_

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

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

◆ infinity_bits_

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

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

◆ max_

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

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

◆ max_ulps_

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

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

◆ nan1_

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

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

◆ nan2_

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

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

◆ one_bits_

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

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

◆ zero_bits_

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

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


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