diff options
author | Tom Hughes <tomhughes@chromium.org> | 2021-04-30 15:31:16 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-05-03 21:40:21 +0000 |
commit | 6affaa1b390bf653fa8861d04c2d834a230c7487 (patch) | |
tree | 42e764b2565efac61d9ae98ec6ec4612b8eb1173 /test | |
parent | 2ddae23ef3a6a51db07675f3a495a961e3a74d5f (diff) | |
download | chrome-ec-6affaa1b390bf653fa8861d04c2d834a230c7487.tar.gz |
compile_time_macros: Make _IS_ARRAY work with C++
BRANCH=none
BUG=b:144959033
TEST=make buildall
Signed-off-by: Tom Hughes <tomhughes@chromium.org>
Change-Id: I199f05eabad1182ca2da4489361426d04da06691
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2864513
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/compile_time_macros.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/compile_time_macros.c b/test/compile_time_macros.c index 40e962e101..60b3bae7b6 100644 --- a/test/compile_time_macros.c +++ b/test/compile_time_macros.c @@ -5,6 +5,7 @@ * Test compile_time_macros.h */ +#include "stdbool.h" #include "common.h" #include "test_util.h" @@ -55,6 +56,17 @@ static int test_GENMASK_ULL(void) return EC_SUCCESS; } +test_static int test_IS_ARRAY(void) +{ + int array[5]; + int *pointer = array; + + TEST_EQ(_IS_ARRAY(array), true, "%d"); + TEST_EQ(_IS_ARRAY(pointer), false, "%d"); + + return EC_SUCCESS; +} + void run_test(int argc, char **argv) { test_reset(); @@ -63,6 +75,7 @@ void run_test(int argc, char **argv) RUN_TEST(test_BIT_ULL); RUN_TEST(test_GENMASK); RUN_TEST(test_GENMASK_ULL); + RUN_TEST(test_IS_ARRAY); test_print_result(); } |