diff options
author | Jakob Kaivo <jkk@ung.org> | 2019-03-01 21:09:38 -0500 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2019-03-01 21:09:38 -0500 |
commit | 3289aef6dd90453f46f0ba3102ae184734374dc7 (patch) | |
tree | 37a813f7ac62a915c045675db4f93861bd529d4d | |
parent | 2c9f47eb2eb7456948aeb8bed307e6b39be2cc32 (diff) |
skeleton tests for all C89 headers
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | main.c | 6 | ||||
-rw-r--r-- | stdio.c | 34 | ||||
-rw-r--r-- | stdlib.c | 26 | ||||
-rw-r--r-- | string.c | 13 |
5 files changed, 79 insertions, 3 deletions
@@ -19,6 +19,9 @@ TESTOBJS=main.o \ stdarg.o \ stdbool.o \ stddef.o \ + stdio.o \ + stdlib.o \ + string.o \ time.o \ test.o @@ -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(); @@ -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(); +} |