aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--tests/Makefile2
-rw-r--r--tests/write.c22
3 files changed, 24 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 804eaa0..0180353 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
tests/files
tests/mem
tests/stack
+tests/write
diff --git a/tests/Makefile b/tests/Makefile
index abc4fc5..d14df80 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -2,5 +2,5 @@
CC = clang
-all : files mem stack
+all : files mem stack write
diff --git a/tests/write.c b/tests/write.c
new file mode 100644
index 0000000..5ccbc90
--- /dev/null
+++ b/tests/write.c
@@ -0,0 +1,22 @@
+#include <signal.h>
+#include <stdio.h>
+
+int main(void) {
+ FILE *fp = NULL;
+ int b = 1;
+ char c = '\0';
+ if ((fp = tmpfile()) == NULL) {
+ perror("tmpfile");
+ raise(SIGABRT);
+ }
+ for (;;b++) {
+ if (fwrite(&c, 1, 1, fp) == 0) {
+ perror("fwrite");
+ raise(SIGABRT);
+ }
+ if (b % 1000 == 0) {
+ fprintf(stderr, "Wrote %u octets\n", b);
+ }
+ }
+}
+