diff options
author | Jakob Kaivo <jkk@ung.org> | 2019-03-01 19:45:11 -0500 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2019-03-01 19:45:11 -0500 |
commit | df9ef3a48883d4a34eeabbfd5af42f289c1353c2 (patch) | |
tree | 64c86cb73063a3d315de7c3c94b508ce1679e8ef | |
parent | 8396c02590a6a0d34d0ba667c5e5cff4860d1ebc (diff) |
basic tests for stdbool.h and stddef.h
-rw-r--r-- | Makefile | 41 | ||||
-rw-r--r-- | main.c | 4 | ||||
-rw-r--r-- | stdbool.c | 22 | ||||
-rw-r--r-- | stddef.c | 24 |
4 files changed, 85 insertions, 6 deletions
@@ -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 @@ -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(); +} |