(root)/
glibc-2.38/
stdio-common/
bug17.c
       1  #include <stdio.h>
       2  #include <string.h>
       3  
       4  static int
       5  do_test (void)
       6  {
       7    static const char expect[] = "0, 0, 0";
       8    char buf[100];
       9    int status = 0;
      10  
      11    static const char fmt1[] = "%0d, %0ld, %0lld";
      12    snprintf (buf, sizeof (buf), fmt1, 0, 0L, 0LL);
      13    if (strcmp (buf, expect) != 0)
      14      {
      15        printf ("\"%s\": got \"%s\", expected \"%s\"\n", fmt1, buf, expect);
      16        status = 1;
      17      }
      18  
      19    static const char fmt2[] = "%0u, %0lu, %0llu";
      20    snprintf (buf, sizeof (buf), fmt2, 0u, 0uL, 0uLL);
      21    if (strcmp (buf, expect) != 0)
      22      {
      23        printf ("\"%s\": got \"%s\", expected \"%s\"\n", fmt2, buf, expect);
      24        status = 1;
      25      }
      26  
      27    return status;
      28  }
      29  
      30  #define TEST_FUNCTION do_test ()
      31  #include "../test-skeleton.c"