Blender V4.3
BLI_utildefines_test.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#include "BLI_utildefines.h"
6
7#include "testing/testing.h"
8
9namespace blender::tests {
10
11TEST(BLI_utildefines, ARRAY_SIZE)
12{
13 {
14 int bounded_char[5];
15 static_assert(ARRAY_SIZE(bounded_char) == 5);
16 }
17
18 {
19 int *bounded_char[5];
20 static_assert(ARRAY_SIZE(bounded_char) == 5);
21 }
22}
23
24TEST(BLI_utildefines, BOUNDED_ARRAY_TYPE_SIZE)
25{
26 {
27 int bounded_char[5];
28 static_assert(BOUNDED_ARRAY_TYPE_SIZE<decltype(bounded_char)>() == 5);
29 }
30
31 {
32 int *bounded_char[5];
33 static_assert(BOUNDED_ARRAY_TYPE_SIZE<decltype(bounded_char)>() == 5);
34 }
35
36 {
37 struct MyType {
38 int array[12];
39 };
40
41 static_assert(BOUNDED_ARRAY_TYPE_SIZE<decltype(MyType::array)>() == 12);
42 }
43}
44
45} // namespace blender::tests
#define ARRAY_SIZE(arr)
TEST(any, DefaultConstructor)