summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-03-01 19:45:11 -0500
committerJakob Kaivo <jkk@ung.org>2019-03-01 19:45:11 -0500
commitdf9ef3a48883d4a34eeabbfd5af42f289c1353c2 (patch)
tree64c86cb73063a3d315de7c3c94b508ce1679e8ef
parent8396c02590a6a0d34d0ba667c5e5cff4860d1ebc (diff)
basic tests for stdbool.h and stddef.h
-rw-r--r--Makefile41
-rw-r--r--main.c4
-rw-r--r--stdbool.c22
-rw-r--r--stddef.c24
4 files changed, 85 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 34d6f4b..9933928 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,19 @@ include config.mk
CFLAGS=-g -I$(INCLUDEDIR) -nostdinc -fno-builtin
LDFLAGS=-L$(LIBDIR) $(LIBS)
-TESTOBJS=main.o test.o assert.o ctype.o locale.o errno.o time.o signal.o limits.o float.o iso646.o
+TESTOBJS=main.o \
+ assert.o \
+ ctype.o \
+ errno.o \
+ float.o \
+ iso646.o \
+ limits.o \
+ locale.o \
+ signal.o \
+ stdbool.o \
+ stddef.o \
+ time.o \
+ test.o
.SUFFIXES: .defs .d
@@ -16,14 +28,35 @@ testlibc: $(TESTOBJS) $(LIBDIR)/libc.a
$(CC) -o $@ $(TESTOBJS) $(LDFLAGS)
assert.o: assert.c test.h
+complex.o: complex.c test.h
ctype.o: ctype.c test.h
-limits.o: limits.c test.h
+errno.o: errno.c test.h
+fenv.o: fenv.c test.h
float.o: float.c test.h
+inttypes.o: inttypes.c test.h
iso646.o: iso646.c test.h
+limits.o: limits.c test.h
locale.o: locale.c locale.d test.h
-errno.o: errno.c test.h
-time.o: time.c test.h
+math.o: math.c test.h
+setjmp.o: setjmp.c test.h
signal.o: signal.c signal.d test.h
+stdalign.o: stdalign.c test.h
+stdard.o: stdarg.c test.h
+stdatomic.o: stdatomic.c test.h
+stdbool.o: stdbool.c test.h
+stddef.o: stddef.c test.h
+stdint.o: stdint.c test.h
+stdio.o: stdio.c test.h
+stdlib.o: stdlib.c test.h
+stdnoreturn.o: stdnoreturn.c test.h
+string.o: string.c test.h
+tgmath.o: tgmath.c test.h
+threads.o: threads.c test.h
+time.o: time.c test.h
+uchar.o: uchar.c test.h
+wchar.o: wchar.c test.h
+wctype.o: wctype.c test.h
+
test.o: test.c test.h
main.o: main.c test.h
diff --git a/main.c b/main.c
index 42e8793..1fda841 100644
--- a/main.c
+++ b/main.c
@@ -55,8 +55,8 @@ int main(int argc, char *argv[])
/* test_stdalign_h(); */
/* test_stdarg_h(); */
/* test_stdatomic_h(); */
- /* test_stdbool_h(); */
- /* test_stddef_h(); */
+ test_stdbool_h();
+ test_stddef_h();
/* test_stdint_h(); */
/* test_stdio_h(); */
/* test_stdlib_h(); */
diff --git a/stdbool.c b/stdbool.c
new file mode 100644
index 0000000..bb43b55
--- /dev/null
+++ b/stdbool.c
@@ -0,0 +1,22 @@
+#if defined __STDC_VERSION__ && 199901L <= __STDC_VERSION__
+#include <stdbool.h>
+#include "test.h"
+
+static bool b;
+
+void test_stdbool_h(void)
+{
+ testing_header("stdbool.h");
+
+ test_true(true);
+ test_false(false);
+ test_true(__bool_true_false_are_defined);
+
+ testing_end();
+}
+
+#else
+void test_stdbool_h(void)
+{
+}
+#endif
diff --git a/stddef.c b/stddef.c
new file mode 100644
index 0000000..069225e
--- /dev/null
+++ b/stddef.c
@@ -0,0 +1,24 @@
+#include <stddef.h>
+#include "test.h"
+
+static ptrdiff_t ptrdiff;
+static size_t size;
+static wchar_t wchar;
+
+void test_stddef_h(void)
+{
+ struct s {
+ char a;
+ char b;
+ };
+
+ testing_header("stddef.h");
+
+ test_true(NULL == 0);
+
+ /*
+ test_int_eq(offsetof(struct s, b), 1);
+ */
+
+ testing_end();
+}