summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile8
-rw-r--r--fenv.c19
-rw-r--r--inttypes.c26
-rw-r--r--main.c14
-rw-r--r--stdint.c44
-rw-r--r--tgmath.c18
-rw-r--r--wchar.c27
-rw-r--r--wctype.c22
8 files changed, 171 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 61bd4d3..9d75446 100644
--- a/Makefile
+++ b/Makefile
@@ -2,14 +2,18 @@
include config.mk
+CC=c99
CFLAGS=-g -I$(INCLUDEDIR) -nostdinc -fno-builtin
LDFLAGS=-L$(LIBDIR) $(LIBS)
TESTOBJS=main.o \
assert.o \
+ complex.o \
ctype.o \
errno.o \
+ fenv.o \
float.o \
+ inttypes.o \
iso646.o \
limits.o \
locale.o \
@@ -19,10 +23,14 @@ TESTOBJS=main.o \
stdarg.o \
stdbool.o \
stddef.o \
+ stdint.o \
stdio.o \
stdlib.o \
string.o \
+ tgmath.o \
time.o \
+ wchar.o \
+ wctype.o \
test.o
testlibc: $(TESTOBJS) $(LIBDIR)/libc.a
diff --git a/fenv.c b/fenv.c
new file mode 100644
index 0000000..1b6414a
--- /dev/null
+++ b/fenv.c
@@ -0,0 +1,19 @@
+#if defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__
+#include <fenv.h>
+#include "test.h"
+
+void test_fenv_h(void)
+{
+ fenv_t fenv;
+ fexcept_t fexcept;
+
+ testing_header("fenv.h");
+
+ testing_end();
+}
+
+#else
+void test_fenv_h(void)
+{
+}
+#endif
diff --git a/inttypes.c b/inttypes.c
new file mode 100644
index 0000000..0d88d9b
--- /dev/null
+++ b/inttypes.c
@@ -0,0 +1,26 @@
+#if defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__
+#include <wchar.h>
+#include <inttypes.h>
+#include "test.h"
+
+void test_inttypes_h(void)
+{
+ imaxdiv_t imaxdiv;
+ char *endptr;
+
+ testing_header("inttypes.h");
+
+ test_true(imaxabs(-1) == 1);
+
+ intmax_t im = strtoimax("100000000q", &endptr, 0);
+ test_true(im == 100000000);
+ test_true(*endptr == 'q');
+
+ testing_end();
+}
+
+#else
+void test_inttypes_h(void)
+{
+}
+#endif
diff --git a/main.c b/main.c
index 3382797..a7444d9 100644
--- a/main.c
+++ b/main.c
@@ -40,12 +40,12 @@ int main(int argc, char *argv[])
}
}
- /* test_complex_h(); */
+ test_complex_h();
test_ctype_h();
test_errno_h();
- /* test_fenv_h(); */
+ test_fenv_h();
test_float_h();
- /* test_inttypes_h(); */
+ test_inttypes_h();
test_iso646_h();
test_limits_h();
test_locale_h();
@@ -57,17 +57,17 @@ int main(int argc, char *argv[])
/* test_stdatomic_h(); */
test_stdbool_h();
test_stddef_h();
- /* test_stdint_h(); */
+ test_stdint_h();
test_stdio_h();
test_stdlib_h();
/* test_stdnoreturn_h(); */
test_string_h();
- /* test_tgmath_h(); */
+ test_tgmath_h();
/* test_threads_h(); */
test_time_h();
/* test_uchar_h(); */
- /* test_wchar_h(); */
- /* test_wctype_h(); */
+ test_wchar_h();
+ test_wctype_h();
printf("Total: %u passed, %u failed\n", total_passed, total_failed);
return 0;
diff --git a/stdint.c b/stdint.c
new file mode 100644
index 0000000..6214bdd
--- /dev/null
+++ b/stdint.c
@@ -0,0 +1,44 @@
+#if defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__
+#include <stdint.h>
+#include "test.h"
+
+void test_stdint_h(void)
+{
+ intptr_t intptr;
+ uintptr_t uintptr;
+ intmax_t intmax;
+ uintmax_t uintmax;
+
+ testing_header("inttypes.h");
+
+ test_min(INTPTR_MIN, 0);
+ test_min(INTPTR_MAX, 0);
+ test_min(UINTPTR_MAX, 0);
+
+ test_min(INTMAX_MIN, 0);
+ test_min(INTMAX_MAX, 0);
+ test_min(UINTMAX_MAX, 0);
+
+ test_min(PTRDIFF_MIN, 0);
+ test_min(PTRDIFF_MAX, 0);
+ test_min(PTRDIFF_MAX, 0);
+
+ test_min(SIG_ATOMIC_MIN, 0);
+ test_min(SIG_ATOMIC_MAX, 0);
+
+ test_min(SIZE_MAX, 0);
+
+ test_min(WCHAR_MIN, 0);
+ test_min(WCHAR_MAX, 0);
+
+ test_min(WINT_MIN, 0);
+ test_min(WINT_MAX, 0);
+
+ testing_end();
+}
+
+#else
+void test_stdint_h(void)
+{
+}
+#endif
diff --git a/tgmath.c b/tgmath.c
new file mode 100644
index 0000000..2f4e2d8
--- /dev/null
+++ b/tgmath.c
@@ -0,0 +1,18 @@
+#if defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__
+#include <tgmath.h>
+#include "test.h"
+
+void test_tgmath_h(void)
+{
+ testing_header("tgmath.h");
+
+ /* I'm not really sure how to test this accurately in C alone */
+
+ testing_end();
+}
+
+#else
+void test_tgmath_h(void)
+{
+}
+#endif
diff --git a/wchar.c b/wchar.c
new file mode 100644
index 0000000..d6e59ea
--- /dev/null
+++ b/wchar.c
@@ -0,0 +1,27 @@
+#if defined __STDC_VERSION__
+#include <wchar.h>
+#include "test.h"
+
+void test_wchar_h(void)
+{
+ wchar_t wchar;
+ size_t size;
+ mbstate_t mbstate;
+ wint_t wint;
+ struct tm *tm;
+
+ testing_header("wchar.h");
+
+ test_true(NULL == 0);
+ test_min(WCHAR_MIN, 0);
+ test_min(WCHAR_MAX, 0);
+ test_defined(WEOF);
+
+ testing_end();
+}
+
+#else
+void test_wchar_h(void)
+{
+}
+#endif
diff --git a/wctype.c b/wctype.c
new file mode 100644
index 0000000..69cef8b
--- /dev/null
+++ b/wctype.c
@@ -0,0 +1,22 @@
+#if defined __STDC_VERSION__
+#include <wctype.h>
+#include "test.h"
+
+void test_wctype_h(void)
+{
+ wint_t wint;
+ wctrans_t wctrans;
+ wctype_t wctype;
+
+ testing_header("wctype.h");
+
+ test_defined(WEOF);
+
+ testing_end();
+}
+
+#else
+void test_wctype_h(void)
+{
+}
+#endif