From 6d71f74624be5daa548073ff8e4e0c8aa5476010 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 20 Sep 2026 17:30:26 -0700 Subject: [PATCH] Remove redundant printf tests %.0i and %.0u take the same path as %.0d because 'i' and 'u' are normalized to 'd', the uppercase variants only set the upper flag which is unobservable when there are no digits, and %-5.0d cannot be distinguished from %5.0d because the output is empty. --- test/printf-test.cc | 8 -------- 1 file changed, 8 deletions(-) diff --git a/test/printf-test.cc b/test/printf-test.cc index 01a9f632..f8322522 100644 --- a/test/printf-test.cc +++ b/test/printf-test.cc @@ -283,33 +283,25 @@ TEST(printf_test, int_precision) { TEST(printf_test, zero_int_with_zero_precision) { EXPECT_PRINTF("", "%.0d", 0); EXPECT_PRINTF("", "%.d", 0); - EXPECT_PRINTF("", "%.0i", 0); EXPECT_PRINTF("", "%.0o", 0); - EXPECT_PRINTF("", "%.0u", 0); EXPECT_PRINTF("", "%.0x", 0); - EXPECT_PRINTF("", "%.0X", 0); // '#' forces a single '0' for octal, but has no effect on other conversions. EXPECT_PRINTF("0", "%#.0o", 0); EXPECT_PRINTF("0", "%#.0hho", 256); EXPECT_PRINTF("", "%#.0x", 0); - EXPECT_PRINTF("", "%#.0X", 0); // The sign, space and width still apply. EXPECT_PRINTF("+", "%+.0d", 0); EXPECT_PRINTF(" ", "% .0d", 0); EXPECT_PRINTF(" ", "%5.0d", 0); - EXPECT_PRINTF(" ", "%-5.0d", 0); EXPECT_PRINTF(" ", "%05.0d", 0); EXPECT_PRINTF(" 0", "%#5.0o", 0); EXPECT_PRINTF("0 ", "%#-5.0o", 0); // A nonzero value or a nonzero precision is unaffected. - EXPECT_PRINTF("42", "%.0d", 42); EXPECT_PRINTF("-42", "%.0d", -42); - EXPECT_PRINTF("ff", "%.0x", 255); EXPECT_PRINTF("0", "%.1d", 0); - EXPECT_PRINTF("00", "%.2d", 0); } TEST(printf_test, float_precision) {