From e5749afd07de3b66c02bb76176d145e11f6ced34 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 19 Jun 2017 11:29:56 -0700 Subject: Use EXPECT_STREQ() in fx_system_unittest.cpp. Instead of using EXPECT_EQ() and constructing a std::string. Change-Id: I7f349f49a03b1ebbad15865f9783568f4d025d91 Reviewed-on: https://pdfium-review.googlesource.com/6670 Commit-Queue: dsinclair Reviewed-by: dsinclair --- core/fxcrt/fx_system_unittest.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/core/fxcrt/fx_system_unittest.cpp b/core/fxcrt/fx_system_unittest.cpp index a83b275111..9182fdf7d9 100644 --- a/core/fxcrt/fx_system_unittest.cpp +++ b/core/fxcrt/fx_system_unittest.cpp @@ -3,7 +3,6 @@ // found in the LICENSE file. #include -#include #include "core/fxcrt/fx_system.h" #include "testing/fx_string_testhelpers.h" @@ -23,7 +22,7 @@ void Check32BitBase16Itoa(int32_t input, const char* expected_output) { char buf[kBufLen]; buf[kBufLen - 1] = kSentinel; FXSYS_itoa(input, buf, 16); - EXPECT_EQ(std::string(expected_output), buf); + EXPECT_STREQ(expected_output, buf); EXPECT_EQ(kSentinel, buf[kBufLen - 1]); } @@ -32,7 +31,7 @@ void Check32BitBase10Itoa(int32_t input, const char* expected_output) { char buf[kBufLen]; buf[kBufLen - 1] = kSentinel; FXSYS_itoa(input, buf, 10); - EXPECT_EQ(std::string(expected_output), buf); + EXPECT_STREQ(expected_output, buf); EXPECT_EQ(kSentinel, buf[kBufLen - 1]); } @@ -41,7 +40,7 @@ void Check32BitBase2Itoa(int32_t input, const char* expected_output) { char buf[kBufLen]; buf[kBufLen - 1] = kSentinel; FXSYS_itoa(input, buf, 2); - EXPECT_EQ(std::string(expected_output), buf); + EXPECT_STREQ(expected_output, buf); EXPECT_EQ(kSentinel, buf[kBufLen - 1]); } @@ -50,7 +49,7 @@ void Check64BitBase16Itoa(int64_t input, const char* expected_output) { char buf[kBufLen]; buf[kBufLen - 1] = kSentinel; FXSYS_i64toa(input, buf, 16); - EXPECT_EQ(std::string(expected_output), buf); + EXPECT_STREQ(expected_output, buf); EXPECT_EQ(kSentinel, buf[kBufLen - 1]); } @@ -59,7 +58,7 @@ void Check64BitBase10Itoa(int64_t input, const char* expected_output) { char buf[kBufLen]; buf[kBufLen - 1] = kSentinel; FXSYS_i64toa(input, buf, 10); - EXPECT_EQ(std::string(expected_output), buf); + EXPECT_STREQ(expected_output, buf); EXPECT_EQ(kSentinel, buf[kBufLen - 1]); } @@ -68,7 +67,7 @@ void Check64BitBase2Itoa(int64_t input, const char* expected_output) { char buf[kBufLen]; buf[kBufLen - 1] = kSentinel; FXSYS_i64toa(input, buf, 2); - EXPECT_EQ(std::string(expected_output), buf); + EXPECT_STREQ(expected_output, buf); EXPECT_EQ(kSentinel, buf[kBufLen - 1]); } @@ -78,16 +77,16 @@ TEST(fxcrt, FXSYS_itoa_InvalidRadix) { char buf[32]; FXSYS_itoa(42, buf, 17); // Ours stops at 16. - EXPECT_EQ(std::string(""), buf); + EXPECT_STREQ("", buf); FXSYS_itoa(42, buf, 1); - EXPECT_EQ(std::string(""), buf); + EXPECT_STREQ("", buf); FXSYS_itoa(42, buf, 0); - EXPECT_EQ(std::string(""), buf); + EXPECT_STREQ("", buf); FXSYS_itoa(42, buf, -1); - EXPECT_EQ(std::string(""), buf); + EXPECT_STREQ("", buf); } TEST(fxcrt, FXSYS_itoa) { @@ -118,16 +117,16 @@ TEST(fxcrt, FXSYS_i64toa_InvalidRadix) { char buf[32]; FXSYS_i64toa(42, buf, 17); // Ours stops at 16. - EXPECT_EQ(std::string(""), buf); + EXPECT_STREQ("", buf); FXSYS_i64toa(42, buf, 1); - EXPECT_EQ(std::string(""), buf); + EXPECT_STREQ("", buf); FXSYS_i64toa(42, buf, 0); - EXPECT_EQ(std::string(""), buf); + EXPECT_STREQ("", buf); FXSYS_i64toa(42, buf, -1); - EXPECT_EQ(std::string(""), buf); + EXPECT_STREQ("", buf); } TEST(fxcrt, FXSYS_i64toa) { -- cgit v1.2.3