From 3289aef6dd90453f46f0ba3102ae184734374dc7 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Fri, 1 Mar 2019 21:09:38 -0500 Subject: skeleton tests for all C89 headers --- Makefile | 3 +++ main.c | 6 +++--- stdio.c | 34 ++++++++++++++++++++++++++++++++++ stdlib.c | 26 ++++++++++++++++++++++++++ string.c | 13 +++++++++++++ 5 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 stdio.c create mode 100644 stdlib.c create mode 100644 string.c 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 +#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 +#include +#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 +#include "test.h" + +void test_string_h(void) +{ + size_t size; + + testing_header("string.h"); + + test_true(NULL == 0); + + testing_end(); +} -- cgit v1.2.1