1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

ucrtbase/tests: Add sprintf tests.

This commit is contained in:
Daniel Lehman 2024-01-30 22:43:31 -08:00 committed by Alexandre Julliard
parent 53faf7bda8
commit 9c136a470c

View file

@ -815,11 +815,30 @@ static void test_printf_fp(void)
{ "%#.20g", -765, { "-765.00000000000000000" }},
{ "%.30f", 1.0/3.0, { "0.333333333333333314829616256247" }},
{ "%.30lf", sqrt(2), { "1.414213562373095145474621858739" }},
{ "%f", 3.141592653590000, { "3.141593" }},
{ "%.10f", 3.141592653590000, { "3.1415926536" }},
{ "%.11f", 3.141592653590000, { "3.14159265359" }},
{ "%.15f", 3.141592653590000, { "3.141592653590000" }},
{ "%.15f", M_PI, { "3.141592653589793" }},
{ "%.13f", 37.866261574537077, { "37.8662615745371" }},
{ "%.14f", 37.866261574537077, { "37.86626157453708" }},
{ "%.15f", 37.866261574537077, { "37.866261574537077" }},
{ "%.0g", 9.8949714229143402e-05, { "0.0001" }},
{ "%.0f", 0.5, { "1", NULL, NULL, NULL, "0" }, {NULL, NULL, NULL, NULL, "1" }},
{ "%.0f", 1.5, { "2" }},
{ "%.0f", 2.5, { "3", NULL, NULL, NULL, "2" }, {NULL, NULL, NULL, NULL, "3" }},
{ "%g", 9.999999999999999e-5, { "0.0001" }},
{ "%g", 0.0005, { "0.0005" }},
{ "%g", 0.00005, { "5e-05", NULL, "5e-005" }},
{ "%g", 0.000005, { "5e-06", NULL, "5e-006" }},
{ "%g", 999999999999999.0, { "1e+15", NULL, "1e+015" }},
{ "%g", 1000000000000000.0, { "1e+15", NULL, "1e+015" }},
{ "%.15g", 0.0005, { "0.0005" }},
{ "%.15g", 0.00005, { "5e-05", NULL, "5e-005" }},
{ "%.15g", 0.000005, { "5e-06", NULL, "5e-006" }},
{ "%.15g", 999999999999999.0, { "999999999999999" }},
{ "%.15g", 1000000000000000.0, { "1e+15", NULL, "1e+015" }},
};
const char *res = NULL;