Commit 9c136a47 authored by Daniel Lehman's avatar Daniel Lehman Committed by Alexandre Julliard

ucrtbase/tests: Add sprintf tests.

parent 53faf7bd
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment