From 6b65b5198d7bbdefdd94cfeb208853b90bdde485 Mon Sep 17 00:00:00 2001 From: rimathia Date: Thu, 12 Nov 2020 17:47:03 +0100 Subject: [PATCH] fix wrong order of expected and actual in truncated_printf_context test in PrintfDetermineOutputSize, make test of normal sprintf in a separate step --- test/printf-test.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/printf-test.cc b/test/printf-test.cc index ccd72dcd..34a0d734 100644 --- a/test/printf-test.cc +++ b/test/printf-test.cc @@ -617,12 +617,14 @@ TEST(PrintfTest, PrintfDetermineOutputSize) { const auto format_string = "%s"; const auto format_arg = "Hello"; - const auto expected_size = fmt::sprintf(format_string, format_arg).size(); + const auto expected_size = 5; - EXPECT_EQ((truncated_printf_context( + EXPECT_EQ(expected_size, fmt::sprintf(format_string, format_arg).size()); + + EXPECT_EQ(expected_size, + (truncated_printf_context( fmt::detail::truncating_iterator(it, 0), format_string, fmt::make_format_args(format_arg)) .format() - .count()), - expected_size); + .count())); }