Blender
V4.3
source
blender
blenlib
tests
BLI_build_config_test.cc
Go to the documentation of this file.
1
/* SPDX-FileCopyrightText: 2024 Blender Authors
2
*
3
* SPDX-License-Identifier: Apache-2.0 */
4
5
#include "testing/testing.h"
6
7
#include "
BLI_build_config.h
"
8
#include "
BLI_endian_defines.h
"
9
10
namespace
blender::tests
{
11
12
/* Some basic tests to ensure simple code compiles, and that there are no obvious mistakes in the
13
* build_config implementation. */
14
TEST
(BLI_build_config, Basic)
15
{
16
static_assert
(
ARCH_CPU_31_BITS
||
ARCH_CPU_32_BITS
||
ARCH_CPU_64_BITS
);
17
}
18
19
TEST
(BLI_build_config, Endian)
20
{
21
/* TODO: This could become more comprehensive test when C++20 is available: we can check that
22
* std::endian::native is aligned with the compile-time defines. */
23
static_assert
(
ARCH_CPU_LITTLE_ENDIAN
||
ARCH_CPU_BIG_ENDIAN
);
24
25
/* Verify the build_config is aligned with the CMake configuration. */
26
#if defined(__BIG_ENDIAN__)
27
static_assert
(
ARCH_CPU_BIG_ENDIAN
);
28
static_assert
(!
ARCH_CPU_LITTLE_ENDIAN
);
29
#endif
30
#if defined(__LITTLE_ENDIAN__)
31
static_assert
(!
ARCH_CPU_BIG_ENDIAN
);
32
static_assert
(
ARCH_CPU_LITTLE_ENDIAN
);
33
#endif
34
}
35
36
}
// namespace blender::tests
BLI_build_config.h
ARCH_CPU_64_BITS
#define ARCH_CPU_64_BITS
Definition
BLI_build_config.h:363
ARCH_CPU_LITTLE_ENDIAN
#define ARCH_CPU_LITTLE_ENDIAN
Definition
BLI_build_config.h:350
ARCH_CPU_BIG_ENDIAN
#define ARCH_CPU_BIG_ENDIAN
Definition
BLI_build_config.h:353
ARCH_CPU_32_BITS
#define ARCH_CPU_32_BITS
Definition
BLI_build_config.h:360
ARCH_CPU_31_BITS
#define ARCH_CPU_31_BITS
Definition
BLI_build_config.h:357
BLI_endian_defines.h
blender::tests
Definition
BLI_any_test.cc:10
blender::tests::TEST
TEST(any, DefaultConstructor)
Definition
BLI_any_test.cc:12
Generated on Thu Feb 6 2025 07:36:39 for Blender by
doxygen
1.11.0