Blender
V5.0
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
||
ARCH_CPU_128_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
/* Blender does not build on big endian systems. */
30
static_assert
(0);
31
#endif
32
#if defined(__LITTLE_ENDIAN__)
33
static_assert
(!
ARCH_CPU_BIG_ENDIAN
);
34
static_assert
(
ARCH_CPU_LITTLE_ENDIAN
);
35
#endif
36
}
37
38
}
// namespace blender::tests
BLI_build_config.h
ARCH_CPU_64_BITS
#define ARCH_CPU_64_BITS
Definition
BLI_build_config.h:383
ARCH_CPU_LITTLE_ENDIAN
#define ARCH_CPU_LITTLE_ENDIAN
Definition
BLI_build_config.h:370
ARCH_CPU_BIG_ENDIAN
#define ARCH_CPU_BIG_ENDIAN
Definition
BLI_build_config.h:373
ARCH_CPU_32_BITS
#define ARCH_CPU_32_BITS
Definition
BLI_build_config.h:380
ARCH_CPU_128_BITS
#define ARCH_CPU_128_BITS
Definition
BLI_build_config.h:386
ARCH_CPU_31_BITS
#define ARCH_CPU_31_BITS
Definition
BLI_build_config.h:377
BLI_endian_defines.h
blender::tests
Definition
BLF_tests.cc:9
blender::tests::TEST
TEST(blf_load, load)
Definition
BLF_tests.cc:34
Generated on
for Blender by
doxygen
1.16.1