aboutsummaryrefslogtreecommitdiff
path: root/stdio-common/tstdiomisc.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-08-23 06:35:22 +0000
committerUlrich Drepper <drepper@redhat.com>2000-08-23 06:35:22 +0000
commit6c46718f9f0dc0756860988c36eacdefe1cd27a6 (patch)
treef75fc09a31a8e1d3c26f0796a48bf771e9f43d49 /stdio-common/tstdiomisc.c
parentcf970a32156e60e8842c5e9e82a3cb147dacaf64 (diff)
downloadglibc-6c46718f9f0dc0756860988c36eacdefe1cd27a6.zip
glibc-6c46718f9f0dc0756860988c36eacdefe1cd27a6.tar.gz
glibc-6c46718f9f0dc0756860988c36eacdefe1cd27a6.tar.bz2
Update.
* stdio-common/vfprintf.c: Handle %F format. * stdio-common/printf-parse.h (parse_one_spec): Likewise. Reported by Joseph S. Myers <jsm28@cam.ac.uk>. * stdio-common/tstdiomisc.c: Add test for %F printf format. * po/zh.po: New file.
Diffstat (limited to 'stdio-common/tstdiomisc.c')
-rw-r--r--stdio-common/tstdiomisc.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/stdio-common/tstdiomisc.c b/stdio-common/tstdiomisc.c
index 1affac5..55d77b0 100644
--- a/stdio-common/tstdiomisc.c
+++ b/stdio-common/tstdiomisc.c
@@ -1,4 +1,8 @@
+#include <float.h>
+#include <math.h>
#include <stdio.h>
+#include <string.h>
+#include <wchar.h>
int
t1 (void)
@@ -43,12 +47,43 @@ t2 (void)
}
int
+F (void)
+{
+ char buf[20];
+ wchar_t wbuf[10];
+ int result;
+
+ snprintf (buf, sizeof buf, "%f %F", DBL_MAX * DBL_MAX - DBL_MAX * DBL_MAX,
+ DBL_MAX * DBL_MAX - DBL_MAX * DBL_MAX);
+ result = strcmp (buf, "nan NAN") != 0;
+ printf ("expected \"nan NAN\", got \"%s\"\n", buf);
+
+ snprintf (buf, sizeof buf, "%f %F", DBL_MAX * DBL_MAX, DBL_MAX * DBL_MAX);
+ result |= strcmp (buf, "inf INF") != 0;
+ printf ("expected \"inf INF\", got \"%s\"\n", buf);
+
+ swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%f %F",
+ DBL_MAX * DBL_MAX - DBL_MAX * DBL_MAX,
+ DBL_MAX * DBL_MAX - DBL_MAX * DBL_MAX);
+ result |= wcscmp (wbuf, L"nan NAN") != 0;
+ printf ("expected L\"nan NAN\", got L\"%S\"\n", wbuf);
+
+ swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%f %F",
+ DBL_MAX * DBL_MAX, DBL_MAX * DBL_MAX);
+ result |= wcscmp (wbuf, L"inf INF") != 0;
+ printf ("expected L\"inf INF\", got L\"%S\"\n", wbuf);
+
+ return result;
+}
+
+int
main (int argc, char *argv[])
{
int result = 0;
result |= t1 ();
result |= t2 ();
+ result |= F ();
result |= fflush (stdout) == EOF;