blob: 9e0cfe6860d092d0a2d816d8cb0c3b3fb2af10e2 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#include <stdio.h>
2#include <string.h>
3#include <stdlib.h>
4
5static const char expected[] = "\
6\n\
7a\n\
8abbcd55\
9\n\
10a\n\
11abbcd55\
12\n\
13a\n\
14abbcd55\
15\n\
16a\n\
17abbcd55\
18\n\
19a\n\
20abbcd55\
21\n\
22a\n\
23abbcd55\
24\n\
25a\n\
26abbcd55\
27\n\
28a\n\
29abbcd55\
30\n\
31a\n\
32abbcd55\
33\n\
34a\n\
35abbcd55\
36\n\
37a\n\
38abbcd55\
39\n\
40a\n\
41abbcd55\
42\n\
43a\n\
44abbcd55%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
45
46static int
47do_test (void)
48{
49 char *buf = malloc (strlen (expected) + 1);
50 snprintf (buf, strlen (expected) + 1,
51 "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
52 "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
53 "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
54 "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
55 "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
56 "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
57 "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
58 "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
59 "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
60 "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
61 "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
62 "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
63 "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
64 "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
65 "a", "b", "c", "d", 5);
66 return strcmp (buf, expected) != 0;
67}
68
69#define TEST_FUNCTION do_test ()
70#include "../test-skeleton.c"