diff options
author | Elliott Hughes <enh@google.com> | 2018-04-06 17:45:22 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2018-04-11 12:29:50 -0700 |
commit | 1b86d41c7844729768b2ffd096e1cded3c145a93 (patch) | |
tree | 54017f8b404487b71258a3aa8b78a9979eb2eecd /base/macros_test.cpp | |
parent | 1b2f2ee6215145d9d2af0bba6c0b847fec083107 (diff) | |
download | system_core-1b86d41c7844729768b2ffd096e1cded3c145a93.tar.gz system_core-1b86d41c7844729768b2ffd096e1cded3c145a93.tar.bz2 system_core-1b86d41c7844729768b2ffd096e1cded3c145a93.zip |
Add SIZEOF_MEMBER.
Bug: N/A
Test: ran tests
Change-Id: Icb7e8ae83d242c867b71a990b08eb1a62ed1482c
Diffstat (limited to 'base/macros_test.cpp')
-rw-r--r-- | base/macros_test.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/base/macros_test.cpp b/base/macros_test.cpp new file mode 100644 index 000000000..2b522db5c --- /dev/null +++ b/base/macros_test.cpp @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2018 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 "android-base/macros.h" + +#include <stdint.h> + +#include <gtest/gtest.h> + +TEST(macros, SIZEOF_MEMBER_macro) { + struct S { + int32_t i32; + double d; + }; + ASSERT_EQ(4U, SIZEOF_MEMBER(S, i32)); + ASSERT_EQ(8U, SIZEOF_MEMBER(S, d)); +} |