Blame stdio-common/bug17.c
|
Packit Service |
82fcde |
#include <stdio.h>
|
|
Packit Service |
82fcde |
#include <string.h>
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
static int
|
|
Packit Service |
82fcde |
do_test (void)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
static const char expect[] = "0, 0, 0";
|
|
Packit Service |
82fcde |
char buf[100];
|
|
Packit Service |
82fcde |
int status = 0;
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
static const char fmt1[] = "%0d, %0ld, %0lld";
|
|
Packit Service |
82fcde |
snprintf (buf, sizeof (buf), fmt1, 0, 0L, 0LL);
|
|
Packit Service |
82fcde |
if (strcmp (buf, expect) != 0)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
printf ("\"%s\": got \"%s\", expected \"%s\"\n", fmt1, buf, expect);
|
|
Packit Service |
82fcde |
status = 1;
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
static const char fmt2[] = "%0u, %0lu, %0llu";
|
|
Packit Service |
82fcde |
snprintf (buf, sizeof (buf), fmt2, 0u, 0uL, 0uLL);
|
|
Packit Service |
82fcde |
if (strcmp (buf, expect) != 0)
|
|
Packit Service |
82fcde |
{
|
|
Packit Service |
82fcde |
printf ("\"%s\": got \"%s\", expected \"%s\"\n", fmt2, buf, expect);
|
|
Packit Service |
82fcde |
status = 1;
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
return status;
|
|
Packit Service |
82fcde |
}
|
|
Packit Service |
82fcde |
|
|
Packit Service |
82fcde |
#define TEST_FUNCTION do_test ()
|
|
Packit Service |
82fcde |
#include "../test-skeleton.c"
|