Blender V5.3
BLI_normalized_int_test.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2026 Blender Authors
2 *
3 * SPDX-License-Identifier: Apache-2.0 */
4
5#include "testing/testing.h"
6
8
9namespace blender::tests {
10
11TEST(normalized_int, roundtrip)
12{
13 {
14 const float4 a(-1.0f, 1.0f / 127.0f, 64.0f / 127.0f, 1.0f);
16 }
17 {
18 const float4 a(0.0f, 1.0f / 255.0f, 128.0f / 255.0f, 1.0f);
20 }
21 {
22 const float4 a(-1.0f, 1.0f / 32767.0f, 128.0f / 32767.0f, 1.0f);
24 }
25 {
26 const float2 a(-1.0f, 1.0f / 32767.0f);
28 }
29 {
30 const float4 a(0.0f, 1.0f / 65535.0f, 64.0f / 65535.0f, 1.0f);
32 }
33 {
34 const float4 a(-1.0f, 1.0f / 511.0f, 128.0f / 511.0f, 1.0f);
36 }
37 {
38 const float4 a(0.0f, 1.0f / 1023.0f, 64.0f / 1023.0f, 1.0f);
40 }
41}
42
43} // namespace blender::tests
TEST(any_virtual, DefaultConstructor)
NormalizedIntVecBase< int32_t, 4, 10, 10, 10, 2 > int1010102_norm
NormalizedIntVecBase< uint32_t, 4, 16, 16, 16, 16 > ushort4_norm
NormalizedIntVecBase< uint32_t, 4, 8, 8, 8, 8 > uchar4_norm
VecBase< float, 4 > float4
VecBase< float, 2 > float2
NormalizedIntVecBase< uint32_t, 4, 10, 10, 10, 2 > uint1010102_norm
NormalizedIntVecBase< int32_t, 4, 8, 8, 8, 8 > char4_norm
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
NormalizedIntVecBase< int32_t, 2, 16, 16 > short2_norm
NormalizedIntVecBase< int32_t, 4, 16, 16, 16, 16 > short4_norm