X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-stdint.c;h=39fc51ca195b3d667b28089ecdc2da38a69b1841;hb=11dbc24bbfd94e0e8d36754fe17bb1fdeb58fe5e;hp=cff7f54a545c2442c6f64a19177bfc84706a736c;hpb=056cbcb8becf3b1e22bfb452ad04a5116fa71432;p=gnulib.git diff --git a/tests/test-stdint.c b/tests/test-stdint.c index cff7f54a5..39fc51ca1 100644 --- a/tests/test-stdint.c +++ b/tests/test-stdint.c @@ -1,26 +1,23 @@ /* Test of substitute. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2007 Free Software Foundation, Inc. - This program is free software; you can redistribute it and/or modify it - under the terms of the GNU Library General Public License as published - by the Free Software Foundation; either version 2, or (at your option) + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* Written by Bruno Haible , 2006. */ -#ifdef HAVE_CONFIG_H -# include -#endif +#include /* Whether to enable pedantic checks. */ #define DO_PEDANTIC 0 @@ -38,7 +35,7 @@ # define _verify_func(line) _verify_func2(line) # define _verify_func2(line) verify_func_ ## line #else -# define verify_same_types(expr1,expr2) +# define verify_same_types(expr1,expr2) extern void verify_func (int) #endif /* 7.18.1.1. Exact-width integer types */ @@ -62,7 +59,7 @@ verify (TYPE_MAXIMUM (int32_t) == INT32_MAX); verify_same_types (INT32_MIN, (int32_t) 0 + 0); verify_same_types (INT32_MAX, (int32_t) 0 + 0); -#if HAVE_INT64_T_IN_STDINT_H || _STDINT_H_HAVE_INT64 +#ifdef INT64_MAX int64_t a4[3] = { INT64_C (17), INT64_MIN, INT64_MAX }; verify (TYPE_MINIMUM (int64_t) == INT64_MIN); verify (TYPE_MAXIMUM (int64_t) == INT64_MAX); @@ -82,7 +79,7 @@ uint32_t b3[2] = { UINT32_C (17), UINT32_MAX }; verify (TYPE_MAXIMUM (uint32_t) == UINT32_MAX); verify_same_types (UINT32_MAX, (uint32_t) 0 + 0); -#if HAVE_UINT64_T_IN_STDINT_H || _STDINT_H_HAVE_UINT64 +#ifdef UINT64_MAX uint64_t b4[2] = { UINT64_C (17), UINT64_MAX }; verify (TYPE_MAXIMUM (uint64_t) == UINT64_MAX); verify_same_types (UINT64_MAX, (uint64_t) 0 + 0); @@ -121,7 +118,7 @@ verify (TYPE_MAXIMUM (int_least32_t) == INT_LEAST32_MAX); verify_same_types (INT_LEAST32_MIN, (int_least32_t) 0 + 0); verify_same_types (INT_LEAST32_MAX, (int_least32_t) 0 + 0); -#if HAVE_INT_LEAST64_T_IN_STDINT_H || _STDINT_H_HAVE_INT64 +#ifdef INT_LEAST64_MAX int_least64_t c4[3] = { 17, INT_LEAST64_MIN, INT_LEAST64_MAX }; verify (TYPE_MINIMUM (int_least64_t) == INT_LEAST64_MIN); verify (TYPE_MAXIMUM (int_least64_t) == INT_LEAST64_MAX); @@ -141,7 +138,7 @@ uint_least32_t d3[2] = { 17, UINT_LEAST32_MAX }; verify (TYPE_MAXIMUM (uint_least32_t) == UINT_LEAST32_MAX); verify_same_types (UINT_LEAST32_MAX, (uint_least32_t) 0 + 0); -#if HAVE_UINT_LEAST64_T_IN_STDINT_H || _STDINT_H_HAVE_UINT64 +#ifdef UINT_LEAST64_MAX uint_least64_t d4[2] = { 17, UINT_LEAST64_MAX }; verify (TYPE_MAXIMUM (uint_least64_t) == UINT_LEAST64_MAX); verify_same_types (UINT_LEAST64_MAX, (uint_least64_t) 0 + 0); @@ -180,7 +177,7 @@ verify (TYPE_MAXIMUM (int_fast32_t) == INT_FAST32_MAX); verify_same_types (INT_FAST32_MIN, (int_fast32_t) 0 + 0); verify_same_types (INT_FAST32_MAX, (int_fast32_t) 0 + 0); -#if HAVE_INT_FAST64_T_IN_STDINT_H || _STDINT_H_HAVE_INT64 +#ifdef INT_FAST64_MAX int_fast64_t e4[3] = { 17, INT_FAST64_MIN, INT_FAST64_MAX }; verify (TYPE_MINIMUM (int_fast64_t) == INT_FAST64_MIN); verify (TYPE_MAXIMUM (int_fast64_t) == INT_FAST64_MAX); @@ -200,7 +197,7 @@ uint_fast32_t f3[2] = { 17, UINT_FAST32_MAX }; verify (TYPE_MAXIMUM (uint_fast32_t) == UINT_FAST32_MAX); verify_same_types (UINT_FAST32_MAX, (uint_fast32_t) 0 + 0); -#if HAVE_UINT_FAST64_T_IN_STDINT_H || _STDINT_H_HAVE_UINT64 +#ifdef UINT_FAST64_MAX uint_fast64_t f4[2] = { 17, UINT_FAST64_MAX }; verify (TYPE_MAXIMUM (uint_fast64_t) == UINT_FAST64_MAX); verify_same_types (UINT_FAST64_MAX, (uint_fast64_t) 0 + 0); @@ -293,30 +290,32 @@ verify_same_types (SIZE_MAX, (size_t) 0 + 0); err or; #endif +#if HAVE_WCHAR_T verify (TYPE_MINIMUM (wchar_t) == WCHAR_MIN); verify (TYPE_MAXIMUM (wchar_t) == WCHAR_MAX); verify_same_types (WCHAR_MIN, (wchar_t) 0 + 0); verify_same_types (WCHAR_MAX, (wchar_t) 0 + 0); -#if WCHAR_MIN != 17 && WCHAR_MAX +# if WCHAR_MIN != 17 && WCHAR_MAX /* ok */ -#else +# else err or; +# endif #endif -#include -#include -#include +#if HAVE_WINT_T +# include verify (TYPE_MINIMUM (wint_t) == WINT_MIN); verify (TYPE_MAXIMUM (wint_t) == WINT_MAX); verify_same_types (WINT_MIN, (wint_t) 0 + 0); verify_same_types (WINT_MAX, (wint_t) 0 + 0); -#if WINT_MIN != 17 && WINT_MAX +# if WINT_MIN != 17 && WINT_MAX /* ok */ -#else +# else err or; +# endif #endif /* 7.18.4. Macros for integer constants */ @@ -336,11 +335,11 @@ verify_same_types (INT32_C (17), (int_least32_t)0 + 0); verify (UINT32_C (17) == 17); verify_same_types (UINT32_C (17), (uint_least32_t)0 + 0); -#if HAVE_INT_LEAST64_T_IN_STDINT_H || _STDINT_H_HAVE_INT64 +#ifdef INT64_C verify (INT64_C (17) == 17); verify_same_types (INT64_C (17), (int_least64_t)0 + 0); #endif -#if HAVE_UINT_LEAST64_T_IN_STDINT_H || _STDINT_H_HAVE_UINT64 +#ifdef UINT64_C verify (UINT64_C (17) == 17); verify_same_types (UINT64_C (17), (uint_least64_t)0 + 0); #endif