Use x86_64 bits/sigcontext.h for i386 and x86_64
[glibc.git] / stdio-common / tllformat.c
blobb53b8258361bda67061e6c82a425597bcb05183b
1 #include <stdio.h>
2 #include <string.h>
4 /* The original file was tiformat.c and it has been changed for long long tests\
5 . */
6 typedef struct
8 int line;
9 long long int value;
10 const char *result;
11 const char *format_string;
12 } sprint_int_type;
14 sprint_int_type sprint_ints[] =
16 {__LINE__, 0x00000000ULL, "0", "%llx"},
17 {__LINE__, 0xffff00000000208bULL, "ffff00000000208b", "%llx"},
18 {__LINE__, 0xffff00000000208bULL, "18446462598732849291", "%llu"},
19 {__LINE__, 18446462598732849291ULL, "ffff00000000208b", "%llx"},
20 {__LINE__, 18446462598732849291ULL, "18446462598732849291", "%llu"},
21 {__LINE__, 18359476226655002763ULL, "fec9f65b0000208b", "%llx"},
22 {__LINE__, 18359476226655002763ULL, "18359476226655002763", "%llu"},
24 {0},
27 int
28 main (void)
30 int errcount = 0;
31 int testcount = 0;
32 #define BSIZE 1024
33 char buffer[BSIZE];
34 sprint_int_type *iptr;
35 for (iptr = sprint_ints; iptr->line; iptr++)
37 sprintf (buffer, iptr->format_string, iptr->value);
38 if (strcmp (buffer, iptr->result) != 0)
40 ++errcount;
41 printf ("\
42 Error in line %d using \"%s\". Result is \"%s\"; should be: \"%s\".\n",
43 iptr->line, iptr->format_string, buffer, iptr->result);
45 ++testcount;
48 if (errcount == 0)
50 printf ("Encountered no errors in %d tests.\n", testcount);
51 return 0;
53 else
55 printf ("Encountered %d errors in %d tests.\n",
56 errcount, testcount);
57 return 1;