Define __have_atfcts global in stub openat implementation.
[glibc.git] / stdio-common / tst-grouping.c
blobe8f4b8c4dbfd854a5b1761ff7c0288657ffa94c4
1 /* BZ 12394, test by Bruno Haible. */
2 #include <locale.h>
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <string.h>
8 static int
9 do_test (void)
11 char buf1[1000];
12 char buf2[1000];
13 int result = 0;
15 if (setlocale (LC_NUMERIC, "de_DE.UTF-8") == NULL)
16 return 1;
18 sprintf (buf1, "%'.2f", 999.996);
19 sprintf (buf2, "%'.2f", 1000.004);
20 printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2);
21 if (strcmp (buf1, buf2) != 0)
22 result |= 2;
24 sprintf (buf1, "%'.2f", 999999.996);
25 sprintf (buf2, "%'.2f", 1000000.004);
26 printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2);
27 if (strcmp (buf1, buf2) != 0)
28 result |= 2;
30 sprintf (buf1, "%'.2f", 999999999.996);
31 sprintf (buf2, "%'.2f", 1000000000.004);
32 printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2);
33 if (strcmp (buf1, buf2) != 0)
34 result |= 2;
36 sprintf (buf1, "%'.2f", 999999999999.996);
37 sprintf (buf2, "%'.2f", 1000000000000.004);
38 printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2);
39 if (strcmp (buf1, buf2) != 0)
40 result |= 2;
42 sprintf (buf1, "%'.2f", 999999999999999.996);
43 sprintf (buf2, "%'.2f", 1000000000000000.004);
44 printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2);
45 if (strcmp (buf1, buf2) != 0)
46 result |= 2;
48 sprintf (buf1, "%'.5g", 999.996);
49 sprintf (buf2, "%'.5g", 1000.004);
50 printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2);
51 if (strcmp (buf1, buf2) != 0)
52 result |= 4;
54 sprintf (buf1, "%'.4g", 9999.996);
55 sprintf (buf2, "%'.4g", 10000.004);
56 printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2);
57 if (strcmp (buf1, buf2) != 0)
58 result |= 8;
60 sprintf (buf1, "%'.5g", 99999.996);
61 sprintf (buf2, "%'.5g", 100000.004);
62 printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2);
63 if (strcmp (buf1, buf2) != 0)
64 result |= 8;
66 sprintf (buf1, "%'.6g", 999999.996);
67 sprintf (buf2, "%'.6g", 1000000.004);
68 printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2);
69 if (strcmp (buf1, buf2) != 0)
70 result |= 8;
72 sprintf (buf1, "%'.7g", 9999999.996);
73 sprintf (buf2, "%'.7g", 10000000.004);
74 printf ("%d: \"%s\" vs \"%s\"\n", __LINE__, buf1, buf2);
75 if (strcmp (buf1, buf2) != 0)
76 result |= 8;
78 return result;
82 #define TEST_FUNCTION do_test ()
83 #include "../test-skeleton.c"