strtoul test fix, infrastructure changes
[libc-test] / src / stdio / fscanf.c
index 1de09c3..d5da238 100644 (file)
@@ -1,3 +1,4 @@
+#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
@@ -18,6 +19,18 @@ static void S(const char *s, const char *x, const char *m) {
                error("got [%s], expected [%s] (%s)\n", s, x, m);
 }
 
+void test_scanf_long(void) {
+       enum {n = 1<<21};
+       char *s = malloc(n+1);
+       int i;
+       int r;
+
+       for (i = 0; i < n; i++) s[i] = '1';
+       s[n] = 0;
+       r = sscanf(s, "%d", &i);
+       free(s);
+}
+
 void test_fscanf(void) {
        int i, x, y;
        char a[100], b[100];