summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-03-01 21:09:38 -0500
committerJakob Kaivo <jkk@ung.org>2019-03-01 21:09:38 -0500
commit3289aef6dd90453f46f0ba3102ae184734374dc7 (patch)
tree37a813f7ac62a915c045675db4f93861bd529d4d
parent2c9f47eb2eb7456948aeb8bed307e6b39be2cc32 (diff)
skeleton tests for all C89 headers
-rw-r--r--Makefile3
-rw-r--r--main.c6
-rw-r--r--stdio.c34
-rw-r--r--stdlib.c26
-rw-r--r--string.c13
5 files changed, 79 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 304851a..61bd4d3 100644
--- a/Makefile
+++ b/Makefile
@@ -19,6 +19,9 @@ TESTOBJS=main.o \
stdarg.o \
stdbool.o \
stddef.o \
+ stdio.o \
+ stdlib.o \
+ string.o \
time.o \
test.o
diff --git a/main.c b/main.c
index 316bd83..3382797 100644
--- a/main.c
+++ b/main.c
@@ -58,10 +58,10 @@ int main(int argc, char *argv[])
test_stdbool_h();
test_stddef_h();
/* test_stdint_h(); */
- /* test_stdio_h(); */
- /* test_stdlib_h(); */
+ test_stdio_h();
+ test_stdlib_h();
/* test_stdnoreturn_h(); */
- /* test_string_h(); */
+ test_string_h();
/* test_tgmath_h(); */
/* test_threads_h(); */
test_time_h();
diff --git a/stdio.c b/stdio.c
new file mode 100644
index 0000000..713b16b
--- /dev/null
+++ b/stdio.c
@@ -0,0 +1,34 @@
+#include <stdio.h>
+#include "test.h"
+
+void test_stdio_h(void)
+{
+ FILE *file;
+ fpos_t fpos;
+ size_t size;
+
+ int buftypes[] = {
+ _IOFBF,
+ _IOLBF,
+ _IONBF,
+ };
+
+ int seeks[] = {
+ SEEK_CUR,
+ SEEK_END,
+ SEEK_SET,
+ };
+
+ testing_header("stdio.h");
+
+ test_distinct(buftypes);
+ test_min(BUFSIZ, 256);
+ test_defined(EOF);
+ test_min(FILENAME_MAX, 1);
+ test_min(FOPEN_MAX, 8);
+ test_min(L_tmpnam, 1);
+ test_true(NULL == 0);
+ test_min(TMP_MAX, 25);
+
+ testing_end();
+}
diff --git a/stdlib.c b/stdlib.c
new file mode 100644
index 0000000..1b59e1c
--- /dev/null
+++ b/stdlib.c
@@ -0,0 +1,26 @@
+#include <stdlib.h>
+#include <limits.h>
+#include "test.h"
+
+void test_stdlib_h(void)
+{
+ div_t div;
+ ldiv_t ldiv;
+ size_t size;
+ wchar_t wchar;
+
+ int exit_statuses[] = {
+ EXIT_FAILURE,
+ EXIT_SUCCESS,
+ };
+
+ testing_header("stdlib.h");
+
+ test_distinct(exit_statuses);
+ test_min(MB_CUR_MAX, 1);
+ test_max(MB_CUR_MAX, MB_LEN_MAX);
+ test_true(NULL == 0);
+ test_min(RAND_MAX, 32767);
+
+ testing_end();
+}
diff --git a/string.c b/string.c
new file mode 100644
index 0000000..86a270c
--- /dev/null
+++ b/string.c
@@ -0,0 +1,13 @@
+#include <string.h>
+#include "test.h"
+
+void test_string_h(void)
+{
+ size_t size;
+
+ testing_header("string.h");
+
+ test_true(NULL == 0);
+
+ testing_end();
+}