This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Test case for printf's 'I' flag
- From: Hamed Malek <hamed at bamdad dot org>
- To: libc-alpha <libc-alpha at sources dot redhat dot com>
- Cc: Behdad Esfahbod <behdad at cs dot toronto dot edu>
- Date: Tue, 17 Feb 2004 19:38:04 +0330
- Subject: Test case for printf's 'I' flag
Hi,
Attached is a test case which tests integer and float numbers for 'I'
flag.
I set the locale to "fa_IR" which is providing the proper information.
PS: some elements like exponent sign ('e') in Persian are string
("*10^"). So, we can't add them to our map. Are you still disagree with
defining new keywords in LC_CTYPE or LC_NUMERIC for them?
Hamed
--- tst-printf.c 2004-02-17 18:01:40.000000000 +0330
+++ tst-printf.c.orig 2004-02-09 18:56:59.000000000 +0330
@@ -28,12 +28,10 @@
#endif
#include <float.h>
-#include <locale.h>
static void rfg1 (void);
static void rfg2 (void);
static void rfg3 (void);
-static void rfg4 (void);
static void
@@ -280,7 +278,6 @@
rfg1 ();
rfg2 ();
rfg3 ();
- rfg4 ();
{
char bytes[7];
@@ -384,28 +381,3 @@
printf ("got: '%s', expected: '%s'\n", buf,
" 12345 1234 11145401322 321.765432 3.217654e+02 5 test-string");
}
-
-static void
-rfg4 (void)
-{
- char buf[100];
- char persian_int[100];
- char persian_float[100];
- int i = 123;
- float f = 1234.56;
-
- setlocale (LC_ALL, "fa_IR.UTF-8");
-
- sprintf(persian_int, "%lc%lc%lc", 0x06f1, 0x06f2, 0x06f3);
- sprintf(persian_float, "%lc%lc%lc%lc%lc%lc%lc%lc", 0x06f1, 0x066c, 0x06f2, 0x06f3, 0x06f4, 0x066b, 0x06f5, 0x06f6);
-
- sprintf(buf, "%Id", i);
- if (strcmp (buf, persian_int) != 0)
- printf ("got: '%s', expected: '%s'\n", buf, persian_int);
-
- sprintf(buf, "%I'.2f", f);
- if (strcmp (buf, persian_float) != 0)
- printf ("got: '%s', expected: '%s'\n", buf, persian_float);
-
- setlocale (LC_ALL, "");
-}