glob: Declare variables at the very start of their scope.
[gnulib/ericb.git] / tests / test-limits-h.c
blob15a291f9fc1e6c84e8ec366f475f9c49fcf7cbdc
1 /* Test of <limits.h> substitute.
2 Copyright 2016-2017 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 /* Written by Paul Eggert. */
19 #include <config.h>
21 #include <limits.h>
23 #include "verify.h"
25 #if 4 < __GNUC__ + (3 <= __GNUC_MINOR__)
26 # pragma GCC diagnostic ignored "-Woverlength-strings"
27 #endif
29 /* Macros specified by ISO/IEC TS 18661-1:2014. */
31 #define verify_width(width, min, max) \
32 verify ((max) >> ((width) - 1 - ((min) < 0)) == 1)
34 verify_width (CHAR_WIDTH, CHAR_MIN, CHAR_MAX);
35 verify_width (SCHAR_WIDTH, SCHAR_MIN, SCHAR_MAX);
36 verify_width (UCHAR_WIDTH, 0, UCHAR_MAX);
37 verify_width (SHRT_WIDTH, SHRT_MIN, SHRT_MAX);
38 verify_width (USHRT_WIDTH, 0, USHRT_MAX);
39 verify_width (INT_WIDTH, INT_MIN, INT_MAX);
40 verify_width (UINT_WIDTH, 0, UINT_MAX);
41 verify_width (LONG_WIDTH, LONG_MIN, LONG_MAX);
42 verify_width (ULONG_WIDTH, 0, ULONG_MAX);
43 verify_width (LLONG_WIDTH, LLONG_MIN, LLONG_MAX);
44 verify_width (ULLONG_WIDTH, 0, ULLONG_MAX);
46 int
47 main (void)
49 return 0;