mirror of
https://github.com/fmtlib/fmt.git
synced 2026-10-29 02:17:28 +08:00
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.
This commit is contained in:
parent
1d361e2f8c
commit
6d71f74624
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user