blob: bc13a3f7fecea6b6e8341b1c81ccc17f276601ef [file] [log] [blame]
Elliott Hughes45da3262017-08-29 15:28:33 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <gtest/gtest.h>
18
19#include <limits.h>
20
21TEST(limits, macros) {
Elliott Hughes19d76852017-10-18 13:27:01 -070022 ASSERT_EQ(8, CHAR_BIT);
Elliott Hughesdc8a6122017-10-23 12:04:46 -070023 ASSERT_EQ(8 * static_cast<int>(sizeof(int)), WORD_BIT);
Elliott Hughesb266f652024-04-09 15:41:10 +000024 ASSERT_EQ(2048, LINE_MAX);
Elliott Hughes19d76852017-10-18 13:27:01 -070025 ASSERT_EQ(20, NZERO);
Elliott Hughes45da3262017-08-29 15:28:33 -070026#if !defined(MB_LEN_MAX)
27#error MB_LEN_MAX
28#endif
29#if !defined(CHAR_MIN)
30#error CHAR_MIN
31#endif
32#if !defined(CHAR_MAX)
33#error CHAR_MAX
34#endif
35#if !defined(SCHAR_MIN)
36#error SCHAR_MIN
37#endif
38#if !defined(SCHAR_MAX)
39#error SCHAR_MAX
40#endif
41#if !defined(SHRT_MIN)
42#error SHRT_MIN
43#endif
44#if !defined(SHRT_MAX)
45#error SHRT_MAX
46#endif
47#if !defined(INT_MIN)
48#error INT_MIN
49#endif
50#if !defined(INT_MAX)
51#error INT_MAX
52#endif
53#if !defined(LONG_MIN)
54#error LONG_MIN
55#endif
56#if !defined(LONG_MAX)
57#error LONG_MAX
58#endif
59#if !defined(LLONG_MIN)
60#error LLONG_MIN
61#endif
62#if !defined(LLONG_MAX)
63#error LLONG_MAX
64#endif
65#if !defined(UCHAR_MAX)
66#error UCHAR_MAX
67#endif
68#if !defined(USHRT_MAX)
69#error USHRT_MAX
70#endif
71#if !defined(UINT_MAX)
72#error UINT_MAX
73#endif
74#if !defined(ULONG_MAX)
75#error ULONG_MAX
76#endif
77#if !defined(ULLONG_MAX)
78#error ULLONG_MAX
79#endif
80}