From 1a834f6bd8897e1dfd3781a296f6bffc26deeece Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Thu, 8 Aug 2019 14:24:34 -0400 Subject: replace all instances of test_defined() with #ifdef tests --- Makefile | 8 ++++---- stdalign.c | 4 ++-- stdio.c | 2 +- test.h | 1 - wchar.c | 2 +- wctype.c | 3 +-- 6 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 9f48418..dc407ce 100644 --- a/Makefile +++ b/Makefile @@ -62,16 +62,16 @@ 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 +stdio.o: stdio.c test.h _stdio.h stdlib.o: stdlib.c test.h -stdnoreturn.o: stdnoreturn.c test.h +stdnoreturn.o: stdnoreturn.c test.h _stdnoreturn.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 +wchar.o: wchar.c test.h _wchar.h +wctype.o: wctype.c test.h _wctype.h test.o: test.c test.h main.o: main.c test.h diff --git a/stdalign.c b/stdalign.c index 3cb7494..67ce67c 100644 --- a/stdalign.c +++ b/stdalign.c @@ -10,8 +10,8 @@ void test_stdalign_h(void) /* alignas() */ /* alignof() */ - test_defined(__alignas_is_defined); - test_defined(__alignof_is_defined); + test_int_equals(__alignas_is_defined, 1); + test_int_equals(__alignof_is_defined, 1); testing_end(); } diff --git a/stdio.c b/stdio.c index 713b16b..1721f6d 100644 --- a/stdio.c +++ b/stdio.c @@ -1,4 +1,5 @@ #include +#include "_stdio.h" #include "test.h" void test_stdio_h(void) @@ -23,7 +24,6 @@ void test_stdio_h(void) 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); diff --git a/test.h b/test.h index cd5fb26..628564b 100644 --- a/test.h +++ b/test.h @@ -21,7 +21,6 @@ void test_bool_imp(const char *, int, int); #define test_true(expression) test_bool_imp(#expression, expression, 1) #define test_min(expression, min) test_bool_imp(#expression, min < 0 ? expression <= min : expression >= min, 1) #define test_max(expression, max) test_bool_imp(#expression, 0 < expression && expression <= max, 1) -#define test_defined(expression) test_false(expression * 0) void test_string_imp(const char*, const char*, const char*); #define test_string(expression, string) test_string_imp(#expression, expression, string) diff --git a/wchar.c b/wchar.c index d6e59ea..eb3f817 100644 --- a/wchar.c +++ b/wchar.c @@ -1,5 +1,6 @@ #if defined __STDC_VERSION__ #include +#include "_wchar.h" #include "test.h" void test_wchar_h(void) @@ -15,7 +16,6 @@ void test_wchar_h(void) test_true(NULL == 0); test_min(WCHAR_MIN, 0); test_min(WCHAR_MAX, 0); - test_defined(WEOF); testing_end(); } diff --git a/wctype.c b/wctype.c index 69cef8b..5676a26 100644 --- a/wctype.c +++ b/wctype.c @@ -1,5 +1,6 @@ #if defined __STDC_VERSION__ #include +#include "_wctype.h" #include "test.h" void test_wctype_h(void) @@ -10,8 +11,6 @@ void test_wctype_h(void) testing_header("wctype.h"); - test_defined(WEOF); - testing_end(); } -- cgit v1.2.1