From 8c930dfb0fdc9b531474101772dda8e81a5cb3e2 Mon Sep 17 00:00:00 2001 From: Marcin Hajder Date: Fri, 19 Jul 2024 10:22:40 +0200 Subject: [PATCH 1/2] Added missing formating cases --- test_conformance/printf/util_printf.cpp | 32 +++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/test_conformance/printf/util_printf.cpp b/test_conformance/printf/util_printf.cpp index 6e44b43fd..9372e5b2f 100644 --- a/test_conformance/printf/util_printf.cpp +++ b/test_conformance/printf/util_printf.cpp @@ -80,8 +80,12 @@ std::vector printIntGenParameters = { //(Minimum)Six-wide,Five-digit(zero-filled in absent // digits),default(right)-justified - { { "%06.5i" }, "100" } + { { "%06.5i" }, "100" }, + //(Minimum)Ten-wide ,left-justified, with a blank spaces inserted before the + // value + + { { "% 10d" }, "42" }, }; //----------------------------------------------- @@ -165,6 +169,16 @@ std::vector printHalfGenParameters = { // exponent,left-justified,with sign,capital E,default(right)-justified { { "%+#21.15E" }, "-65504.0h" }, + + //(Minimum)Ten-wide,two positions after the decimal,with + // a blank spaces inserted before the value, default(right)-justified + + { { "% 10.2f" }, "1.2345h" }, + + //(Minimum)Eight-wide,two positions after the decimal, with + // a zeros inserted before the value, default(right)-justified + + { { "%08.2f" }, "3.1415h" }, }; //--------------------------------------------------------- @@ -362,6 +376,16 @@ std::vector printFloatGenParameters = { // xh.hhhhpAd style,default(right)-justified { { "%10.2a" }, "9990.235" }, + + //(Minimum)Ten-wide,two positions after the decimal,with + // a blank spaces inserted before the value, default(right)-justified + + { { "% 10.2f" }, "1.2345" }, + + //(Minimum)Eight-wide,two positions after the decimal,with + // a zeros inserted before the value, default(right)-justified + + { { "%08.2f" }, "3.1415" }, }; //--------------------------------------------------------- @@ -490,8 +514,12 @@ std::vector printOctalGenParameters = { //(Minimum)Four-wide,Five-digit,0-flag ignored(because of // precision),default(right)-justified - { { "%04.5o" }, "10" } + { { "%04.5o" }, "10" }, + + //(Minimum)Ten-wide, a zeros inserted before the value, + // default(right)-justified + { { "%010o" }, "10" } }; //------------------------------------------------------- From ea85d1fc7d6a9ea4970090fa9202a73d4c59aaba Mon Sep 17 00:00:00 2001 From: Marcin Hajder Date: Fri, 19 Jul 2024 20:45:25 +0200 Subject: [PATCH 2/2] Corrections due to code review --- test_conformance/printf/util_printf.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test_conformance/printf/util_printf.cpp b/test_conformance/printf/util_printf.cpp index 9372e5b2f..541faba90 100644 --- a/test_conformance/printf/util_printf.cpp +++ b/test_conformance/printf/util_printf.cpp @@ -82,7 +82,7 @@ std::vector printIntGenParameters = { { { "%06.5i" }, "100" }, - //(Minimum)Ten-wide ,left-justified, with a blank spaces inserted before the + //(Minimum)Ten-wide, left-justified, with a blank space inserted before the // value { { "% 10d" }, "42" }, @@ -171,14 +171,14 @@ std::vector printHalfGenParameters = { { { "%+#21.15E" }, "-65504.0h" }, //(Minimum)Ten-wide,two positions after the decimal,with - // a blank spaces inserted before the value, default(right)-justified + // a blank space inserted before the value, default(right)-justified - { { "% 10.2f" }, "1.2345h" }, + { { "% 10.2f" }, "1.25h" }, //(Minimum)Eight-wide,two positions after the decimal, with - // a zeros inserted before the value, default(right)-justified + // zeros inserted before the value, default(right)-justified - { { "%08.2f" }, "3.1415h" }, + { { "%08.2f" }, "3.14h" }, }; //--------------------------------------------------------- @@ -378,14 +378,14 @@ std::vector printFloatGenParameters = { { { "%10.2a" }, "9990.235" }, //(Minimum)Ten-wide,two positions after the decimal,with - // a blank spaces inserted before the value, default(right)-justified + // a blank space inserted before the value, default(right)-justified - { { "% 10.2f" }, "1.2345" }, + { { "% 10.2f" }, "1.25" }, //(Minimum)Eight-wide,two positions after the decimal,with - // a zeros inserted before the value, default(right)-justified + // zeros inserted before the value, default(right)-justified - { { "%08.2f" }, "3.1415" }, + { { "%08.2f" }, "3.14" }, }; //--------------------------------------------------------- @@ -516,7 +516,7 @@ std::vector printOctalGenParameters = { { { "%04.5o" }, "10" }, - //(Minimum)Ten-wide, a zeros inserted before the value, + //(Minimum)Ten-wide, zeros inserted before the value, // default(right)-justified { { "%010o" }, "10" }