Back to index

glibc  2.9
bug17.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <string.h>
00003 
00004 static int
00005 do_test (void)
00006 {
00007   static const char expect[] = "0, 0, 0";
00008   char buf[100];
00009   int status = 0;
00010 
00011   static const char fmt1[] = "%0d, %0ld, %0lld";
00012   snprintf (buf, sizeof (buf), fmt1, 0, 0L, 0LL);
00013   if (strcmp (buf, expect) != 0)
00014     {
00015       printf ("\"%s\": got \"%s\", expected \"%s\"\n", fmt1, buf, expect);
00016       status = 1;
00017     }
00018 
00019   static const char fmt2[] = "%0u, %0lu, %0llu";
00020   snprintf (buf, sizeof (buf), fmt2, 0u, 0uL, 0uLL);
00021   if (strcmp (buf, expect) != 0)
00022     {
00023       printf ("\"%s\": got \"%s\", expected \"%s\"\n", fmt2, buf, expect);
00024       status = 1;
00025     }
00026 
00027   return status;
00028 }
00029 
00030 #define TEST_FUNCTION do_test ()
00031 #include "../test-skeleton.c"