diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | tests/Makefile | 2 | ||||
-rw-r--r-- | tests/write.c | 22 |
3 files changed, 24 insertions, 1 deletions
@@ -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); + } + } +} + |