Blender V4.3
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"
9
10namespace 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. */
14TEST(BLI_build_config, Basic)
15{
17}
18
19TEST(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. */
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
#define ARCH_CPU_64_BITS
#define ARCH_CPU_LITTLE_ENDIAN
#define ARCH_CPU_BIG_ENDIAN
#define ARCH_CPU_32_BITS
#define ARCH_CPU_31_BITS
TEST(any, DefaultConstructor)