OSDN Git Service

Merge "Disable compat_elf_hash_and_relocation_tables test for x86" am: fe96db819b...
[android-x86/bionic.git] / tests / stdint_test.cpp
1 /*
2  * Copyright (C) 2014 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 <stdint.h>
20
21 TEST(stdint_types, type_sizes) {
22   ASSERT_EQ(1U, sizeof(int_fast8_t));
23   ASSERT_EQ(8U, sizeof(int_fast64_t));
24   ASSERT_EQ(1U, sizeof(uint_fast8_t));
25   ASSERT_EQ(8U, sizeof(uint_fast64_t));
26 #if defined(__LP64__)
27   ASSERT_EQ(8U, sizeof(int_fast16_t));
28   ASSERT_EQ(8U, sizeof(int_fast32_t));
29   ASSERT_EQ(8U, sizeof(uint_fast16_t));
30   ASSERT_EQ(8U, sizeof(uint_fast32_t));
31 #else
32   ASSERT_EQ(4U, sizeof(int_fast16_t));
33   ASSERT_EQ(4U, sizeof(int_fast32_t));
34   ASSERT_EQ(4U, sizeof(uint_fast16_t));
35   ASSERT_EQ(4U, sizeof(uint_fast32_t));
36 #endif
37 }