Merge pull request #627 from mark-chromium/tests_msvs

Fix warnings encountered in MSVC build of gtest/gmock tests
This commit is contained in:
Billy Donahue 2015-11-23 10:10:53 -05:00
commit 786564fa4a
2 changed files with 17 additions and 15 deletions

View File

@ -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.

View File

@ -75,8 +75,8 @@ TEST(IsXDigitTest, WorksForNarrowAscii) {
}
TEST(IsXDigitTest, ReturnsFalseForNarrowNonAscii) {
EXPECT_FALSE(IsXDigit(static_cast<char>(0x80)));
EXPECT_FALSE(IsXDigit(static_cast<char>('0' | 0x80)));
EXPECT_FALSE(IsXDigit('\x80'));
EXPECT_FALSE(IsXDigit(static_cast<char>('0' | '\x80')));
}
TEST(IsXDigitTest, WorksForWideAscii) {