diff options
author | vslashg <gfalcon@google.com> | 2019-11-01 20:02:16 (GMT) |
---|---|---|
committer | vslashg <gfalcon@google.com> | 2019-11-01 20:02:16 (GMT) |
commit | e8a82dc7ede61c4af3b9d75aa0e953b8cecfc8bb (patch) | |
tree | 2c85a4c08b20e6ce31a4c5e1f8814d9b837a94bd /googletest/test/googletest-printers-test.cc | |
parent | 057ee5063d00a67fd0a83029e8cf26ea9bc1bb69 (diff) | |
parent | 6e87238c9b14bcd749364e9b7125622a985a8a20 (diff) | |
download | googletest-e8a82dc7ede61c4af3b9d75aa0e953b8cecfc8bb.zip googletest-e8a82dc7ede61c4af3b9d75aa0e953b8cecfc8bb.tar.gz googletest-e8a82dc7ede61c4af3b9d75aa0e953b8cecfc8bb.tar.bz2 |
Merge pull request #2453 from kuzkry:gtest-port-clean-up_kMaxBiggestInt
PiperOrigin-RevId: 277979766
Diffstat (limited to 'googletest/test/googletest-printers-test.cc')
-rw-r--r-- | googletest/test/googletest-printers-test.cc | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/googletest/test/googletest-printers-test.cc b/googletest/test/googletest-printers-test.cc index 58be7d1..cebd6ac 100644 --- a/googletest/test/googletest-printers-test.cc +++ b/googletest/test/googletest-printers-test.cc @@ -83,10 +83,12 @@ void PrintTo(EnumWithPrintTo e, std::ostream* os) { *os << (e == kEWPT1 ? "kEWPT1" : "invalid"); } -// A class implicitly convertible to BiggestInt. -class BiggestIntConvertible { +// A class implicitly convertible to std::intmax_t. +class IntMaxConvertible { public: - operator ::testing::internal::BiggestInt() const { return 42; } + constexpr operator std::intmax_t() const { // NOLINT(runtime/explicit) + return 42; + } }; // A user-defined unprintable class template in the global namespace. @@ -267,10 +269,10 @@ TEST(PrintEnumTest, EnumWithPrintTo) { EXPECT_EQ("invalid", Print(static_cast<EnumWithPrintTo>(0))); } -// Tests printing a class implicitly convertible to BiggestInt. +// Tests printing a class implicitly convertible to std::intmax_t. -TEST(PrintClassTest, BiggestIntConvertible) { - EXPECT_EQ("42", Print(BiggestIntConvertible())); +TEST(PrintClassTest, IntMaxConvertible) { + EXPECT_EQ("42", Print(IntMaxConvertible())); } // Tests printing various char types. @@ -525,10 +527,9 @@ TEST(PrintPointerTest, NonMemberFunctionPointer) { // standard disallows casting between pointers to functions and // pointers to objects, and some compilers (e.g. GCC 3.4) enforce // this limitation. - EXPECT_EQ( - PrintPointer(reinterpret_cast<const void*>( - reinterpret_cast<internal::BiggestInt>(&MyFunction))), - Print(&MyFunction)); + EXPECT_EQ(PrintPointer(reinterpret_cast<const void*>( + reinterpret_cast<std::intptr_t>(&MyFunction))), + Print(&MyFunction)); int (*p)(bool) = NULL; // NOLINT EXPECT_EQ("NULL", Print(p)); } @@ -1120,8 +1121,8 @@ TEST(PrintReferenceTest, HandlesFunctionPointer) { // standard disallows casting between pointers to functions and // pointers to objects, and some compilers (e.g. GCC 3.4) enforce // this limitation. - const std::string fp_string = PrintPointer(reinterpret_cast<const void*>( - reinterpret_cast<internal::BiggestInt>(fp))); + const std::string fp_string = PrintPointer( + reinterpret_cast<const void*>(reinterpret_cast<std::intptr_t>(fp))); EXPECT_EQ("@" + fp_pointer_string + " " + fp_string, PrintByRef(fp)); } |