aboutsummaryrefslogtreecommitdiff
path: root/stdio-common/bug25.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>2012-05-24 21:30:43 -0600
committerJeff Law <law@redhat.com>2012-05-24 21:30:43 -0600
commitb0bc23a1777005ddcd54ec434f0deec88d3468fc (patch)
tree6647d22a52f1dce71c16657587face539d16fba5 /stdio-common/bug25.c
parent347c92e9e78c39d8494c8497f420a7fa30c89565 (diff)
downloadglibc-b0bc23a1777005ddcd54ec434f0deec88d3468fc.zip
glibc-b0bc23a1777005ddcd54ec434f0deec88d3468fc.tar.gz
glibc-b0bc23a1777005ddcd54ec434f0deec88d3468fc.tar.bz2
2012-05-24 Jeff Law <law@redhat.com>
* stdio-common/Makefile (tests): Add bug25. * stdio-common/bug25.c: New test.
Diffstat (limited to 'stdio-common/bug25.c')
-rw-r--r--stdio-common/bug25.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/stdio-common/bug25.c b/stdio-common/bug25.c
new file mode 100644
index 0000000..30c13397
--- /dev/null
+++ b/stdio-common/bug25.c
@@ -0,0 +1,70 @@
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+static const char expected[] = "\
+\n\
+a\n\
+abbcd55\
+\n\
+a\n\
+abbcd55\
+\n\
+a\n\
+abbcd55\
+\n\
+a\n\
+abbcd55\
+\n\
+a\n\
+abbcd55\
+\n\
+a\n\
+abbcd55\
+\n\
+a\n\
+abbcd55\
+\n\
+a\n\
+abbcd55\
+\n\
+a\n\
+abbcd55\
+\n\
+a\n\
+abbcd55\
+\n\
+a\n\
+abbcd55\
+\n\
+a\n\
+abbcd55\
+\n\
+a\n\
+abbcd55%%%%%%%%%%%%%%%%%%%%%%%%%%\n";
+
+static int
+do_test (void)
+{
+ char *buf = malloc (strlen (expected) + 1);
+ snprintf (buf, strlen (expected) + 1,
+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
+ "\n%1$s\n" "%1$s" "%2$s" "%2$s" "%3$s" "%4$s" "%5$d" "%5$d"
+ "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n",
+ "a", "b", "c", "d", 5);
+ return strcmp (buf, expected) != 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"