1 /*
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
TEST(limits,macros)21 TEST(limits, macros) {
22 ASSERT_EQ(8, CHAR_BIT);
23 ASSERT_EQ(8 * static_cast<int>(sizeof(int)), WORD_BIT);
24 ASSERT_EQ(2048, LINE_MAX);
25 ASSERT_EQ(20, NZERO);
26 #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 }
81