diff --git a/format_test.cc b/format_test.cc index b57390f3..6f5b8e09 100644 --- a/format_test.cc +++ b/format_test.cc @@ -113,26 +113,20 @@ struct AnyWriteChecker { } }; -struct CharWriteChecker { +template +struct WriteChecker { template ::testing::AssertionResult operator()(const char *, const T &value) const { - return CheckWrite(value, "char"); - } -}; - -struct WCharWriteChecker { - template - ::testing::AssertionResult operator()(const char *, const T &value) const { - return CheckWrite(value, "char"); + return CheckWrite(value, "char"); } }; // Checks if writing value to BasicWriter produces the same result // as writing it to std::ostringstream both for char and wchar_t. -#define CHECK_WRITE(value) ASSERT_PRED_FORMAT1(AnyWriteChecker(), value) +#define CHECK_WRITE(value) EXPECT_PRED_FORMAT1(AnyWriteChecker(), value) -#define CHECK_WRITE_CHAR(value) ASSERT_PRED_FORMAT1(CharWriteChecker(), value) -#define CHECK_WRITE_WCHAR(value) ASSERT_PRED_FORMAT1(WCharWriteChecker(), value) +#define CHECK_WRITE_CHAR(value) EXPECT_PRED_FORMAT1(WriteChecker(), value) +#define CHECK_WRITE_WCHAR(value) EXPECT_PRED_FORMAT1(WriteChecker(), value) // Increment a number in a string. void Increment(char *s) { @@ -167,7 +161,6 @@ TEST(UtilTest, Increment) { EXPECT_STREQ("129", s); Increment(s); EXPECT_STREQ("130", s); - EXPECT_STREQ("130", s); s[1] = s[2] = '9'; Increment(s); EXPECT_STREQ("200", s);