diff options
author | Calin Juravle <calin@google.com> | 2014-02-20 13:40:36 +0000 |
---|---|---|
committer | Calin Juravle <calin@google.com> | 2014-02-21 16:27:21 +0000 |
commit | da030de702b756077fec536ed139e7ea38b51022 (patch) | |
tree | 43e29ce4f9b5128e25bb55efb78a4329104e38ac /tests/stdint_test.cpp | |
parent | 44ef37c1b445e864068cdcd885ab3d7b17079ad3 (diff) | |
download | bionic-da030de702b756077fec536ed139e7ea38b51022.zip bionic-da030de702b756077fec536ed139e7ea38b51022.tar.gz bionic-da030de702b756077fec536ed139e7ea38b51022.tar.bz2 |
Fixed int fast types for LP64
Bug: 13110474
Change-Id: Id5591603ad4ba7e149c0852f4abb25e4e5a5d065
Diffstat (limited to 'tests/stdint_test.cpp')
-rw-r--r-- | tests/stdint_test.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/stdint_test.cpp b/tests/stdint_test.cpp new file mode 100644 index 0000000..5dafee3 --- /dev/null +++ b/tests/stdint_test.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <gtest/gtest.h> + +#include <stdint.h> + +TEST(stdint_types, type_sizes) { + ASSERT_EQ(1U, sizeof(int_fast8_t)); + ASSERT_EQ(8U, sizeof(int_fast64_t)); + ASSERT_EQ(1U, sizeof(uint_fast8_t)); + ASSERT_EQ(8U, sizeof(uint_fast64_t)); +#if defined(__LP64__) + ASSERT_EQ(8U, sizeof(int_fast16_t)); + ASSERT_EQ(8U, sizeof(int_fast32_t)); + ASSERT_EQ(8U, sizeof(uint_fast16_t)); + ASSERT_EQ(8U, sizeof(uint_fast32_t)); +#else + ASSERT_EQ(4U, sizeof(int_fast16_t)); + ASSERT_EQ(4U, sizeof(int_fast32_t)); + ASSERT_EQ(4U, sizeof(uint_fast16_t)); + ASSERT_EQ(4U, sizeof(uint_fast32_t)); +#endif +} |