Elliott Hughes | 45da326 | 2017-08-29 15:28:33 -0700 | [diff] [blame] | 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 | |
| 21 | TEST(limits, macros) { |
Elliott Hughes | 19d7685 | 2017-10-18 13:27:01 -0700 | [diff] [blame] | 22 | ASSERT_EQ(8, CHAR_BIT); |
Elliott Hughes | dc8a612 | 2017-10-23 12:04:46 -0700 | [diff] [blame^] | 23 | ASSERT_EQ(8 * static_cast<int>(sizeof(int)), WORD_BIT); |
Elliott Hughes | 19d7685 | 2017-10-18 13:27:01 -0700 | [diff] [blame] | 24 | ASSERT_EQ(20, NZERO); |
Elliott Hughes | 45da326 | 2017-08-29 15:28:33 -0700 | [diff] [blame] | 25 | #if !defined(MB_LEN_MAX) |
| 26 | #error MB_LEN_MAX |
| 27 | #endif |
| 28 | #if !defined(CHAR_MIN) |
| 29 | #error CHAR_MIN |
| 30 | #endif |
| 31 | #if !defined(CHAR_MAX) |
| 32 | #error CHAR_MAX |
| 33 | #endif |
| 34 | #if !defined(SCHAR_MIN) |
| 35 | #error SCHAR_MIN |
| 36 | #endif |
| 37 | #if !defined(SCHAR_MAX) |
| 38 | #error SCHAR_MAX |
| 39 | #endif |
| 40 | #if !defined(SHRT_MIN) |
| 41 | #error SHRT_MIN |
| 42 | #endif |
| 43 | #if !defined(SHRT_MAX) |
| 44 | #error SHRT_MAX |
| 45 | #endif |
| 46 | #if !defined(INT_MIN) |
| 47 | #error INT_MIN |
| 48 | #endif |
| 49 | #if !defined(INT_MAX) |
| 50 | #error INT_MAX |
| 51 | #endif |
| 52 | #if !defined(LONG_MIN) |
| 53 | #error LONG_MIN |
| 54 | #endif |
| 55 | #if !defined(LONG_MAX) |
| 56 | #error LONG_MAX |
| 57 | #endif |
| 58 | #if !defined(LLONG_MIN) |
| 59 | #error LLONG_MIN |
| 60 | #endif |
| 61 | #if !defined(LLONG_MAX) |
| 62 | #error LLONG_MAX |
| 63 | #endif |
| 64 | #if !defined(UCHAR_MAX) |
| 65 | #error UCHAR_MAX |
| 66 | #endif |
| 67 | #if !defined(USHRT_MAX) |
| 68 | #error USHRT_MAX |
| 69 | #endif |
| 70 | #if !defined(UINT_MAX) |
| 71 | #error UINT_MAX |
| 72 | #endif |
| 73 | #if !defined(ULONG_MAX) |
| 74 | #error ULONG_MAX |
| 75 | #endif |
| 76 | #if !defined(ULLONG_MAX) |
| 77 | #error ULLONG_MAX |
| 78 | #endif |
| 79 | } |