diff options
author | Jakob Kaivo <jkk@ung.org> | 2019-08-08 14:08:30 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2019-08-08 14:08:30 -0400 |
commit | cd9cd3483d3244aede3438960599d89ffc82039e (patch) | |
tree | 5a88ffe485503911da90a5e2af6f7e7fd7538d78 | |
parent | 9d20f3f30dec9cc33057ee4a9e7ce75961664dd5 (diff) |
simpler and more correct tests for sybmolic macro existance
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | _float.h | 27 | ||||
-rw-r--r-- | float.c | 10 | ||||
-rw-r--r-- | float.d | 9 |
4 files changed, 41 insertions, 10 deletions
@@ -46,7 +46,7 @@ complex.o: complex.c test.h ctype.o: ctype.c test.h errno.o: errno.c test.h fenv.o: fenv.c test.h -float.o: float.c test.h +float.o: float.c test.h _float.h inttypes.o: inttypes.c test.h iso646.o: iso646.c test.h limits.o: limits.c test.h @@ -74,5 +74,8 @@ wctype.o: wctype.c test.h test.o: test.c test.h main.o: main.c test.h +_float.h: float.d + awk '{printf("#ifndef %s\n#error %s not defined\n#endif\n", $$0, $$0);}' float.d > $@ + clean: rm -f *.o testlibc diff --git a/_float.h b/_float.h new file mode 100644 index 0000000..b438644 --- /dev/null +++ b/_float.h @@ -0,0 +1,27 @@ +#ifndef DBL_MANT_DIG +#error DBL_MANT_DIG not defined +#endif +#ifndef DBL_MAX_EXP +#error DBL_MAX_EXP not defined +#endif +#ifndef DBL_MIN_EXP +#error DBL_MIN_EXP not defined +#endif +#ifndef FLT_MANT_DIG +#error FLT_MANT_DIG not defined +#endif +#ifndef FLT_MAX_EXP +#error FLT_MAX_EXP not defined +#endif +#ifndef FLT_MIN_EXP +#error FLT_MIN_EXP not defined +#endif +#ifndef LDBL_MANT_DIG +#error LDBL_MANT_DIG not defined +#endif +#ifndef LDBL_MAX_EXP +#error LDBL_MAX_EXP not defined +#endif +#ifndef LDBL_MIN_EXP +#error LDBL_MIN_EXP not defined +#endif @@ -1,4 +1,5 @@ #include <float.h> +#include "_float.h" #include "test.h" void test_float_h(void) @@ -6,26 +7,17 @@ void test_float_h(void) testing_header("float.h"); test_min(DBL_DIG, 10); - test_defined(DBL_MANT_DIG); test_min(DBL_MAX_10_EXP, 37); - test_defined(DBL_MAX_EXP); test_min(DBL_MIN_10_EXP, -37); - test_defined(DBL_MIN_EXP); test_min(FLT_DIG, 6); - test_defined(FLT_MANT_DIG); test_min(FLT_MAX_10_EXP, 37); - test_defined(FLT_MAX_EXP); test_min(FLT_MIN_10_EXP, -37); - test_defined(FLT_MIN_EXP); test_min(FLT_RADIX, 2); test_min(LDBL_DIG, 6); - test_defined(LDBL_MANT_DIG); test_min(LDBL_MAX_10_EXP, 37); - test_defined(LDBL_MAX_EXP); test_min(LDBL_MIN_10_EXP, -37); - test_defined(LDBL_MIN_EXP); test_min(DBL_MAX, 1e+37); test_min(FLT_MAX, 1e+37); @@ -0,0 +1,9 @@ +DBL_MANT_DIG +DBL_MAX_EXP +DBL_MIN_EXP +FLT_MANT_DIG +FLT_MAX_EXP +FLT_MIN_EXP +LDBL_MANT_DIG +LDBL_MAX_EXP +LDBL_MIN_EXP |