diff options
author | Abseil Team <absl-team@google.com> | 2019-11-20 19:36:06 (GMT) |
---|---|---|
committer | Gennadiy Civil <misterg@google.com> | 2019-11-22 21:33:15 (GMT) |
commit | 717ce7feb87278b81dad756d973693024621f8e8 (patch) | |
tree | 2c016351f4359b94f75fa2af762d2138998d8063 /googlemock/test | |
parent | 200ff599496e20f4e39566feeaf2f6734ca7570f (diff) | |
download | googletest-717ce7feb87278b81dad756d973693024621f8e8.zip googletest-717ce7feb87278b81dad756d973693024621f8e8.tar.gz googletest-717ce7feb87278b81dad756d973693024621f8e8.tar.bz2 |
Googletest export
Use standard C++11 integer types in gtest-port.h.
Remove testing::internal::{Int,Uint}{32,64} in favor of types
guaranteed to be in <cstdint> since C++11.
Tests for built-in integer type coverage are switched from
{Int,Uint}64 to [unsigned] long long, which is guaranteed by
C++11 to exist and be at least 64-bit wide.
PiperOrigin-RevId: 281565263
Diffstat (limited to 'googlemock/test')
-rw-r--r-- | googlemock/test/gmock-actions_test.cc | 12 | ||||
-rw-r--r-- | googlemock/test/gmock-internal-utils_test.cc | 18 | ||||
-rw-r--r-- | googlemock/test/gmock-matchers_test.cc | 5 |
3 files changed, 19 insertions, 16 deletions
diff --git a/googlemock/test/gmock-actions_test.cc b/googlemock/test/gmock-actions_test.cc index ae4fa20..58a2d35 100644 --- a/googlemock/test/gmock-actions_test.cc +++ b/googlemock/test/gmock-actions_test.cc @@ -80,8 +80,6 @@ using testing::SetArgumentPointee; using testing::Unused; using testing::WithArgs; using testing::internal::BuiltInDefaultValue; -using testing::internal::Int64; -using testing::internal::UInt64; #if !GTEST_OS_WINDOWS_MOBILE using testing::SetErrnoAndReturn; @@ -123,8 +121,9 @@ TEST(BuiltInDefaultValueTest, IsZeroForNumericTypes) { EXPECT_EQ(0U, BuiltInDefaultValue<unsigned long>::Get()); // NOLINT EXPECT_EQ(0, BuiltInDefaultValue<signed long>::Get()); // NOLINT EXPECT_EQ(0, BuiltInDefaultValue<long>::Get()); // NOLINT - EXPECT_EQ(0U, BuiltInDefaultValue<UInt64>::Get()); - EXPECT_EQ(0, BuiltInDefaultValue<Int64>::Get()); + EXPECT_EQ(0U, BuiltInDefaultValue<unsigned long long>::Get()); // NOLINT + EXPECT_EQ(0, BuiltInDefaultValue<signed long long>::Get()); // NOLINT + EXPECT_EQ(0, BuiltInDefaultValue<long long>::Get()); // NOLINT EXPECT_EQ(0, BuiltInDefaultValue<float>::Get()); EXPECT_EQ(0, BuiltInDefaultValue<double>::Get()); } @@ -147,8 +146,9 @@ TEST(BuiltInDefaultValueTest, ExistsForNumericTypes) { EXPECT_TRUE(BuiltInDefaultValue<unsigned long>::Exists()); // NOLINT EXPECT_TRUE(BuiltInDefaultValue<signed long>::Exists()); // NOLINT EXPECT_TRUE(BuiltInDefaultValue<long>::Exists()); // NOLINT - EXPECT_TRUE(BuiltInDefaultValue<UInt64>::Exists()); - EXPECT_TRUE(BuiltInDefaultValue<Int64>::Exists()); + EXPECT_TRUE(BuiltInDefaultValue<unsigned long long>::Exists()); // NOLINT + EXPECT_TRUE(BuiltInDefaultValue<signed long long>::Exists()); // NOLINT + EXPECT_TRUE(BuiltInDefaultValue<long long>::Exists()); // NOLINT EXPECT_TRUE(BuiltInDefaultValue<float>::Exists()); EXPECT_TRUE(BuiltInDefaultValue<double>::Exists()); } diff --git a/googlemock/test/gmock-internal-utils_test.cc b/googlemock/test/gmock-internal-utils_test.cc index 19ba6fe..8019f4a 100644 --- a/googlemock/test/gmock-internal-utils_test.cc +++ b/googlemock/test/gmock-internal-utils_test.cc @@ -36,6 +36,7 @@ #include <stdlib.h> +#include <cstdint> #include <map> #include <memory> #include <sstream> @@ -172,9 +173,9 @@ TEST(KindOfTest, Integer) { EXPECT_EQ(kInteger, GMOCK_KIND_OF_(unsigned int)); // NOLINT EXPECT_EQ(kInteger, GMOCK_KIND_OF_(long)); // NOLINT EXPECT_EQ(kInteger, GMOCK_KIND_OF_(unsigned long)); // NOLINT + EXPECT_EQ(kInteger, GMOCK_KIND_OF_(long long)); // NOLINT + EXPECT_EQ(kInteger, GMOCK_KIND_OF_(unsigned long long)); // NOLINT EXPECT_EQ(kInteger, GMOCK_KIND_OF_(wchar_t)); // NOLINT - EXPECT_EQ(kInteger, GMOCK_KIND_OF_(Int64)); // NOLINT - EXPECT_EQ(kInteger, GMOCK_KIND_OF_(UInt64)); // NOLINT EXPECT_EQ(kInteger, GMOCK_KIND_OF_(size_t)); // NOLINT #if GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_CYGWIN // ssize_t is not defined on Windows and possibly some other OSes. @@ -222,11 +223,12 @@ TEST(LosslessArithmeticConvertibleTest, IntegerToInteger) { EXPECT_TRUE((LosslessArithmeticConvertible<unsigned char, int>::value)); // Unsigned => larger unsigned is fine. - EXPECT_TRUE( - (LosslessArithmeticConvertible<unsigned short, UInt64>::value)); // NOLINT + EXPECT_TRUE((LosslessArithmeticConvertible< + unsigned short, uint64_t>::value)); // NOLINT // Signed => unsigned is not fine. - EXPECT_FALSE((LosslessArithmeticConvertible<short, UInt64>::value)); // NOLINT + EXPECT_FALSE((LosslessArithmeticConvertible< + short, uint64_t>::value)); // NOLINT EXPECT_FALSE((LosslessArithmeticConvertible< signed char, unsigned int>::value)); // NOLINT @@ -242,12 +244,12 @@ TEST(LosslessArithmeticConvertibleTest, IntegerToInteger) { EXPECT_FALSE((LosslessArithmeticConvertible< unsigned char, signed char>::value)); EXPECT_FALSE((LosslessArithmeticConvertible<int, unsigned int>::value)); - EXPECT_FALSE((LosslessArithmeticConvertible<UInt64, Int64>::value)); + EXPECT_FALSE((LosslessArithmeticConvertible<uint64_t, int64_t>::value)); // Larger size => smaller size is not fine. EXPECT_FALSE((LosslessArithmeticConvertible<long, char>::value)); // NOLINT EXPECT_FALSE((LosslessArithmeticConvertible<int, signed char>::value)); - EXPECT_FALSE((LosslessArithmeticConvertible<Int64, unsigned int>::value)); + EXPECT_FALSE((LosslessArithmeticConvertible<int64_t, unsigned int>::value)); } TEST(LosslessArithmeticConvertibleTest, IntegerToFloatingPoint) { @@ -266,7 +268,7 @@ TEST(LosslessArithmeticConvertibleTest, FloatingPointToBool) { TEST(LosslessArithmeticConvertibleTest, FloatingPointToInteger) { EXPECT_FALSE((LosslessArithmeticConvertible<float, long>::value)); // NOLINT - EXPECT_FALSE((LosslessArithmeticConvertible<double, Int64>::value)); + EXPECT_FALSE((LosslessArithmeticConvertible<double, int64_t>::value)); EXPECT_FALSE((LosslessArithmeticConvertible<long double, int>::value)); } diff --git a/googlemock/test/gmock-matchers_test.cc b/googlemock/test/gmock-matchers_test.cc index bc49cb6..c2c3abd 100644 --- a/googlemock/test/gmock-matchers_test.cc +++ b/googlemock/test/gmock-matchers_test.cc @@ -46,6 +46,7 @@ #include <time.h> #include <array> +#include <cstdint> #include <deque> #include <forward_list> #include <functional> @@ -6028,9 +6029,9 @@ TEST_P(BipartiteRandomTest, LargerNets) { int iters = GetParam().second; MatchMatrix graph(static_cast<size_t>(nodes), static_cast<size_t>(nodes)); - auto seed = static_cast<testing::internal::UInt32>(GTEST_FLAG(random_seed)); + auto seed = static_cast<uint32_t>(GTEST_FLAG(random_seed)); if (seed == 0) { - seed = static_cast<testing::internal::UInt32>(time(nullptr)); + seed = static_cast<uint32_t>(time(nullptr)); } for (; iters > 0; --iters, ++seed) { |