X-Git-Url: https://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-printf-posix.h;h=1b2da4722962b7f7d4b27858243c61922925fe61;hb=8e74296348d2d5197a301ebf8c8b1e4342088ad3;hp=cd79a93c39cedda851f05d6985076b6b8f577ff3;hpb=6136fd62a3342532f17ccfd5f24db97764978448;p=gnulib.git diff --git a/tests/test-printf-posix.h b/tests/test-printf-posix.h index cd79a93c3..1b2da4722 100644 --- a/tests/test-printf-posix.h +++ b/tests/test-printf-posix.h @@ -62,11 +62,119 @@ test_function (int (*my_printf) (const char *, ...)) my_printf ("%a %d\n", NaN (), 33, 44, 55); /* FLAG_ZERO with infinite number. */ + /* "0000000inf 33" is not a valid result; see + */ my_printf ("%010a %d\n", 1.0 / 0.0, 33, 44, 55); /* FLAG_ZERO with NaN. */ + /* "0000000nan 33" is not a valid result; see + */ my_printf ("%010a %d\n", NaN (), 33, 44, 55); + /* Test the support of the %f format directive. */ + + /* A positive number. */ + my_printf ("%f %d\n", 12.75, 33, 44, 55); + + /* A larger positive number. */ + my_printf ("%f %d\n", 1234567.0, 33, 44, 55); + + /* A negative number. */ + my_printf ("%f %d\n", -0.03125, 33, 44, 55); + + /* Positive zero. */ + my_printf ("%f %d\n", 0.0, 33, 44, 55); + + /* Negative zero. */ + my_printf ("%f %d\n", -0.0, 33, 44, 55); + + /* NaN. */ + my_printf ("%f %d\n", NaN (), 33, 44, 55); + + /* FLAG_ZERO. */ + my_printf ("%015f %d\n", 1234.0, 33, 44, 55); + + /* Precision. */ + my_printf ("%.f %d\n", 1234.0, 33, 44, 55); + + /* A positive number. */ + my_printf ("%Lf %d\n", 12.75L, 33, 44, 55); + + /* A larger positive number. */ + my_printf ("%Lf %d\n", 1234567.0L, 33, 44, 55); + + /* A negative number. */ + my_printf ("%Lf %d\n", -0.03125L, 33, 44, 55); + + /* Positive zero. */ + my_printf ("%Lf %d\n", 0.0L, 33, 44, 55); + + /* Negative zero. */ + my_printf ("%Lf %d\n", -0.0L, 33, 44, 55); + + { /* NaN. */ + static long double zero = 0.0L; + my_printf ("%Lf %d\n", zero / zero, 33, 44, 55); + } + + /* FLAG_ZERO. */ + my_printf ("%015Lf %d\n", 1234.0L, 33, 44, 55); + + /* Precision. */ + my_printf ("%.Lf %d\n", 1234.0L, 33, 44, 55); + + /* Test the support of the %F format directive. */ + + /* A positive number. */ + my_printf ("%F %d\n", 12.75, 33, 44, 55); + + /* A larger positive number. */ + my_printf ("%F %d\n", 1234567.0, 33, 44, 55); + + /* A negative number. */ + my_printf ("%F %d\n", -0.03125, 33, 44, 55); + + /* Positive zero. */ + my_printf ("%F %d\n", 0.0, 33, 44, 55); + + /* Negative zero. */ + my_printf ("%F %d\n", -0.0, 33, 44, 55); + + /* NaN. */ + my_printf ("%F %d\n", NaN (), 33, 44, 55); + + /* FLAG_ZERO. */ + my_printf ("%015F %d\n", 1234.0, 33, 44, 55); + + /* Precision. */ + my_printf ("%.F %d\n", 1234.0, 33, 44, 55); + + /* A positive number. */ + my_printf ("%LF %d\n", 12.75L, 33, 44, 55); + + /* A larger positive number. */ + my_printf ("%LF %d\n", 1234567.0L, 33, 44, 55); + + /* A negative number. */ + my_printf ("%LF %d\n", -0.03125L, 33, 44, 55); + + /* Positive zero. */ + my_printf ("%LF %d\n", 0.0L, 33, 44, 55); + + /* Negative zero. */ + my_printf ("%LF %d\n", -0.0L, 33, 44, 55); + + { /* NaN. */ + static long double zero = 0.0L; + my_printf ("%LF %d\n", zero / zero, 33, 44, 55); + } + + /* FLAG_ZERO. */ + my_printf ("%015LF %d\n", 1234.0L, 33, 44, 55); + + /* Precision. */ + my_printf ("%.LF %d\n", 1234.0L, 33, 44, 55); + /* Test the support of the POSIX/XSI format strings with positions. */ my_printf ("%2$d %1$d\n", 33, 55);